ems+ empty messages, Flags for solar modules, roomtemp from remote thermostats

This commit is contained in:
MichaelDvP
2020-06-17 12:11:30 +02:00
parent 57762845a4
commit 8ab319dcbb
6 changed files with 38 additions and 23 deletions

View File

@@ -71,7 +71,7 @@
// Solar Modules - 0x30
{ 73, DeviceType::SOLAR, F("SM10"), DeviceFlags::EMS_DEVICE_FLAG_SM10},
{101, DeviceType::SOLAR, F("ISM1"), DeviceFlags::EMS_DEVICE_FLAG_SM100},
{101, DeviceType::SOLAR, F("ISM1"), DeviceFlags::EMS_DEVICE_FLAG_ISM},
{162, DeviceType::SOLAR, F("SM50"), DeviceFlags::EMS_DEVICE_FLAG_SM100},
{163, DeviceType::SOLAR, F("SM100"), DeviceFlags::EMS_DEVICE_FLAG_SM100},
{164, DeviceType::SOLAR, F("SM200"), DeviceFlags::EMS_DEVICE_FLAG_SM100},

View File

@@ -33,7 +33,10 @@ Solar::Solar(uint8_t device_type, uint8_t device_id, uint8_t product_id, const s
LOG_DEBUG(F("Registering new Solar module with device ID 0x%02X"), device_id);
// telegram handlers
if (flags == EMSdevice::EMS_DEVICE_FLAG_SM10) {
register_telegram_type(0x0097, F("SM10Monitor"), true, std::bind(&Solar::process_SM10Monitor, this, _1));
}
if (flags == EMSdevice::EMS_DEVICE_FLAG_SM100) {
register_telegram_type(0x0362, F("SM100Monitor"), true, std::bind(&Solar::process_SM100Monitor, this, _1));
register_telegram_type(0x0363, F("SM100Monitor2"), true, std::bind(&Solar::process_SM100Monitor2, this, _1));
register_telegram_type(0x0366, F("SM100Config"), true, std::bind(&Solar::process_SM100Config, this, _1));
@@ -41,8 +44,11 @@ Solar::Solar(uint8_t device_type, uint8_t device_id, uint8_t product_id, const s
register_telegram_type(0x0364, F("SM100Status"), false, std::bind(&Solar::process_SM100Status, this, _1));
register_telegram_type(0x036A, F("SM100Status2"), false, std::bind(&Solar::process_SM100Status2, this, _1));
register_telegram_type(0x038E, F("SM100Energy"), true, std::bind(&Solar::process_SM100Energy, this, _1));
}
if (flags == EMSdevice::EMS_DEVICE_FLAG_ISM) {
register_telegram_type(0x0103, F("ISM1StatusMessage"), true, std::bind(&Solar::process_ISM1StatusMessage, this, _1));
register_telegram_type(0x0101, F("ISM1Set"), false, std::bind(&Solar::process_ISM1Set, this, _1));
}
// MQTT callbacks
// register_mqtt_topic("cmd", std::bind(&Solar::cmd, this, _1));
@@ -206,7 +212,7 @@ void Solar::process_SM100Energy(std::shared_ptr<const Telegram> telegram) {
void Solar::process_ISM1StatusMessage(std::shared_ptr<const Telegram> telegram) {
telegram->read_value(collectorTemp_, 4); // Collector Temperature
telegram->read_value(bottomTemp_, 6); // Temperature Bottom of Solar Boiler
telegram->read_value(energyLastHour_, 2); // Solar Energy produced in last hour - is * 10 and handled in ems-esp.cpp
telegram->read_value32(energyLastHour_, 0); // Solar Energy produced in last hour - is * 10 and handled in ems-esp.cpp
telegram->read_value(pump_, 8, 0); // Solar pump on (1) or off (0)
telegram->read_value(pumpWorkMin_, 10);
}

View File

@@ -67,6 +67,7 @@ Thermostat::Thermostat(uint8_t device_type, uint8_t device_id, uint8_t product_i
register_telegram_type(monitor_typeids[i], F("RC20Monitor"), false, std::bind(&Thermostat::process_RC20Monitor, this, _1));
register_telegram_type(set_typeids[i], F("RC20Set"), false, std::bind(&Thermostat::process_RC20Set, this, _1));
}
register_telegram_type(0xAF, F("RC20Remote"), false, std::bind(&Thermostat::process_RC20Remote, this, _1));
// RC20 newer
} else if (flags == EMSdevice::EMS_DEVICE_FLAG_RC20_2) {
@@ -76,6 +77,7 @@ Thermostat::Thermostat(uint8_t device_type, uint8_t device_id, uint8_t product_i
register_telegram_type(monitor_typeids[i], F("RC20Monitor"), false, std::bind(&Thermostat::process_RC20Monitor_2, this, _1));
register_telegram_type(set_typeids[i], F("RC20Set"), false, std::bind(&Thermostat::process_RC20Set_2, this, _1));
}
register_telegram_type(0xAF, F("RC20Remote"), false, std::bind(&Thermostat::process_RC20Remote, this, _1));
// RC30
} else if (flags == EMSdevice::EMS_DEVICE_FLAG_RC30) {
@@ -655,6 +657,11 @@ std::shared_ptr<Thermostat::HeatingCircuit> Thermostat::heating_circuit(std::sha
}
}
// not found, search device-id types for remote thermostats
if (telegram->src >= 0x18 && telegram->src <= 0x1B) {
hc_num = telegram->src - 0x17;
}
// still didn't recognize it, ignore it
if (hc_num == 0) {
return nullptr;
@@ -950,6 +957,12 @@ void Thermostat::process_RC20Set_2(std::shared_ptr<const Telegram> telegram) {
telegram->read_value(hc->mode, 3);
}
// 0xAF - for reading the roomtemperature from the RC20/ES72 thermostat (0x18, 0x19, ..)
void Thermostat::process_RC20Remote(std::shared_ptr<const Telegram> telegram) {
std::shared_ptr<Thermostat::HeatingCircuit> hc = heating_circuit(telegram);
telegram->read_value(hc->curr_roomTemp, 0);
}
// type 0xB1 - data from the RC10 thermostat (0x17)
void Thermostat::process_RC10Monitor(std::shared_ptr<const Telegram> telegram) {
std::shared_ptr<Thermostat::HeatingCircuit> hc = heating_circuit(telegram);

View File

@@ -216,6 +216,7 @@ class Thermostat : public EMSdevice {
void process_RC20Monitor(std::shared_ptr<const Telegram> telegram);
void process_RC20Set(std::shared_ptr<const Telegram> telegram);
void process_RC20Remote(std::shared_ptr<const Telegram> telegram);
void process_RC20Monitor_2(std::shared_ptr<const Telegram> telegram);
void process_RC20Set_2(std::shared_ptr<const Telegram> telegram);

View File

@@ -181,6 +181,7 @@ class EMSdevice {
// Solar Module
static constexpr uint8_t EMS_DEVICE_FLAG_SM10 = 1;
static constexpr uint8_t EMS_DEVICE_FLAG_SM100 = 2;
static constexpr uint8_t EMS_DEVICE_FLAG_ISM = 3;
// Mixing Module
static constexpr uint8_t EMS_DEVICE_FLAG_MMPLUS = 1;

View File

@@ -279,15 +279,9 @@ void RxService::add(uint8_t * data, uint8_t length) {
} else {
// EMS 2.0 / EMS+
if (data[2] == 0xFF) {
// check for empty data
// special broadcast telegrams on ems+ have no data values, some even don't have a type ID, e.g. "21 0B FF 00"
if (length > 8) {
message_length -= 7; // remove 6 byte header plus CRC
message_data += 6; // message block starts at 7th position
}
if (length > 5) {
type_id = (data[4] << 8) + data[5] + 256; // set type_id if there is one
}
} else {
// its F9 or F7
uint8_t shift = (data[4] != 0xFF) ? 1 : 0; // true (1) if 5th byte is not 0xFF, then telegram is 1 byte longer