diff --git a/src/custom.htm b/src/custom.htm index 2cdefa42f..02e86967b 100644 --- a/src/custom.htm +++ b/src/custom.htm @@ -188,7 +188,7 @@ -
+
Boiler
@@ -212,7 +212,7 @@
-
+
Thermostat
@@ -228,9 +228,47 @@
+
+
Solar Module
+ + + + + + + + + + + + + + + + + + + + + +
Colector Temperature:Bottom Temperature:
Pump Modulation:Pump Active:
Energy Last Hour:Energy Today:Energy Total:
+
+ +
+
Heat Pump
+ + + + + + + +
Pump Modulation:Pump Speed:
+
+
- +
\ No newline at end of file diff --git a/src/custom.js b/src/custom.js index f458ad465..1c644436a 100644 --- a/src/custom.js +++ b/src/custom.js @@ -99,14 +99,18 @@ function listCustomStats() { var l = document.createElement("li"); var type = obj[i].type; if (type == 1) { - var color = "info"; + var color = "list-group-item-success"; } else if (type == 2) { - var color = "warning"; + var color = "list-group-item-info"; + } else if (type == 3) { + var color = "list-group-item-warning"; + } else if (type == 4) { + var color = "list-group-item-success"; } else { var color = ""; } l.innerHTML = obj[i].model + " (Version:" + obj[i].version + " ProductID:" + obj[i].productid + " DeviceID:0x" + obj[i].deviceid + ")"; - l.className = "list-group-item list-group-item-" + color; + l.className = "list-group-item " + color; list.appendChild(l); } @@ -133,9 +137,32 @@ function listCustomStats() { document.getElementById("tmode").innerHTML = ajaxobj.thermostat.tmode; } else { document.getElementById("thermostat_show").style.display = "none"; - } + if (ajaxobj.sm.ok) { + document.getElementById("sm_show").style.display = "block"; + + document.getElementById("sm").innerHTML = ajaxobj.sm.sm; + document.getElementById("sm1").innerHTML = ajaxobj.sm.sm1 + " ℃"; + document.getElementById("sm2").innerHTML = ajaxobj.sm.sm2 + " ℃"; + document.getElementById("sm3").innerHTML = ajaxobj.sm.sm3 + " %"; + document.getElementById("sm4").innerHTML = ajaxobj.sm.sm4; + document.getElementById("sm5").innerHTML = ajaxobj.sm.sm4 + " Wh"; + document.getElementById("sm6").innerHTML = ajaxobj.sm.sm4 + " Wh"; + document.getElementById("sm7").innerHTML = ajaxobj.sm.sm4 + " KWh"; + } else { + document.getElementById("sm_show").style.display = "none"; + } + + if (ajaxobj.hp.ok) { + document.getElementById("hp_show").style.display = "block"; + + document.getElementById("hm").innerHTML = ajaxobj.hp.hm; + document.getElementById("hp1").innerHTML = ajaxobj.hp.hp1 + " %"; + document.getElementById("hp2").innerHTML = ajaxobj.hp.hp2 + " %"; + } else { + document.getElementById("hp_show").style.display = "none"; + } } diff --git a/src/ems-esp.cpp b/src/ems-esp.cpp index 3b4079bb8..5c46350c7 100644 --- a/src/ems-esp.cpp +++ b/src/ems-esp.cpp @@ -74,6 +74,21 @@ Ticker showerColdShotStopTimer; #define SHOWER_COLDSHOT_DURATION 10 // in seconds. 10 seconds for cold water before turning back hot water #define SHOWER_MAX_DURATION 420000 // in ms. 7 minutes, before trigger a shot of cold water +#ifdef LOGICANALYZER +#define EMSESP_DALLAS_GPIO D1 +#define EMSESP_DALLAS_PARASITE false +#else +// set this if using an external temperature sensor like a DS18B20 +// D5 is the default on a bbqkees board +#define EMSESP_DALLAS_GPIO D5 +#define EMSESP_DALLAS_PARASITE false +#endif + +// Set LED pin used for showing the EMS bus connection status. Solid means EMS bus working, flashing is an error +// can be either the onboard LED on the ESP8266 (LED_BULLETIN) or external via an external pull-up LED (e.g. D1 on a bbqkees' board) +// can be enabled and disabled via the 'set led' command and pin set by 'set led_gpio' +#define EMSESP_LED_GPIO LED_BUILTIN + typedef struct { uint32_t timestamp; // for internal timings, via millis() uint8_t dallas_sensors; // count of dallas sensors @@ -569,7 +584,7 @@ void showInfo() { } _renderUShortValue("Energy last hour", "Wh", EMS_SolarModule.EnergyLastHour, 1); // *10 _renderUShortValue("Energy today", "Wh", EMS_SolarModule.EnergyToday, 0); - _renderUShortValue("Energy total", "kWH", EMS_SolarModule.EnergyTotal, 1); // *10 + _renderUShortValue("Energy total", "kWh", EMS_SolarModule.EnergyTotal, 1); // *10 } // For HeatPumps @@ -1817,6 +1832,57 @@ void WebCallback(JsonObject root) { boiler["ok"] = false; } + // For SM10/SM100 Solar Module + JsonObject sm = root.createNestedObject("sm"); + if (ems_getSolarModuleEnabled()) { + sm["ok"] = true; + + char buffer[200]; + sm["sm"] = ems_getSolarModuleDescription(buffer, true); + + if (EMS_SolarModule.collectorTemp != EMS_VALUE_SHORT_NOTSET) + sm["sm1"] = (double)EMS_SolarModule.collectorTemp / 10; // Collector temperature oC + + if (EMS_SolarModule.bottomTemp != EMS_VALUE_SHORT_NOTSET) + sm["sm2"] = (double)EMS_SolarModule.bottomTemp / 10; // Bottom temperature oC + + if (EMS_SolarModule.pumpModulation != EMS_VALUE_INT_NOTSET) + sm["sm3"] = EMS_SolarModule.pumpModulation; // Pump modulation % + + if (EMS_SolarModule.pump != EMS_VALUE_INT_NOTSET) { + char s[10]; + sm["sm4"] = _bool_to_char(s, EMS_SolarModule.pump); // Pump active on/off + } + + if (EMS_SolarModule.EnergyLastHour != EMS_VALUE_USHORT_NOTSET) + sm["sm5"] = (double)EMS_SolarModule.EnergyLastHour / 10; // Energy last hour Wh + + if (EMS_SolarModule.EnergyToday != EMS_VALUE_USHORT_NOTSET) // Energy today Wh + sm["sm6"] = EMS_SolarModule.EnergyToday; + + if (EMS_SolarModule.EnergyTotal != EMS_VALUE_USHORT_NOTSET) // Energy total KWh + sm["sm7"] = (double)EMS_SolarModule.EnergyTotal / 10; + } else { + sm["ok"] = false; + } + + // For HeatPumps + JsonObject hp = root.createNestedObject("hp"); + if (ems_getHeatPumpEnabled()) { + hp["ok"] = true; + char buffer[200]; + hp["hm"] = ems_getHeatPumpDescription(buffer, true); + + if (EMS_HeatPump.HPModulation != EMS_VALUE_INT_NOTSET) + hp["hp1"] = EMS_HeatPump.HPModulation; // Pump modulation % + + if (EMS_HeatPump.HPSpeed != EMS_VALUE_INT_NOTSET) + hp["hp2"] = EMS_HeatPump.HPSpeed; // Pump speed % + } else { + hp["ok"] = false; + } + + // serializeJsonPretty(root, Serial); // turn on for debugging } diff --git a/src/ems.cpp b/src/ems.cpp index 39932a117..2493fb495 100644 --- a/src/ems.cpp +++ b/src/ems.cpp @@ -1775,7 +1775,7 @@ void _process_Version(_EMS_RxTelegram * EMS_RxTelegram) { myDebug_P(PSTR("Boiler found: %s (DeviceID:0x%02X ProductID:%d Version:%s)"), Boiler_Devices[i].model_string, EMS_ID_BOILER, product_id, version); // add to list - _addDevice(1, product_id, EMS_ID_BOILER, version, Boiler_Devices[i].model_string); // type 1 = boiler + _addDevice(EMS_MODELTYPE_BOILER, product_id, EMS_ID_BOILER, version, Boiler_Devices[i].model_string); // type 1 = boiler // if its a boiler set it, unless it already has been set by checking for a productID // it will take the first one found in the list @@ -1822,7 +1822,7 @@ void _process_Version(_EMS_RxTelegram * EMS_RxTelegram) { } // add to list - _addDevice(2, product_id, Thermostat_Devices[i].device_id, version, Thermostat_Devices[i].model_string); // type 2 = thermostat + _addDevice(EMS_MODELTYPE_THERMOSTAT, product_id, Thermostat_Devices[i].device_id, version, Thermostat_Devices[i].model_string); // type 2 = thermostat // if we don't have a thermostat set, use this one if (((EMS_Thermostat.device_id == EMS_ID_NONE) || (EMS_Thermostat.model_id == EMS_MODEL_NONE) @@ -1865,7 +1865,7 @@ void _process_Version(_EMS_RxTelegram * EMS_RxTelegram) { version); // add to list - _addDevice(3, product_id, SolarModule_Devices[i].device_id, version, SolarModule_Devices[i].model_string); // type 3 = other + _addDevice(EMS_MODELTYPE_SM, product_id, SolarModule_Devices[i].device_id, version, SolarModule_Devices[i].model_string); // type 3 = other myDebug_P(PSTR("Solar Module support enabled.")); EMS_SolarModule.device_id = SolarModule_Devices[i].device_id; @@ -1895,7 +1895,7 @@ void _process_Version(_EMS_RxTelegram * EMS_RxTelegram) { version); // add to list - _addDevice(3, product_id, HeatPump_Devices[i].device_id, version, HeatPump_Devices[i].model_string); // type 3 = other + _addDevice(EMS_MODELTYPE_HP, product_id, HeatPump_Devices[i].device_id, version, HeatPump_Devices[i].model_string); // type 3 = other myDebug_P(PSTR("Heat Pump support enabled.")); EMS_HeatPump.device_id = SolarModule_Devices[i].device_id; @@ -1918,12 +1918,12 @@ void _process_Version(_EMS_RxTelegram * EMS_RxTelegram) { myDebug_P(PSTR("Device found: %s (DeviceID:0x%02X ProductID:%d Version:%s)"), Other_Devices[i].model_string, Other_Devices[i].device_id, product_id, version); // add to list - _addDevice(4, product_id, Other_Devices[i].device_id, version, Other_Devices[i].model_string); // type 3 = other + _addDevice(EMS_MODELTYPE_OTHER, product_id, Other_Devices[i].device_id, version, Other_Devices[i].model_string); // type 3 = other return; } else { myDebug_P(PSTR("Unrecognized device found: %s (DeviceID:0x%02X ProductID:%d Version:%s)"), EMS_RxTelegram->src, product_id, version); // add to list - _addDevice(5, product_id, EMS_RxTelegram->src, version, "unknown?"); // type 4 = unknown + _addDevice(EMS_MODELTYPE_OTHER, product_id, EMS_RxTelegram->src, version, "unknown?"); // type 4 = unknown } } @@ -2182,7 +2182,7 @@ char * ems_getBoilerDescription(char * buffer, bool name_only) { /** * returns current Solar Module type as a string */ -char * ems_getSolarModuleDescription(char * buffer) { +char * ems_getSolarModuleDescription(char * buffer, bool name_only) { uint8_t size = 128; if (!ems_getSolarModuleEnabled()) { strlcpy(buffer, "", size); @@ -2201,6 +2201,9 @@ char * ems_getSolarModuleDescription(char * buffer) { } if (found) { strlcpy(buffer, SolarModule_Devices[i].model_string, size); + if (name_only) { + return buffer; // only interested in the model name + } } else { strlcpy(buffer, "DeviceID: 0x", size); strlcat(buffer, _hextoa(EMS_SolarModule.device_id, tmp), size); @@ -2223,7 +2226,7 @@ char * ems_getSolarModuleDescription(char * buffer) { /** * returns current Heat Pump type as a string */ -char * ems_getHeatPumpDescription(char * buffer) { +char * ems_getHeatPumpDescription(char * buffer, bool name_only) { uint8_t size = 128; if (!ems_getHeatPumpEnabled()) { strlcpy(buffer, "", size); @@ -2242,6 +2245,9 @@ char * ems_getHeatPumpDescription(char * buffer) { } if (found) { strlcpy(buffer, HeatPump_Devices[i].model_string, size); + if (name_only) { + return buffer; // only interested in the model name + } } else { strlcpy(buffer, "DeviceID: 0x", size); strlcat(buffer, _hextoa(EMS_HeatPump.device_id, tmp), size); diff --git a/src/ems.h b/src/ems.h index 42afcb503..d1e5a12a0 100644 --- a/src/ems.h +++ b/src/ems.h @@ -115,6 +115,13 @@ //#define EMS_SYS_LOGGING_DEFAULT EMS_SYS_LOGGING_VERBOSE #define EMS_SYS_LOGGING_DEFAULT EMS_SYS_LOGGING_NONE +// define the model types which get rendered to html colors in the web interface +#define EMS_MODELTYPE_BOILER 1 // success color +#define EMS_MODELTYPE_THERMOSTAT 2 // info color +#define EMS_MODELTYPE_SM 3 // warning color +#define EMS_MODELTYPE_HP 4 // success color +#define EMS_MODELTYPE_OTHER 5 // no color + /* EMS UART transfer status */ typedef enum { EMS_RX_STATUS_IDLE, @@ -430,8 +437,8 @@ void ems_setTxMode(uint8_t mode); char * ems_getThermostatDescription(char * buffer, bool name_only = false); char * ems_getBoilerDescription(char * buffer, bool name_only = false); -char * ems_getSolarModuleDescription(char * buffer); -char * ems_getHeatPumpDescription(char * buffer); +char * ems_getSolarModuleDescription(char * buffer, bool name_only = false); +char * ems_getHeatPumpDescription(char * buffer, bool name_only = false); void ems_getThermostatValues(); void ems_getBoilerValues(); void ems_getSolarModuleValues(); diff --git a/src/websrc/myesp.htm b/src/websrc/myesp.htm index bc9a40ce1..e14539a64 100644 --- a/src/websrc/myesp.htm +++ b/src/websrc/myesp.htm @@ -444,7 +444,7 @@
- +

