mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
cleanup other devices & SM
This commit is contained in:
@@ -480,12 +480,12 @@ void showInfo() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// For HeatPumps
|
// For HeatPumps
|
||||||
if (EMS_Other.HP) {
|
if (ems_getHeatPumpEnabled()) {
|
||||||
myDebug_P(PSTR("")); // newline
|
myDebug_P(PSTR("")); // newline
|
||||||
myDebug_P(PSTR("%sHeat Pump stats:%s"), COLOR_BOLD_ON, COLOR_BOLD_OFF);
|
myDebug_P(PSTR("%sHeat Pump stats:%s"), COLOR_BOLD_ON, COLOR_BOLD_OFF);
|
||||||
myDebug_P(PSTR(" Solar Module: %s"), ems_getHeatPumpDescription(buffer_type));
|
myDebug_P(PSTR(" Solar Module: %s"), ems_getHeatPumpDescription(buffer_type));
|
||||||
_renderIntValue("Pump modulation", "%", EMS_Other.HPModulation);
|
_renderIntValue("Pump modulation", "%", EMS_HeatPump.HPModulation);
|
||||||
_renderIntValue("Pump speed", "%", EMS_Other.HPSpeed);
|
_renderIntValue("Pump speed", "%", EMS_HeatPump.HPSpeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Thermostat stats
|
// Thermostat stats
|
||||||
@@ -824,16 +824,16 @@ void publishValues(bool force) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// handle HeatPump
|
// handle HeatPump
|
||||||
if (EMS_Other.HP) {
|
if (ems_getHeatPumpEnabled()) {
|
||||||
// build new json object
|
// build new json object
|
||||||
doc.clear();
|
doc.clear();
|
||||||
JsonObject rootSM = doc.to<JsonObject>();
|
JsonObject rootSM = doc.to<JsonObject>();
|
||||||
|
|
||||||
if (EMS_Other.HPModulation != EMS_VALUE_INT_NOTSET)
|
if (EMS_HeatPump.HPModulation != EMS_VALUE_INT_NOTSET)
|
||||||
rootSM[HP_PUMPMODULATION] = EMS_Other.HPModulation;
|
rootSM[HP_PUMPMODULATION] = EMS_HeatPump.HPModulation;
|
||||||
|
|
||||||
if (EMS_Other.HPSpeed != EMS_VALUE_INT_NOTSET)
|
if (EMS_HeatPump.HPSpeed != EMS_VALUE_INT_NOTSET)
|
||||||
rootSM[HP_PUMPSPEED] = EMS_Other.HPSpeed;
|
rootSM[HP_PUMPSPEED] = EMS_HeatPump.HPSpeed;
|
||||||
|
|
||||||
data[0] = '\0'; // reset data for next package
|
data[0] = '\0'; // reset data for next package
|
||||||
serializeJson(doc, data, sizeof(data));
|
serializeJson(doc, data, sizeof(data));
|
||||||
@@ -1721,6 +1721,13 @@ void setup() {
|
|||||||
// web custom settings
|
// web custom settings
|
||||||
myESP.setWeb(WebCallback);
|
myESP.setWeb(WebCallback);
|
||||||
|
|
||||||
|
// serial off as default for fresh installs
|
||||||
|
#ifdef NO_SERIAL
|
||||||
|
myESP.setUseSerial(false);
|
||||||
|
#else
|
||||||
|
myESP.setUseSerial(true);
|
||||||
|
#endif
|
||||||
|
|
||||||
// start up all the services
|
// start up all the services
|
||||||
myESP.begin(APP_HOSTNAME, APP_NAME, APP_VERSION);
|
myESP.begin(APP_HOSTNAME, APP_NAME, APP_VERSION);
|
||||||
|
|
||||||
|
|||||||
124
src/ems.cpp
124
src/ems.cpp
@@ -121,17 +121,18 @@ const _EMS_Type EMS_Types[] = {
|
|||||||
{EMS_MODEL_UBA, EMS_TYPE_UBAParametersMessage, "UBAParametersMessage", _process_UBAParametersMessage},
|
{EMS_MODEL_UBA, EMS_TYPE_UBAParametersMessage, "UBAParametersMessage", _process_UBAParametersMessage},
|
||||||
{EMS_MODEL_UBA, EMS_TYPE_UBASetPoints, "UBASetPoints", _process_SetPoints},
|
{EMS_MODEL_UBA, EMS_TYPE_UBASetPoints, "UBASetPoints", _process_SetPoints},
|
||||||
|
|
||||||
// Other devices
|
// SM devices
|
||||||
{EMS_MODEL_OTHER, EMS_TYPE_SM10Monitor, "SM10Monitor", _process_SM10Monitor},
|
{EMS_MODEL_SM, EMS_TYPE_SM10Monitor, "SM10Monitor", _process_SM10Monitor},
|
||||||
{EMS_MODEL_OTHER, EMS_TYPE_SM100Monitor, "SM100Monitor", _process_SM100Monitor},
|
{EMS_MODEL_SM, EMS_TYPE_SM100Monitor, "SM100Monitor", _process_SM100Monitor},
|
||||||
{EMS_MODEL_OTHER, EMS_TYPE_SM100Status, "SM100Status", _process_SM100Status},
|
{EMS_MODEL_SM, EMS_TYPE_SM100Status, "SM100Status", _process_SM100Status},
|
||||||
{EMS_MODEL_OTHER, EMS_TYPE_SM100Status2, "SM100Status2", _process_SM100Status2},
|
{EMS_MODEL_SM, EMS_TYPE_SM100Status2, "SM100Status2", _process_SM100Status2},
|
||||||
{EMS_MODEL_OTHER, EMS_TYPE_SM100Energy, "SM100Energy", _process_SM100Energy},
|
{EMS_MODEL_SM, EMS_TYPE_SM100Energy, "SM100Energy", _process_SM100Energy},
|
||||||
{EMS_MODEL_OTHER, EMS_TYPE_HPMonitor1, "HeatPumpMonitor1", _process_HPMonitor1},
|
{EMS_MODEL_SM, EMS_TYPE_ISM1StatusMessage, "ISM1StatusMessage", _process_ISM1StatusMessage},
|
||||||
{EMS_MODEL_OTHER, EMS_TYPE_HPMonitor2, "HeatPumpMonitor2", _process_HPMonitor2},
|
{EMS_MODEL_SM, EMS_TYPE_ISM1Set, "ISM1Set", _process_ISM1Set},
|
||||||
{EMS_MODEL_OTHER, EMS_TYPE_ISM1StatusMessage, "ISM1StatusMessage", _process_ISM1StatusMessage},
|
|
||||||
{EMS_MODEL_OTHER, EMS_TYPE_ISM1Set, "ISM1Set", _process_ISM1Set},
|
|
||||||
|
|
||||||
|
// heatpunps
|
||||||
|
{EMS_MODEL_HP, EMS_TYPE_HPMonitor1, "HeatPumpMonitor1", _process_HPMonitor1},
|
||||||
|
{EMS_MODEL_HP, EMS_TYPE_HPMonitor2, "HeatPumpMonitor2", _process_HPMonitor2},
|
||||||
|
|
||||||
// RC10
|
// RC10
|
||||||
{EMS_MODEL_RC10, EMS_TYPE_RCTime, "RCTime", _process_RCTime},
|
{EMS_MODEL_RC10, EMS_TYPE_RCTime, "RCTime", _process_RCTime},
|
||||||
@@ -190,11 +191,13 @@ uint8_t _Boiler_Types_max = ArraySize(Boiler_Types); // number of boi
|
|||||||
uint8_t _Solar_Module_Types_max = ArraySize(SolarModule_Types); // number of solar module types
|
uint8_t _Solar_Module_Types_max = ArraySize(SolarModule_Types); // number of solar module types
|
||||||
uint8_t _Other_Types_max = ArraySize(Other_Types); // number of other ems devices
|
uint8_t _Other_Types_max = ArraySize(Other_Types); // number of other ems devices
|
||||||
uint8_t _Thermostat_Types_max = ArraySize(Thermostat_Types); // number of defined thermostat types
|
uint8_t _Thermostat_Types_max = ArraySize(Thermostat_Types); // number of defined thermostat types
|
||||||
|
uint8_t _HeatPump_Types_max = ArraySize(HeatPump_Types); // number of defined heatpuimp types
|
||||||
|
|
||||||
// these structs contain the data we store from the Boiler and Thermostat
|
// these structs contain the data we store from the specific EMS devices
|
||||||
_EMS_Boiler EMS_Boiler; // for boiler
|
_EMS_Boiler EMS_Boiler; // for boiler
|
||||||
_EMS_Thermostat EMS_Thermostat; // for thermostat
|
_EMS_Thermostat EMS_Thermostat; // for thermostat
|
||||||
_EMS_SolarModule EMS_SolarModule; // for solar modules
|
_EMS_SolarModule EMS_SolarModule; // for solar modules
|
||||||
|
_EMS_HeatPump EMS_HeatPump; // for heatpumps
|
||||||
_EMS_Other EMS_Other; // for other known EMS devices
|
_EMS_Other EMS_Other; // for other known EMS devices
|
||||||
|
|
||||||
// CRC lookup table with poly 12 for faster checking
|
// CRC lookup table with poly 12 for faster checking
|
||||||
@@ -318,11 +321,11 @@ void ems_init() {
|
|||||||
EMS_SolarModule.pumpWorkMin = EMS_VALUE_LONG_NOTSET;
|
EMS_SolarModule.pumpWorkMin = EMS_VALUE_LONG_NOTSET;
|
||||||
|
|
||||||
// Other EMS devices values
|
// Other EMS devices values
|
||||||
EMS_Other.HPModulation = EMS_VALUE_INT_NOTSET;
|
EMS_HeatPump.HPModulation = EMS_VALUE_INT_NOTSET;
|
||||||
EMS_Other.HPSpeed = EMS_VALUE_INT_NOTSET;
|
EMS_HeatPump.HPSpeed = EMS_VALUE_INT_NOTSET;
|
||||||
EMS_Other.device_id = EMS_ID_NONE;
|
EMS_HeatPump.device_id = EMS_ID_NONE;
|
||||||
EMS_Other.model_id = EMS_MODEL_NONE;
|
EMS_HeatPump.model_id = EMS_MODEL_NONE;
|
||||||
EMS_Other.product_id = EMS_ID_NONE;
|
EMS_HeatPump.product_id = EMS_ID_NONE;
|
||||||
|
|
||||||
// calculated values
|
// calculated values
|
||||||
EMS_Boiler.tapwaterActive = EMS_VALUE_INT_NOTSET; // Hot tap water is on/off
|
EMS_Boiler.tapwaterActive = EMS_VALUE_INT_NOTSET; // Hot tap water is on/off
|
||||||
@@ -337,8 +340,6 @@ void ems_init() {
|
|||||||
EMS_Thermostat.product_id = EMS_ID_NONE;
|
EMS_Thermostat.product_id = EMS_ID_NONE;
|
||||||
strlcpy(EMS_Thermostat.version, "?", sizeof(EMS_Thermostat.version));
|
strlcpy(EMS_Thermostat.version, "?", sizeof(EMS_Thermostat.version));
|
||||||
|
|
||||||
// set other types
|
|
||||||
EMS_Other.HP = false;
|
|
||||||
|
|
||||||
// default logging is none
|
// default logging is none
|
||||||
ems_setLogging(EMS_SYS_LOGGING_DEFAULT);
|
ems_setLogging(EMS_SYS_LOGGING_DEFAULT);
|
||||||
@@ -395,12 +396,12 @@ bool ems_getSolarModuleEnabled() {
|
|||||||
return (EMS_SolarModule.device_id != EMS_ID_NONE);
|
return (EMS_SolarModule.device_id != EMS_ID_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t ems_getThermostatModel() {
|
bool ems_getHeatPumpEnabled() {
|
||||||
return (EMS_Thermostat.model_id);
|
return (EMS_HeatPump.device_id != EMS_ID_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t ems_getOtherModel() {
|
uint8_t ems_getThermostatModel() {
|
||||||
return (EMS_Other.model_id);
|
return (EMS_Thermostat.model_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t ems_getSolarModuleModel() {
|
uint8_t ems_getSolarModuleModel() {
|
||||||
@@ -1406,7 +1407,6 @@ void _process_SM10Monitor(_EMS_RxTelegram * EMS_RxTelegram) {
|
|||||||
EMS_SolarModule.pumpModulation = _toByte(4); // modulation solar pump
|
EMS_SolarModule.pumpModulation = _toByte(4); // modulation solar pump
|
||||||
EMS_SolarModule.pump = _bitRead(7, 1); // active if bit 1 is set
|
EMS_SolarModule.pump = _bitRead(7, 1); // active if bit 1 is set
|
||||||
|
|
||||||
// EMS_Other.SM = true;
|
|
||||||
EMS_Sys_Status.emsRefreshed = true; // triggers a send the values back via MQTT
|
EMS_Sys_Status.emsRefreshed = true; // triggers a send the values back via MQTT
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1428,7 +1428,6 @@ void _process_SM100Monitor(_EMS_RxTelegram * EMS_RxTelegram) {
|
|||||||
EMS_SolarModule.bottomTemp = _toShort(2); // bottom temp from SM100, is *10
|
EMS_SolarModule.bottomTemp = _toShort(2); // bottom temp from SM100, is *10
|
||||||
}
|
}
|
||||||
|
|
||||||
// EMS_Other.SM = true;
|
|
||||||
EMS_Sys_Status.emsRefreshed = true; // triggers a send the values back via MQTT
|
EMS_Sys_Status.emsRefreshed = true; // triggers a send the values back via MQTT
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1446,7 +1445,6 @@ void _process_SM100Status(_EMS_RxTelegram * EMS_RxTelegram) {
|
|||||||
EMS_SolarModule.pumpModulation = _toByte(0); // modulation solar pump
|
EMS_SolarModule.pumpModulation = _toByte(0); // modulation solar pump
|
||||||
}
|
}
|
||||||
|
|
||||||
// EMS_Other.SM = true;
|
|
||||||
EMS_Sys_Status.emsRefreshed = true; // triggers a send the values back via MQTT
|
EMS_Sys_Status.emsRefreshed = true; // triggers a send the values back via MQTT
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1462,7 +1460,6 @@ void _process_SM100Status2(_EMS_RxTelegram * EMS_RxTelegram) {
|
|||||||
EMS_SolarModule.pump = _bitRead(0, 2); // 03=off 04=on
|
EMS_SolarModule.pump = _bitRead(0, 2); // 03=off 04=on
|
||||||
}
|
}
|
||||||
|
|
||||||
// EMS_Other.SM = true;
|
|
||||||
EMS_Sys_Status.emsRefreshed = true; // triggers a send the values back via MQTT
|
EMS_Sys_Status.emsRefreshed = true; // triggers a send the values back via MQTT
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1475,7 +1472,6 @@ void _process_SM100Energy(_EMS_RxTelegram * EMS_RxTelegram) {
|
|||||||
EMS_SolarModule.EnergyToday = _toShort(6); // todays in Wh
|
EMS_SolarModule.EnergyToday = _toShort(6); // todays in Wh
|
||||||
EMS_SolarModule.EnergyTotal = _toShort(10); // total / 10 in kWh
|
EMS_SolarModule.EnergyTotal = _toShort(10); // total / 10 in kWh
|
||||||
|
|
||||||
// EMS_Other.SM = true;
|
|
||||||
EMS_Sys_Status.emsRefreshed = true; // triggers a send the values back via MQTT
|
EMS_Sys_Status.emsRefreshed = true; // triggers a send the values back via MQTT
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1483,20 +1479,16 @@ void _process_SM100Energy(_EMS_RxTelegram * EMS_RxTelegram) {
|
|||||||
* Type 0xE3 - HeatPump Monitor 1
|
* Type 0xE3 - HeatPump Monitor 1
|
||||||
*/
|
*/
|
||||||
void _process_HPMonitor1(_EMS_RxTelegram * EMS_RxTelegram) {
|
void _process_HPMonitor1(_EMS_RxTelegram * EMS_RxTelegram) {
|
||||||
EMS_Other.HPModulation = _toByte(14); // modulation %
|
EMS_HeatPump.HPModulation = _toByte(14); // modulation %
|
||||||
|
EMS_Sys_Status.emsRefreshed = true; // triggers a send the values back via MQTT
|
||||||
EMS_Other.HP = true;
|
|
||||||
EMS_Sys_Status.emsRefreshed = true; // triggers a send the values back via MQTT
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Type 0xE5 - HeatPump Monitor 2
|
* Type 0xE5 - HeatPump Monitor 2
|
||||||
*/
|
*/
|
||||||
void _process_HPMonitor2(_EMS_RxTelegram * EMS_RxTelegram) {
|
void _process_HPMonitor2(_EMS_RxTelegram * EMS_RxTelegram) {
|
||||||
EMS_Other.HPSpeed = _toByte(25); // speed %
|
EMS_HeatPump.HPSpeed = _toByte(25); // speed %
|
||||||
|
EMS_Sys_Status.emsRefreshed = true; // triggers a send the values back via MQTT
|
||||||
EMS_Other.HP = true;
|
|
||||||
EMS_Sys_Status.emsRefreshed = true; // triggers a send the values back via MQTT
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1510,13 +1502,11 @@ void _process_ISM1StatusMessage(_EMS_RxTelegram * EMS_RxTelegram) {
|
|||||||
EMS_SolarModule.EnergyLastHour = _toShort(2) * 10; // Solar Energy produced in last hour
|
EMS_SolarModule.EnergyLastHour = _toShort(2) * 10; // Solar Energy produced in last hour
|
||||||
EMS_SolarModule.pump = _bitRead(8, 0); // Solar pump on (1) or off (0)
|
EMS_SolarModule.pump = _bitRead(8, 0); // Solar pump on (1) or off (0)
|
||||||
EMS_SolarModule.pumpWorkMin = _toLong(10);
|
EMS_SolarModule.pumpWorkMin = _toLong(10);
|
||||||
// EMS_Other.SM = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EMS_RxTelegram->offset == 4) {
|
if (EMS_RxTelegram->offset == 4) {
|
||||||
// e.g. B0 00 FF 04 00 03 02 E5
|
// e.g. B0 00 FF 04 00 03 02 E5
|
||||||
EMS_SolarModule.collectorTemp = _toShort(0); // Collector Temperature
|
EMS_SolarModule.collectorTemp = _toShort(0); // Collector Temperature
|
||||||
// EMS_Other.SM = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1706,7 +1696,7 @@ void _process_Version(_EMS_RxTelegram * EMS_RxTelegram) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// finally look for Solar Modules
|
// look for Solar Modules
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < _Solar_Module_Types_max) {
|
while (i < _Solar_Module_Types_max) {
|
||||||
if (SolarModule_Types[i].product_id == product_id) {
|
if (SolarModule_Types[i].product_id == product_id) {
|
||||||
@@ -1726,9 +1716,7 @@ void _process_Version(_EMS_RxTelegram * EMS_RxTelegram) {
|
|||||||
// add to list
|
// add to list
|
||||||
_addDevice(product_id, SolarModule_Types[i].device_id, version, SolarModule_Types[i].model_string);
|
_addDevice(product_id, SolarModule_Types[i].device_id, version, SolarModule_Types[i].model_string);
|
||||||
|
|
||||||
// EMS_Other.SM = true; // we have detected a Solar Module (SM10, SM100, ISM1 ...)
|
|
||||||
myDebug_P(PSTR("Solar Module support enabled."));
|
myDebug_P(PSTR("Solar Module support enabled."));
|
||||||
EMS_SolarModule.model_id = SolarModule_Types[i].model_id;
|
|
||||||
EMS_SolarModule.device_id = SolarModule_Types[i].device_id;
|
EMS_SolarModule.device_id = SolarModule_Types[i].device_id;
|
||||||
EMS_SolarModule.product_id = product_id;
|
EMS_SolarModule.product_id = product_id;
|
||||||
strlcpy(EMS_SolarModule.version, version, sizeof(EMS_SolarModule.version));
|
strlcpy(EMS_SolarModule.version, version, sizeof(EMS_SolarModule.version));
|
||||||
@@ -1738,6 +1726,32 @@ void _process_Version(_EMS_RxTelegram * EMS_RxTelegram) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// look for heatpumps
|
||||||
|
i = 0;
|
||||||
|
while (i < _HeatPump_Types_max) {
|
||||||
|
if (HeatPump_Types[i].product_id == product_id) {
|
||||||
|
typeFound = true; // we have a matching product id. i is the index.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeFound) {
|
||||||
|
myDebug_P(PSTR("Heat Pump found: %s (DeviceID:0x%02X ProductID:%d Version:%s)"),
|
||||||
|
HeatPump_Types[i].model_string,
|
||||||
|
HeatPump_Types[i].device_id,
|
||||||
|
product_id,
|
||||||
|
version);
|
||||||
|
|
||||||
|
// add to list
|
||||||
|
_addDevice(product_id, HeatPump_Types[i].device_id, version, HeatPump_Types[i].model_string);
|
||||||
|
|
||||||
|
myDebug_P(PSTR("Heat Pump support enabled."));
|
||||||
|
EMS_HeatPump.device_id = SolarModule_Types[i].device_id;
|
||||||
|
EMS_HeatPump.product_id = product_id;
|
||||||
|
strlcpy(EMS_HeatPump.version, version, sizeof(EMS_HeatPump.version));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// finally look for the other EMS devices
|
// finally look for the other EMS devices
|
||||||
i = 0;
|
i = 0;
|
||||||
@@ -1754,23 +1768,9 @@ void _process_Version(_EMS_RxTelegram * EMS_RxTelegram) {
|
|||||||
|
|
||||||
// add to list
|
// add to list
|
||||||
_addDevice(product_id, Other_Types[i].device_id, version, Other_Types[i].model_string);
|
_addDevice(product_id, Other_Types[i].device_id, version, Other_Types[i].model_string);
|
||||||
|
|
||||||
// see if this is a HeatPump
|
|
||||||
if (Other_Types[i].device_id == EMS_ID_HP) {
|
|
||||||
EMS_Other.HP = true; // we have detected a HP
|
|
||||||
myDebug_P(PSTR("HeatPump support enabled."));
|
|
||||||
EMS_Other.model_id = Other_Types[i].model_id;
|
|
||||||
EMS_Other.device_id = Other_Types[i].device_id;
|
|
||||||
EMS_Other.product_id = product_id;
|
|
||||||
strlcpy(EMS_Other.version, version, sizeof(EMS_Other.version));
|
|
||||||
// fetch Solar Module values > not yet implemented
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
myDebug_P(PSTR("Unrecognized device found: %s (DeviceID:0x%02X ProductID:%d Version:%s)"), EMS_RxTelegram->src, product_id, version);
|
myDebug_P(PSTR("Unrecognized device found: %s (DeviceID:0x%02X ProductID:%d Version:%s)"), EMS_RxTelegram->src, product_id, version);
|
||||||
|
|
||||||
// add to list
|
// add to list
|
||||||
_addDevice(product_id, EMS_RxTelegram->src, version, "unknown?");
|
_addDevice(product_id, EMS_RxTelegram->src, version, "unknown?");
|
||||||
}
|
}
|
||||||
@@ -2056,7 +2056,7 @@ char * ems_getSolarModuleDescription(char * buffer) {
|
|||||||
*/
|
*/
|
||||||
char * ems_getHeatPumpDescription(char * buffer) {
|
char * ems_getHeatPumpDescription(char * buffer) {
|
||||||
uint8_t size = 128;
|
uint8_t size = 128;
|
||||||
if (!EMS_Other.HP) {
|
if (!ems_getHeatPumpEnabled()) {
|
||||||
strlcpy(buffer, "<not enabled>", size);
|
strlcpy(buffer, "<not enabled>", size);
|
||||||
} else {
|
} else {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@@ -2064,28 +2064,28 @@ char * ems_getHeatPumpDescription(char * buffer) {
|
|||||||
char tmp[6] = {0};
|
char tmp[6] = {0};
|
||||||
|
|
||||||
// scan through known ID types
|
// scan through known ID types
|
||||||
while (i < _Other_Types_max) {
|
while (i < _HeatPump_Types_max) {
|
||||||
if (Other_Types[i].product_id == EMS_Other.product_id) {
|
if (HeatPump_Types[i].product_id == EMS_HeatPump.product_id) {
|
||||||
found = true; // we have a match
|
found = true; // we have a match
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
if (found) {
|
if (found) {
|
||||||
strlcpy(buffer, Other_Types[i].model_string, size);
|
strlcpy(buffer, HeatPump_Types[i].model_string, size);
|
||||||
} else {
|
} else {
|
||||||
strlcpy(buffer, "DeviceID: 0x", size);
|
strlcpy(buffer, "DeviceID: 0x", size);
|
||||||
strlcat(buffer, _hextoa(EMS_Other.device_id, tmp), size);
|
strlcat(buffer, _hextoa(EMS_HeatPump.device_id, tmp), size);
|
||||||
}
|
}
|
||||||
|
|
||||||
strlcat(buffer, " (ProductID:", size);
|
strlcat(buffer, " (ProductID:", size);
|
||||||
if (EMS_Other.product_id == EMS_ID_NONE) {
|
if (EMS_HeatPump.product_id == EMS_ID_NONE) {
|
||||||
strlcat(buffer, "?", size);
|
strlcat(buffer, "?", size);
|
||||||
} else {
|
} else {
|
||||||
strlcat(buffer, itoa(EMS_Other.product_id, tmp, 10), size);
|
strlcat(buffer, itoa(EMS_HeatPump.product_id, tmp, 10), size);
|
||||||
}
|
}
|
||||||
strlcat(buffer, " Version:", size);
|
strlcat(buffer, " Version:", size);
|
||||||
strlcat(buffer, EMS_Other.version, size);
|
strlcat(buffer, EMS_HeatPump.version, size);
|
||||||
strlcat(buffer, ")", size);
|
strlcat(buffer, ")", size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
37
src/ems.h
37
src/ems.h
@@ -156,27 +156,30 @@ const _EMS_TxTelegram EMS_TX_TELEGRAM_NEW = {
|
|||||||
{0x00} // data
|
{0x00} // data
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// where defintions are stored
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t model_id;
|
|
||||||
uint8_t product_id;
|
uint8_t product_id;
|
||||||
char model_string[50];
|
char model_string[50];
|
||||||
} _Boiler_Type;
|
} _Boiler_Type;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t model_id;
|
|
||||||
uint8_t product_id;
|
uint8_t product_id;
|
||||||
uint8_t device_id;
|
uint8_t device_id;
|
||||||
char model_string[50];
|
char model_string[50];
|
||||||
} _SolarModule_Type;
|
} _SolarModule_Type;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t model_id;
|
|
||||||
uint8_t product_id;
|
uint8_t product_id;
|
||||||
uint8_t device_id;
|
uint8_t device_id;
|
||||||
char model_string[50];
|
char model_string[50];
|
||||||
} _Other_Type;
|
} _Other_Type;
|
||||||
|
|
||||||
// Definition for thermostat devices
|
typedef struct {
|
||||||
|
uint8_t product_id;
|
||||||
|
uint8_t device_id;
|
||||||
|
char model_string[50];
|
||||||
|
} _HeatPump_Type;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t model_id;
|
uint8_t model_id;
|
||||||
uint8_t product_id;
|
uint8_t product_id;
|
||||||
@@ -185,6 +188,8 @@ typedef struct {
|
|||||||
bool write_supported;
|
bool write_supported;
|
||||||
} _Thermostat_Type;
|
} _Thermostat_Type;
|
||||||
|
|
||||||
|
|
||||||
|
// for consolidating all types
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t product_id;
|
uint8_t product_id;
|
||||||
uint8_t device_id;
|
uint8_t device_id;
|
||||||
@@ -256,14 +261,19 @@ typedef struct { // UBAParameterWW
|
|||||||
* Telegram package defintions for Other EMS devices
|
* Telegram package defintions for Other EMS devices
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Other ems devices than solar modules, thermostats and boilers
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
bool HP; // set true if there is a Heat Pump available
|
|
||||||
uint8_t HPModulation; // heatpump modulation in %
|
uint8_t HPModulation; // heatpump modulation in %
|
||||||
uint8_t HPSpeed; // speed 0-100 %
|
uint8_t HPSpeed; // speed 0-100 %
|
||||||
uint8_t device_id; // the device ID of the Solar Module / Heat Pump (e.g. 0x30)
|
uint8_t device_id; // the device ID of the Heat Pump (e.g. 0x30)
|
||||||
uint8_t model_id; // Solar Module / Heat Pump model (e.g. 3 > EMS_MODEL_OTHER )
|
uint8_t model_id; // Solar Module / Heat Pump model (e.g. 3 > EMS_MODEL_OTHER )
|
||||||
uint8_t product_id; // (e.g. 101)
|
uint8_t product_id;
|
||||||
|
char version[10];
|
||||||
|
} _EMS_HeatPump;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint8_t device_id;
|
||||||
|
uint8_t model_id;
|
||||||
|
uint8_t product_id;
|
||||||
char version[10];
|
char version[10];
|
||||||
} _EMS_Other;
|
} _EMS_Other;
|
||||||
|
|
||||||
@@ -278,9 +288,9 @@ typedef struct {
|
|||||||
int16_t EnergyToday;
|
int16_t EnergyToday;
|
||||||
int16_t EnergyTotal;
|
int16_t EnergyTotal;
|
||||||
uint32_t pumpWorkMin; // Total solar pump operating time
|
uint32_t pumpWorkMin; // Total solar pump operating time
|
||||||
uint8_t device_id; // the device ID of the Solar Module / Heat Pump (e.g. 0x30)
|
uint8_t device_id; // the device ID of the Solar Module
|
||||||
uint8_t model_id; // Solar Module / Heat Pump model (e.g. 3 > EMS_MODEL_OTHER )
|
uint8_t model_id; // Solar Module
|
||||||
uint8_t product_id; // (e.g. 101)
|
uint8_t product_id;
|
||||||
char version[10];
|
char version[10];
|
||||||
} _EMS_SolarModule;
|
} _EMS_SolarModule;
|
||||||
|
|
||||||
@@ -363,12 +373,12 @@ bool ems_getTxEnabled();
|
|||||||
bool ems_getThermostatEnabled();
|
bool ems_getThermostatEnabled();
|
||||||
bool ems_getBoilerEnabled();
|
bool ems_getBoilerEnabled();
|
||||||
bool ems_getSolarModuleEnabled();
|
bool ems_getSolarModuleEnabled();
|
||||||
|
bool ems_getHeatPumpEnabled();
|
||||||
bool ems_getBusConnected();
|
bool ems_getBusConnected();
|
||||||
_EMS_SYS_LOGGING ems_getLogging();
|
_EMS_SYS_LOGGING ems_getLogging();
|
||||||
bool ems_getEmsRefreshed();
|
bool ems_getEmsRefreshed();
|
||||||
uint8_t ems_getThermostatModel();
|
uint8_t ems_getThermostatModel();
|
||||||
uint8_t ems_getSolarModuleModel();
|
uint8_t ems_getSolarModuleModel();
|
||||||
uint8_t ems_getOtherModel();
|
|
||||||
void ems_discoverModels();
|
void ems_discoverModels();
|
||||||
bool ems_getTxCapable();
|
bool ems_getTxCapable();
|
||||||
uint32_t ems_getPollFrequency();
|
uint32_t ems_getPollFrequency();
|
||||||
@@ -378,8 +388,6 @@ uint8_t _crcCalculator(uint8_t * data, uint8_t len);
|
|||||||
void _processType(_EMS_RxTelegram * EMS_RxTelegram);
|
void _processType(_EMS_RxTelegram * EMS_RxTelegram);
|
||||||
void _debugPrintPackage(const char * prefix, _EMS_RxTelegram * EMS_RxTelegram, const char * color);
|
void _debugPrintPackage(const char * prefix, _EMS_RxTelegram * EMS_RxTelegram, const char * color);
|
||||||
void _ems_clearTxData();
|
void _ems_clearTxData();
|
||||||
int _ems_findBoilerModel(uint8_t model_id);
|
|
||||||
bool _ems_setModel(uint8_t model_id);
|
|
||||||
void _removeTxQueue();
|
void _removeTxQueue();
|
||||||
|
|
||||||
// global so can referenced in other classes
|
// global so can referenced in other classes
|
||||||
@@ -387,4 +395,5 @@ extern _EMS_Sys_Status EMS_Sys_Status;
|
|||||||
extern _EMS_Boiler EMS_Boiler;
|
extern _EMS_Boiler EMS_Boiler;
|
||||||
extern _EMS_Thermostat EMS_Thermostat;
|
extern _EMS_Thermostat EMS_Thermostat;
|
||||||
extern _EMS_SolarModule EMS_SolarModule;
|
extern _EMS_SolarModule EMS_SolarModule;
|
||||||
|
extern _EMS_HeatPump EMS_HeatPump;
|
||||||
extern _EMS_Other EMS_Other;
|
extern _EMS_Other EMS_Other;
|
||||||
|
|||||||
@@ -121,19 +121,19 @@
|
|||||||
|
|
||||||
// Known EMS types
|
// Known EMS types
|
||||||
typedef enum {
|
typedef enum {
|
||||||
EMS_MODEL_NONE,
|
EMS_MODEL_NONE, // unset
|
||||||
EMS_MODEL_ALL, // common for all devices
|
EMS_MODEL_ALL, // common for all devices
|
||||||
|
|
||||||
// generic ID for the boiler
|
// heatpump
|
||||||
|
EMS_MODEL_HP,
|
||||||
|
|
||||||
|
// solar module
|
||||||
|
EMS_MODEL_SM,
|
||||||
|
|
||||||
|
// boiler
|
||||||
EMS_MODEL_UBA,
|
EMS_MODEL_UBA,
|
||||||
|
|
||||||
// generic ID for the solar module
|
// and the thermostats
|
||||||
EMS_MODEL_SOLAR_MODULE,
|
|
||||||
|
|
||||||
// generic ID for all the other weird devices
|
|
||||||
EMS_MODEL_OTHER,
|
|
||||||
|
|
||||||
// and finally the thermostats
|
|
||||||
EMS_MODEL_ES73,
|
EMS_MODEL_ES73,
|
||||||
EMS_MODEL_RC10,
|
EMS_MODEL_RC10,
|
||||||
EMS_MODEL_RC20,
|
EMS_MODEL_RC20,
|
||||||
@@ -155,56 +155,65 @@ typedef enum {
|
|||||||
|
|
||||||
// EMS types for known boilers. This list will be extended when new devices are recognized.
|
// EMS types for known boilers. This list will be extended when new devices are recognized.
|
||||||
// The device_id is always 0x08
|
// The device_id is always 0x08
|
||||||
// format is MODEL_ID, PRODUCT ID, DESCRIPTION
|
// format is PRODUCT ID, DESCRIPTION
|
||||||
const _Boiler_Type Boiler_Types[] = {
|
const _Boiler_Type Boiler_Types[] = {
|
||||||
|
|
||||||
{EMS_MODEL_UBA, 72, "MC10 Module"},
|
{72, "MC10 Module"},
|
||||||
{EMS_MODEL_UBA, 123, "Buderus GB172/Nefit Trendline/Junkers Cerapur"},
|
{123, "Buderus GB172/Nefit Trendline/Junkers Cerapur"},
|
||||||
{EMS_MODEL_UBA, 115, "Nefit Topline Compact/Buderus GB162"},
|
{115, "Nefit Topline Compact/Buderus GB162"},
|
||||||
{EMS_MODEL_UBA, 203, "Buderus Logamax U122/Junkers Cerapur"},
|
{203, "Buderus Logamax U122/Junkers Cerapur"},
|
||||||
{EMS_MODEL_UBA, 208, "Buderus Logamax plus/GB192"},
|
{208, "Buderus Logamax plus/GB192"},
|
||||||
{EMS_MODEL_UBA, 64, "Sieger BK15/Nefit Smartline/Buderus GB152"},
|
{64, "Sieger BK15/Nefit Smartline/Buderus GB152"},
|
||||||
{EMS_MODEL_UBA, EMS_PRODUCTID_HEATRONICS, "Bosch Condens 2500/Junkers Heatronics3"},
|
{EMS_PRODUCTID_HEATRONICS, "Bosch Condens 2500/Junkers Heatronics3"},
|
||||||
{EMS_MODEL_UBA, 122, "Nefit Proline"},
|
{122, "Nefit Proline"},
|
||||||
{EMS_MODEL_UBA, 172, "Nefit Enviline"}
|
{172, "Nefit Enviline"}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Known Solar Module types
|
* Known Solar Module types
|
||||||
|
* format is PRODUCT ID, DEVICE ID, DESCRIPTION
|
||||||
*/
|
*/
|
||||||
const _SolarModule_Type SolarModule_Types[] = {
|
const _SolarModule_Type SolarModule_Types[] = {
|
||||||
|
|
||||||
{EMS_MODEL_OTHER, EMS_PRODUCTID_SM10, EMS_ID_SM, "SM10 Solar Module"},
|
{EMS_PRODUCTID_SM10, EMS_ID_SM, "SM10 Solar Module"},
|
||||||
{EMS_MODEL_OTHER, EMS_PRODUCTID_SM100, EMS_ID_SM, "SM100 Solar Module"},
|
{EMS_PRODUCTID_SM100, EMS_ID_SM, "SM100 Solar Module"},
|
||||||
{EMS_MODEL_OTHER, EMS_PRODUCTID_ISM1, EMS_ID_SM, "Junkers ISM1 Solar Module"}
|
{EMS_PRODUCTID_ISM1, EMS_ID_SM, "Junkers ISM1 Solar Module"}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Other EMS devices which are not considered boilers, thermostats or solar modules
|
// Other EMS devices which are not considered boilers, thermostats or solar modules
|
||||||
|
// format is PRODUCT ID, DEVICE ID, DESCRIPTION
|
||||||
const _Other_Type Other_Types[] = {
|
const _Other_Type Other_Types[] = {
|
||||||
|
|
||||||
{EMS_MODEL_OTHER, 69, 0x21, "MM10 Mixer Module"},
|
{69, 0x21, "MM10 Mixer Module"},
|
||||||
{EMS_MODEL_OTHER, 71, 0x11, "WM10 Switch Module"},
|
{71, 0x11, "WM10 Switch Module"},
|
||||||
{EMS_MODEL_OTHER, 160, 0x20, "MM100 Mixing Module"},
|
{160, 0x20, "MM100 Mixing Module"},
|
||||||
{EMS_MODEL_OTHER, 160, 0x21, "MM100 Mixing Module"},
|
{160, 0x21, "MM100 Mixing Module"},
|
||||||
{EMS_MODEL_OTHER, 159, 0x21, "MM50 Mixing Module"},
|
{159, 0x21, "MM50 Mixing Module"},
|
||||||
{EMS_MODEL_OTHER, 68, 0x09, "BC10/RFM20 Receiver"},
|
{68, 0x09, "BC10/RFM20 Receiver"},
|
||||||
{EMS_MODEL_OTHER, 190, 0x09, "BC10 Base Controller"},
|
{190, 0x09, "BC10 Base Controller"},
|
||||||
{EMS_MODEL_OTHER, 114, 0x09, "BC10 Base Controller"},
|
{114, 0x09, "BC10 Base Controller"},
|
||||||
{EMS_MODEL_OTHER, 125, 0x09, "BC25 Base Controller"},
|
{125, 0x09, "BC25 Base Controller"},
|
||||||
{EMS_MODEL_OTHER, 152, 0x09, "Junkers Controller"},
|
{152, 0x09, "Junkers Controller"},
|
||||||
{EMS_MODEL_OTHER, 205, 0x02, "Nefit Moduline Easy Connect"},
|
{205, 0x02, "Nefit Moduline Easy Connect"},
|
||||||
{EMS_MODEL_EASY, 206, 0x02, "Bosch Easy Connect"},
|
{206, 0x02, "Bosch Easy Connect"},
|
||||||
{EMS_MODEL_OTHER, 171, 0x02, "EMS-OT OpenTherm converter"},
|
{171, 0x02, "EMS-OT OpenTherm converter"},
|
||||||
{EMS_MODEL_OTHER, 252, EMS_ID_HP, "HeatPump Module"},
|
{252, EMS_ID_HP, "HeatPump Module"},
|
||||||
{EMS_MODEL_OTHER, 189, EMS_ID_GATEWAY, "Web Gateway KM200"}
|
{189, EMS_ID_GATEWAY, "Web Gateway KM200"}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// heatpump
|
||||||
|
// format is PRODUCT ID, DEVICE ID, DESCRIPTION
|
||||||
|
const _HeatPump_Type HeatPump_Types[] = {
|
||||||
|
{252, EMS_ID_HP, "HeatPump Module"}
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Known thermostat types and their capabilities
|
* Known thermostat types and their capabilities
|
||||||
|
* format is MODEL_ID, PRODUCT ID, DEVICE ID, DESCRIPTION
|
||||||
*/
|
*/
|
||||||
const _Thermostat_Type Thermostat_Types[] = {
|
const _Thermostat_Type Thermostat_Types[] = {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user