SM100 EMS+ updates

This commit is contained in:
Paul Derbyshire
2019-04-25 15:56:06 +01:00
parent 9c78a10da2
commit 44933e52ac
3 changed files with 39 additions and 35 deletions

View File

@@ -160,7 +160,7 @@ char * _float_to_char(char * a, float f, uint8_t precision = 2) {
return ret;
}
// convert bool to text
// convert bool to text. bools are stored as bytes
char * _bool_to_char(char * s, uint8_t value) {
if (value == EMS_VALUE_INT_ON) {
strlcpy(s, "on", sizeof(s));
@@ -340,10 +340,7 @@ void showInfo() {
if (ems_getBusConnected()) {
myDebug(" Bus is connected");
myDebug(" Rx: Poll=%d ms, # Rx telegrams read=%d, # CRC errors=%d",
ems_getPollFrequency(),
EMS_Sys_Status.emsRxPgks,
EMS_Sys_Status.emxCrcErr);
myDebug(" Rx: Poll=%d ms, # Rx telegrams read=%d, # CRC errors=%d", ems_getPollFrequency(), EMS_Sys_Status.emsRxPgks, EMS_Sys_Status.emxCrcErr);
if (ems_getTxCapable()) {
myDebug(" Tx: available, Tx delay is %s, # Tx telegrams sent=%d", (ems_getTxDelay() ? "on" : "off"), EMS_Sys_Status.emsTxPkgs);
@@ -390,10 +387,7 @@ void showInfo() {
_renderIntValue("Warm Water current tap water flow", "l/min", EMS_Boiler.wWCurFlow, 10);
_renderLongValue("Warm Water # starts", "times", EMS_Boiler.wWStarts);
if (EMS_Boiler.wWWorkM != EMS_VALUE_LONG_NOTSET) {
myDebug(" Warm Water active time: %d days %d hours %d minutes",
EMS_Boiler.wWWorkM / 1440,
(EMS_Boiler.wWWorkM % 1440) / 60,
EMS_Boiler.wWWorkM % 60);
myDebug(" Warm Water active time: %d days %d hours %d minutes", EMS_Boiler.wWWorkM / 1440, (EMS_Boiler.wWWorkM % 1440) / 60, EMS_Boiler.wWWorkM % 60);
}
_renderBoolValue("Warm Water 3-way valve", EMS_Boiler.wWHeat);
@@ -441,10 +435,7 @@ void showInfo() {
EMS_Boiler.heatWorkMin % 60);
}
if (EMS_Boiler.UBAuptime != EMS_VALUE_LONG_NOTSET) {
myDebug(" Total UBA working time: %d days %d hours %d minutes",
EMS_Boiler.UBAuptime / 1440,
(EMS_Boiler.UBAuptime % 1440) / 60,
EMS_Boiler.UBAuptime % 60);
myDebug(" Total UBA working time: %d days %d hours %d minutes", EMS_Boiler.UBAuptime / 1440, (EMS_Boiler.UBAuptime % 1440) / 60, EMS_Boiler.UBAuptime % 60);
}
// For SM10 Solar Module
@@ -529,6 +520,11 @@ void showInfo() {
// send all dallas sensor values as a JSON package to MQTT
void publishSensorValues() {
// don't send if MQTT is connected
if (!myESP.isMQTTConnected()) {
return;
}
StaticJsonDocument<200> doc;
JsonObject sensors = doc.to<JsonObject>();
@@ -558,6 +554,11 @@ void publishSensorValues() {
// CRC check is done to see if there are changes in the values since the last send to avoid too much wifi traffic
// a check is done against the previous values and if there are changes only then they are published. Unless force=true
void publishValues(bool force) {
// don't send if MQTT is connected
if (!myESP.isMQTTConnected()) {
return;
}
char s[20] = {0}; // for formatting strings
StaticJsonDocument<MQTT_MAX_SIZE> doc;
char data[MQTT_MAX_SIZE] = {0};
@@ -1001,7 +1002,6 @@ bool FSCallback(MYESP_FSACTION action, const JsonObject json) {
if (action == MYESP_FSACTION_SAVE) {
json["thermostat_type"] = EMS_Thermostat.device_id;
json["boiler_type"] = EMS_Boiler.device_id;
json["led"] = EMSESP_Status.led;
json["led_gpio"] = EMSESP_Status.led_gpio;
json["dallas_gpio"] = EMSESP_Status.dallas_gpio;
@@ -1628,17 +1628,8 @@ void setup() {
#endif
// MQTT host, username and password taken from the SPIFFS settings
myESP.setMQTT(NULL,
NULL,
NULL,
MQTT_BASE,
MQTT_KEEPALIVE,
MQTT_QOS,
MQTT_RETAIN,
MQTT_WILL_TOPIC,
MQTT_WILL_ONLINE_PAYLOAD,
MQTT_WILL_OFFLINE_PAYLOAD,
MQTTCallback);
myESP.setMQTT(
NULL, NULL, NULL, MQTT_BASE, MQTT_KEEPALIVE, MQTT_QOS, MQTT_RETAIN, MQTT_WILL_TOPIC, MQTT_WILL_ONLINE_PAYLOAD, MQTT_WILL_OFFLINE_PAYLOAD, MQTTCallback);
// OTA callback which is called when OTA is starting and stopping
myESP.setOTA(OTACallback_pre, OTACallback_post);

View File

@@ -47,6 +47,7 @@ void _process_UBAParametersMessage(_EMS_RxTelegram * EMS_RxTelegram);
void _process_SetPoints(_EMS_RxTelegram * EMS_RxTelegram);
void _process_SM10Monitor(_EMS_RxTelegram * EMS_RxTelegram);
void _process_SM100Monitor(_EMS_RxTelegram * EMS_RxTelegram);
void _process_SM100Status(_EMS_RxTelegram * EMS_RxTelegram);
// Common for most thermostats
void _process_RCTime(_EMS_RxTelegram * EMS_RxTelegram);
@@ -97,6 +98,7 @@ const _EMS_Type EMS_Types[] = {
// Other devices
{EMS_MODEL_OTHER, EMS_TYPE_SM10Monitor, "SM10Monitor", _process_SM10Monitor},
{EMS_MODEL_OTHER, EMS_TYPE_SM100Monitor, "SM100Monitor", _process_SM100Monitor},
{EMS_MODEL_OTHER, EMS_TYPE_SM100Status, "SM100Status", _process_SM100Status},
// RC10
{EMS_MODEL_RC10, EMS_TYPE_RCTime, "RCTime", _process_RCTime},
@@ -1257,11 +1259,12 @@ void _process_RCOutdoorTempMessage(_EMS_RxTelegram * EMS_RxTelegram) {
* SM10Monitor - type 0x97
*/
void _process_SM10Monitor(_EMS_RxTelegram * EMS_RxTelegram) {
EMS_Other.SMcollectorTemp = _toShort(2); // collector temp from SM10/SM100, is *10
EMS_Other.SMbottomTemp = _toShort(5); // bottom temp from SM10/SM100, is *10
EMS_Other.SMcollectorTemp = _toShort(2); // collector temp from SM10, is *10
EMS_Other.SMbottomTemp = _toShort(5); // bottom temp from SM10, is *10
EMS_Other.SMpumpModulation = _toByte(4); // modulation solar pump
EMS_Other.SMpump = _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
}
@@ -1269,13 +1272,20 @@ void _process_SM10Monitor(_EMS_RxTelegram * EMS_RxTelegram) {
* SM100Monitor - type 0x0262 EMS+
*/
void _process_SM100Monitor(_EMS_RxTelegram * EMS_RxTelegram) {
// to be completed
// need help to decyper telegram, e.g. 30 00 FF 00 02 62 00 A1 01 3F 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00
//EMS_Other.SMcollectorTemp = _toShort(2); // collector temp from SM10/SM100, is *10
//EMS_Other.SMbottomTemp = _toShort(5); // bottom temp from SM10/SM100, is *10
//EMS_Other.SMpumpModulation = _toByte(4); // modulation solar pump
//EMS_Other.SMpump = _bitRead(7, 1); // active if bit 1 is set
EMS_Other.SMcollectorTemp = _toShort(0); // collector temp from SM100, is *10
EMS_Other.SMbottomTemp = _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
}
/*
* SM100Status - type 0x0264 EMS+
*/
void _process_SM100Status(_EMS_RxTelegram * EMS_RxTelegram) {
EMS_Other.SMpumpModulation = _toByte(9); // modulation solar pump
EMS_Other.SM = true;
EMS_Sys_Status.emsRefreshed = true; // triggers a send the values back via MQTT
}
@@ -2202,7 +2212,7 @@ void ems_testTelegram(uint8_t test_num) {
if (test_num == 0)
return;
static const char tests[7][200] = {
static const char tests[9][200] = {
"08 00 34 00 3E 02 1D 80 00 31 00 00 01 00 01 0B AE 02", // test 1
"10 00 FF 00 01 A5 80 00 01 30 28 00 30 28 01 54 03 03 01 01 54 02 A8 00 00 11 01 03 FF FF 00", // test 2 - RC310 ems+
@@ -2210,7 +2220,9 @@ void ems_testTelegram(uint8_t test_num) {
"30 00 FF 00 02 62 00 A1 01 3F 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00", // test 4 - SM100
"10 00 FF 00 01 A5 00 D7 21 00 00 00 00 30 01 84 01 01 03 01 84 01 F1 00 00 11 01 00 08 63 00", // test 5 - RC1010
"18 00 FF 00 01 A5 00 DD 21 23 00 00 23 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00", // test 6 - RC300
"90 00 FF 00 00 6F 01 01 00 46 00 B9" // test 7 - FR10
"90 00 FF 00 00 6F 01 01 00 46 00 B9", // test 7 - FR10
"30 00 FF 00 02 62 01 FB 01 9E 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 2B", // test 8 - SM100
"30 00 FF 00 02 64 00 00 00 04 00 00 FF 00 00 1E 0C 20 64 00 00 00 00 E9" // test 9 - SM100
};

View File

@@ -43,6 +43,7 @@
// Other
#define EMS_TYPE_SM10Monitor 0x97 // SM10Monitor
#define EMS_TYPE_SM100Monitor 0x0262 // SM100Monitor
#define EMS_TYPE_SM100Status 0x0264 // SM100Status
/*
* Thermostats...