SM100 changes

This commit is contained in:
proddy
2019-05-03 18:42:53 +02:00
parent 17307300fb
commit 7dcf19c59f
5 changed files with 15 additions and 13 deletions

View File

@@ -729,18 +729,18 @@ void publishValues(bool force) {
doc.clear(); doc.clear();
JsonObject rootSM = doc.to<JsonObject>(); JsonObject rootSM = doc.to<JsonObject>();
rootSM[SM_COLLECTORTEMP] = _short_to_char(s, EMS_Other.SMcollectorTemp);
rootSM[SM_BOTTOMTEMP] = _short_to_char(s, EMS_Other.SMbottomTemp);
if (abs(EMS_Other.SMcollectorTemp) < EMS_VALUE_SHORT_NOTSET) if (abs(EMS_Other.SMcollectorTemp) < EMS_VALUE_SHORT_NOTSET)
rootSM[SM_COLLECTORTEMP] = (double)EMS_Other.SMcollectorTemp / 10; rootSM[SM_COLLECTORTEMP] = (double)EMS_Other.SMcollectorTemp / 10;
if (abs(EMS_Other.SMbottomTemp) < EMS_VALUE_SHORT_NOTSET) if (abs(EMS_Other.SMbottomTemp) < EMS_VALUE_SHORT_NOTSET)
rootSM[SM_BOTTOMTEMP] = (double)EMS_Other.SMbottomTemp / 10; rootSM[SM_BOTTOMTEMP] = (double)EMS_Other.SMbottomTemp / 10;
if (EMS_Other.SMpumpModulation != EMS_VALUE_INT_NOTSET) if (EMS_Other.SMpumpModulation != EMS_VALUE_INT_NOTSET)
rootSM[SM_PUMPMODULATION] = EMS_Other.SMpumpModulation; rootSM[SM_PUMPMODULATION] = EMS_Other.SMpumpModulation;
rootSM[SM_PUMP] = _bool_to_char(s, EMS_Other.SMpump); if (EMS_Other.SMpump != EMS_VALUE_INT_NOTSET) {
rootSM[SM_PUMP] = _bool_to_char(s, EMS_Other.SMpump);
}
if (abs(EMS_Other.SMEnergyLastHour) < EMS_VALUE_SHORT_NOTSET) if (abs(EMS_Other.SMEnergyLastHour) < EMS_VALUE_SHORT_NOTSET)
rootSM[SM_ENERGYLASTHOUR] = (double)EMS_Other.SMEnergyLastHour / 10; rootSM[SM_ENERGYLASTHOUR] = (double)EMS_Other.SMEnergyLastHour / 10;

View File

@@ -709,7 +709,7 @@ void _ems_readTelegram(uint8_t * telegram, uint8_t length) {
return; return;
} }
// fill in the rest of the Telegram // fill in the rest of the telegram
EMS_RxTelegram.src = telegram[0] & 0x7F; // removing 8th bit as we deal with both reads and writes here EMS_RxTelegram.src = telegram[0] & 0x7F; // removing 8th bit as we deal with both reads and writes here
EMS_RxTelegram.dest = telegram[1] & 0x7F; // remove 8th bit (don't care if read or write) EMS_RxTelegram.dest = telegram[1] & 0x7F; // remove 8th bit (don't care if read or write)
EMS_RxTelegram.offset = telegram[3]; // offset is always 4th byte EMS_RxTelegram.offset = telegram[3]; // offset is always 4th byte
@@ -1323,12 +1323,12 @@ void _process_SM10Monitor(_EMS_RxTelegram * EMS_RxTelegram) {
* SM100Monitor - type 0x0262 EMS+ * SM100Monitor - type 0x0262 EMS+
*/ */
void _process_SM100Monitor(_EMS_RxTelegram * EMS_RxTelegram) { void _process_SM100Monitor(_EMS_RxTelegram * EMS_RxTelegram) {
if (EMS_RxTelegram->data_length <= 2) {
EMS_Other.SMcollectorTemp = _toShort(0); // collector temp from SM100, is *10
}
if (EMS_RxTelegram->data_length > 2) { if (EMS_RxTelegram->data_length > 2) {
EMS_Other.SMbottomTemp = _toShort(2); // bottom temp from SM100, is *10 EMS_Other.SMcollectorTemp = _toShort(0); // collector temp from SM100, is *10
EMS_Other.SMbottomTemp = _toShort(2); // bottom temp from SM100, is *10
} else {
// only one value sent, assume its the collector temp
EMS_Other.SMcollectorTemp = _toShort(0); // collector temp from SM100, is *10
} }
EMS_Other.SM = true; EMS_Other.SM = true;

View File

@@ -50,7 +50,7 @@
// MQTT for SM10/SM100 Solar Module // MQTT for SM10/SM100 Solar Module
#define TOPIC_SM_DATA "sm_data" // topic name #define TOPIC_SM_DATA "sm_data" // topic name
#define SM_COLLECTORTEMP "temp" // collector temp #define SM_COLLECTORTEMP "collectortemp" // collector temp
#define SM_BOTTOMTEMP "bottomtemp" // bottom temp #define SM_BOTTOMTEMP "bottomtemp" // bottom temp
#define SM_PUMPMODULATION "pumpmodulation" // pump modulation #define SM_PUMPMODULATION "pumpmodulation" // pump modulation
#define SM_PUMP "pump" // pump active #define SM_PUMP "pump" // pump active

View File

@@ -40,7 +40,9 @@ static const char * TEST_DATA[] = {
"10 48 F9 00 FF 01 6C 08 4F 00 00 00 02 00 00 00 02 00 03 00 03 00 03 00 02", // test 35 - F9 "10 48 F9 00 FF 01 6C 08 4F 00 00 00 02 00 00 00 02 00 03 00 03 00 03 00 02", // test 35 - F9
"48 90 F9 00 11 FF 01 6D 08", // test 36 - F9 "48 90 F9 00 11 FF 01 6D 08", // test 36 - F9
"10 48 F9 00 FF 01 6D 08", // test 37 - F9 "10 48 F9 00 FF 01 6D 08", // test 37 - F9
"10 00 F7 00 FF 01 B9 35 19" // test 38 - F7 "10 00 F7 00 FF 01 B9 35 19", // test 38 - F7
"30 00 FF 00 02 62 00 E7 01 AE 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00", // test 39 - SM100
"30 00 FF 00 02 62 00 E4" // test 40 - SM100
}; };

View File

@@ -6,5 +6,5 @@
#pragma once #pragma once
#define APP_NAME "EMS-ESP" #define APP_NAME "EMS-ESP"
#define APP_VERSION "1.7.0b12" #define APP_VERSION "1.7.0b13"
#define APP_HOSTNAME "ems-esp" #define APP_HOSTNAME "ems-esp"