\ No newline at end of file diff --git a/tools/wsemulator/wserver.js b/tools/wsemulator/wserver.js index 40b860e56..d0374bb61 100644 --- a/tools/wsemulator/wserver.js +++ b/tools/wsemulator/wserver.js @@ -102,7 +102,7 @@ var custom_configfile = { "dallas_gpio": 14, "dallas_parasite": false, "listen_mode": false, - "shower_timer": false, + "shower_timer": true, "shower_alert": false, "publish_time": 120, "heating_circuit": 1, @@ -130,7 +130,7 @@ function sendStatus() { "sketchsize": 673, "availsize": 2469, "ip": "10.10.10.198", - "ssid": "derbyshire", + "ssid": "my_ssid", "mac": "DC:4F:11:22:93:06", "signalstr": 62, "systemload": 0, @@ -155,40 +155,59 @@ function sendStatus() { function sendCustomStatus() { var stats = { "command": "custom_status", - "version": "1.9.0b", - "customname": "ems-esp", + "version": "1.9.0b7", + "customname": "EMS-ESP", "appurl": "https://github.com/proddy/EMS-ESP", "updateurl": "https://api.github.com/repos/proddy/EMS-ESP/releases/latest", "emsbus": { "ok": true, - "msg": "everything is OK", + "msg": "EMS Bus Connected with both Rx and Tx active.", "devices": [ - { "type": 1, "model": "model 1", "deviceid": "device id1", "version": "version id1", "productid": "product id1" }, - { "type": 2, "model": "model 2", "deviceid": "device id2", "version": "version id2", "productid": "product id2" }, - { "type": 3, "model": "model 3", "deviceid": "device id3", "version": "version id3", "productid": "product id3" }, - { "type": 4, "model": "model 4", "deviceid": "device id3", "version": "version id3", "productid": "product id3" }, - { "type": 5, "model": "model 5", "deviceid": "device id3", "version": "version id3", "productid": "product id3" } + { "type": 1, "model": "Buderus GB172/Nefit Trendline/Junkers Cerapur", "version": "06.01", "productid": 123, "deviceid": "8" }, + { "type": 5, "model": "BC10 Base Controller", "version": "01.03", "productid": 190, "deviceid": "9" }, + { "type": 2, "model": "RC20/Nefit Moduline 300", "version": "03.03", "productid": 77, "deviceid": "17" }, + { "type": 3, "model": "SM100 Solar Module", "version": "01.01", "productid": 163, "deviceid": "30" }, + { "type": 4, "model": "HeatPump Module", "version": "01.01", "productid": 252, "deviceid": "38" } ] }, "thermostat": { "ok": true, - "tm": "model abc", - "ts": "23", - "tc": "27.5", - "tmode": "manual" + "tm": "RC20/Nefit Moduline 300", + "ts": 15, + "tc": 24.5, + "tmode": "auto" }, "boiler": { "ok": true, - "bm": "mode boiler", - "b1": "on", + "bm": "Buderus GB172/Nefit Trendline/Junkers Cerapur", + "b1": "off", "b2": "off", - "b3": 15.8, - "b4": 61.5, - "b5": 35.8, - "b6": 47.1 + "b3": 0, + "b4": 53, + "b5": 54.4, + "b6": 53.3 + }, + + "sm": { + "ok": true, + "sm": "SM100 Solar Module", + "sm1": 34, + "sm2": 24, + "sm3": 60, + "sm4": "on", + "sm5": 2000, + "sm6": 3000, + "sm7": 123456 + }, + + "hp": { + "ok": true, + "hm": "HeatPump Module", + "hp1": 66, + "hp2": 77 } };