added log w and more ems+ messages

This commit is contained in:
proddy
2019-11-14 23:13:47 +01:00
parent b56e12f33e
commit 4a56f0dc9f
6 changed files with 96 additions and 26 deletions

View File

@@ -19,6 +19,8 @@ There are breaking changes in this release. See `publish_time` below and make su
- Implemented timezone support and automatic adjustment, also taking daylight saving times into account
- Added `kick` command to reset core services like NTP, Web, Web Sockets
- Added WiFi static IP (setting done in WebUI only)
- `log w <type_id>` for watching a specific telegram type ID
- initial support for EMS+ GB125s and MC110's (https://github.com/proddy/EMS-ESP/wiki/MC110-controller)
### Fixed
@@ -34,6 +36,7 @@ There are breaking changes in this release. See `publish_time` below and make su
- Removed `publish_always` and use `publish_time`. For automatic mode you will need to change `publish_time` to 0 which will send MQTT every time data has changed (every 10 seconds).
- Changed NTP interval from 1 hour to 12 hours
- Refactored EMS device library to make it support multi-EMS devices easier (e.g. multiple thermostats)
- `autodetect deep` removed and replaced with `autodetect scan` for scanning known devices.
### Removed

View File

@@ -103,7 +103,7 @@ static const command_t project_cmds[] PROGMEM = {
{true, "tx_mode <n>", "changes Tx logic. 1=EMS generic, 2=EMS+, 3=HT3"},
{false, "info", "show current values deciphered from the EMS messages"},
{false, "log <n | b | t | s | r | j | v | number>", "set logging to none, basic, thermostat, solar module, raw, jabber, verbose or specific type"},
{false, "log <n | b | t | s | r | j | v | w [type ID]", "set logging to none, basic, thermostat, solar module, raw, jabber, verbose or watch a specific type"},
#ifdef TESTS
{false, "test <n>", "insert a test telegram on to the EMS bus"},
@@ -113,7 +113,7 @@ static const command_t project_cmds[] PROGMEM = {
{false, "refresh", "fetch values from the EMS devices"},
{false, "devices", "list detected EMS devices"},
{false, "queue", "show current Tx queue"},
{false, "autodetect [quick]", "detect EMS devices and attempt to automatically set boiler and thermostat types"},
{false, "autodetect [scan]", "detect EMS devices and attempt to automatically set boiler and thermostat types"},
{false, "send XX ...", "send raw telegram data to EMS bus (XX are hex values)"},
{false, "thermostat read <type ID>", "send read request to the thermostat for heating circuit hc 1-4"},
{false, "thermostat temp [hc] <degrees>", "set current thermostat temperature"},
@@ -230,6 +230,8 @@ void showInfo() {
myDebug_P(PSTR(" System logging set to Solar Module only"));
} else if (sysLog == EMS_SYS_LOGGING_JABBER) {
myDebug_P(PSTR(" System logging set to Jabber"));
} else if (sysLog == EMS_SYS_LOGGING_WATCH) {
myDebug_P(PSTR(" System logging set to Watch"));
} else {
myDebug_P(PSTR(" System logging set to None"));
}
@@ -1228,9 +1230,9 @@ void _showCommands(uint8_t event) {
// we set the logging here
void TelnetCallback(uint8_t event) {
if (event == TELNET_EVENT_CONNECT) {
ems_setLogging(EMS_SYS_LOGGING_DEFAULT, true);
ems_setLogging(EMS_SYS_LOGGING_DEFAULT);
} else if (event == TELNET_EVENT_DISCONNECT) {
ems_setLogging(EMS_SYS_LOGGING_NONE, true);
ems_setLogging(EMS_SYS_LOGGING_NONE);
} else if ((event == TELNET_EVENT_SHOWCMD) || (event == TELNET_EVENT_SHOWSET)) {
_showCommands(event);
}
@@ -1273,19 +1275,19 @@ void TelnetCommandCallback(uint8_t wc, const char * commandLine) {
if (strcmp(first_cmd, "autodetect") == 0) {
if (wc == 2) {
char * second_cmd = _readWord();
if (strcmp(second_cmd, "quick") == 0) {
ems_clearDeviceList();
ems_doReadCommand(EMS_TYPE_UBADevices, EMS_Boiler.device_id);
if (strcmp(second_cmd, "scan") == 0) {
ems_scanDevices(); // known device scan
ok = true;
}
} else {
ems_scanDevices(); // normal known device scan
ems_clearDeviceList();
ems_doReadCommand(EMS_TYPE_UBADevices, EMS_Boiler.device_id);
ok = true;
}
}
// logging
if ((strcmp(first_cmd, "log") == 0) && (wc == 2)) {
if ((strcmp(first_cmd, "log") == 0) && (wc >= 2)) {
char * second_cmd = _readWord();
if (strcmp(second_cmd, "v") == 0) {
ems_setLogging(EMS_SYS_LOGGING_VERBOSE);
@@ -1308,6 +1310,9 @@ void TelnetCommandCallback(uint8_t wc, const char * commandLine) {
} else if (strcmp(second_cmd, "j") == 0) {
ems_setLogging(EMS_SYS_LOGGING_JABBER);
ok = true;
} else if (strcmp(second_cmd, "w") == 0) {
ems_setLogging(EMS_SYS_LOGGING_WATCH, _readHexNumber()); // get type_id
ok = true;
}
}

View File

@@ -50,6 +50,8 @@ void _process_SetPoints(_EMS_RxTelegram * EMS_RxTelegram);
// EMS+ specific
void _process_UBAOutdoorTemp(_EMS_RxTelegram * EMS_RxTelegram);
void _process_UBAMonitorFast2(_EMS_RxTelegram * EMS_RxTelegram);
void _process_UBAMonitorSlow2(_EMS_RxTelegram * EMS_RxTelegram);
// SM10
void _process_SM10Monitor(_EMS_RxTelegram * EMS_RxTelegram);
@@ -125,6 +127,8 @@ const _EMS_Type EMS_Types[] = {
// UBA/Boiler EMS+
{EMS_TYPE_UBAOutdoorTemp, "UBAOutdoorTemp", _process_UBAOutdoorTemp},
{EMS_TYPE_UBAMonitorFast2, "UBAMonitorFast2", _process_UBAMonitorFast2},
{EMS_TYPE_UBAMonitorSlow2, "UBAMonitorSlow2", _process_UBAMonitorSlow2},
// Solar Module devices
{EMS_TYPE_SM10Monitor, "SM10Monitor", _process_SM10Monitor},
@@ -422,12 +426,9 @@ _EMS_SYS_LOGGING ems_getLogging() {
return EMS_Sys_Status.emsLogging;
}
void ems_setLogging(_EMS_SYS_LOGGING loglevel, bool silent) {
if (loglevel <= EMS_SYS_LOGGING_JABBER) {
void ems_setLogging(_EMS_SYS_LOGGING loglevel, uint16_t type_id) {
if (loglevel <= EMS_SYS_LOGGING_WATCH) {
EMS_Sys_Status.emsLogging = loglevel;
if (silent) {
return; // don't print to telnet/serial
}
if (loglevel == EMS_SYS_LOGGING_NONE) {
myDebug_P(PSTR("System Logging set to None"));
@@ -443,6 +444,9 @@ void ems_setLogging(_EMS_SYS_LOGGING loglevel, bool silent) {
myDebug_P(PSTR("System Logging set to Raw mode"));
} else if (loglevel == EMS_SYS_LOGGING_JABBER) {
myDebug_P(PSTR("System Logging set to Jabber mode"));
} else if (loglevel == EMS_SYS_LOGGING_WATCH) {
EMS_Sys_Status.emsLogging_typeID = type_id;
myDebug_P(PSTR("System Logging set to Watch mode"));
}
}
}
@@ -555,14 +559,16 @@ void _debugPrintTelegram(const char * prefix, _EMS_RxTelegram * EMS_RxTelegram,
strlcat(output_str, " ", sizeof(output_str)); // add space
}
strlcat(output_str, "(CRC=", sizeof(output_str));
strlcat(output_str, _hextoa(data[length - 1], buffer), sizeof(output_str));
strlcat(output_str, ")", sizeof(output_str));
if (!raw) {
strlcat(output_str, "(CRC=", sizeof(output_str));
strlcat(output_str, _hextoa(data[length - 1], buffer), sizeof(output_str));
strlcat(output_str, ")", sizeof(output_str));
// print number of data bytes only if its a valid telegram
if (data_len) {
strlcat(output_str, " #data=", sizeof(output_str));
strlcat(output_str, itoa(data_len, buffer, 10), sizeof(output_str));
// print number of data bytes only if its a valid telegram
if (data_len) {
strlcat(output_str, " #data=", sizeof(output_str));
strlcat(output_str, itoa(data_len, buffer, 10), sizeof(output_str));
}
}
strlcat(output_str, COLOR_RESET, sizeof(output_str));
@@ -904,9 +910,12 @@ void ems_parseTelegram(uint8_t * telegram, uint8_t length) {
}
// if we are in raw logging mode then just print out the telegram as it is
// or if we're watching a specific type ID show it
// but still continue to process it
if ((EMS_Sys_Status.emsLogging == EMS_SYS_LOGGING_RAW)) {
_debugPrintTelegram("", &EMS_RxTelegram, COLOR_WHITE, true);
} else if ((EMS_Sys_Status.emsLogging == EMS_SYS_LOGGING_WATCH) && (EMS_RxTelegram.type == EMS_Sys_Status.emsLogging_typeID)) {
_debugPrintTelegram("", &EMS_RxTelegram, COLOR_WHITE, true);
}
// Assume at this point we have something that vaguely resembles a telegram in the format [src] [dest] [type] [offset] [data] [crc]
@@ -974,7 +983,6 @@ void _printMessage(_EMS_RxTelegram * EMS_RxTelegram) {
strlcat(output_str, ", ", sizeof(output_str));
if (EMS_Sys_Status.emsLogging == EMS_SYS_LOGGING_THERMOSTAT) {
// only print ones to/from thermostat if logging is set to thermostat only
if ((src == EMS_Thermostat.device_id) || (dest == EMS_Thermostat.device_id)) {
@@ -1310,6 +1318,42 @@ void _process_UBAMonitorFast(_EMS_RxTelegram * EMS_RxTelegram) {
_checkActive();
}
/**
* UBAMonitorFast2 - type 0xE4 - central heating monitor
*/
void _process_UBAMonitorFast2(_EMS_RxTelegram * EMS_RxTelegram) {
EMS_Boiler.selFlowTemp = _toByte(6);
//EMS_Boiler.curFlowTemp = _toShort(1);
//EMS_Boiler.retTemp = _toShort(13);
EMS_Boiler.burnGas = _bitRead(11, 0);
EMS_Boiler.wWHeat = _bitRead(11, 2);
EMS_Boiler.curBurnPow = _toByte(10);
EMS_Boiler.selBurnPow = _toByte(9); // burn power max setting
// set boiler temp only if we actually have a real value
if (_toShort(7) != EMS_VALUE_USHORT_NOTSET) {
EMS_Boiler.boilTemp = _toShort(7); // 0x8000 if not available
}
EMS_Boiler.flameCurr = _toShort(19);
// system pressure. FF means missing
//EMS_Boiler.sysPress = _toByte(17); // this is *10
// read the service code / installation status as appears on the display
EMS_Boiler.serviceCodeChar[0] = char(_toByte(4)); // ascii character 1
EMS_Boiler.serviceCodeChar[1] = char(_toByte(5)); // ascii character 2
EMS_Boiler.serviceCodeChar[2] = '\0'; // null terminate string
// read error code
//EMS_Boiler.serviceCode = _toShort(20);
// at this point do a quick check to see if the hot water or heating is active
_checkActive();
}
/**
* UBAMonitorSlow - type 0x19 - central heating monitor part 2 (27 bytes long)
* received every 60 seconds
@@ -1332,6 +1376,21 @@ void _process_UBAMonitorSlow(_EMS_RxTelegram * EMS_RxTelegram) {
EMS_Boiler.switchTemp = _toShort(25);
}
/**
* UBAMonitorSlow2 - type 0xE5 - central heating monitor
*/
void _process_UBAMonitorSlow2(_EMS_RxTelegram * EMS_RxTelegram) {
EMS_Boiler.fanWork = _bitRead(2, 2);
EMS_Boiler.ignWork = _bitRead(2, 3);
EMS_Boiler.heatPmp = _bitRead(2, 5);
EMS_Boiler.wWCirc = _bitRead(2, 7);
EMS_Boiler.burnStarts = _toLong(10);
EMS_Boiler.burnWorkMin = _toLong(13);
EMS_Boiler.heatWorkMin = _toLong(19);
EMS_Boiler.pumpMod = _toByte(25); // or is it switchTemp ?
}
/**
* UBAOutdoorTemp - type 0xD1 - external temperature
*/

View File

@@ -105,6 +105,7 @@ typedef enum {
typedef enum {
EMS_SYS_LOGGING_NONE, // no messages
EMS_SYS_LOGGING_RAW, // raw data mode
EMS_SYS_LOGGING_WATCH, // watch a specific type ID
EMS_SYS_LOGGING_BASIC, // only basic read/write messages
EMS_SYS_LOGGING_THERMOSTAT, // only telegrams sent from thermostat
EMS_SYS_LOGGING_SOLARMODULE, // only telegrams sent from thermostat
@@ -121,6 +122,7 @@ typedef struct {
uint16_t emxCrcErr; // CRC errors
bool emsPollEnabled; // flag enable the response to poll messages
_EMS_SYS_LOGGING emsLogging; // logging
uint16_t emsLogging_typeID; // the typeID to watch
bool emsRefreshed; // fresh data, needs to be pushed out to MQTT
bool emsBusConnected; // is there an active bus
uint32_t emsRxTimestamp; // timestamp of last EMS message received
@@ -435,7 +437,7 @@ void ems_setWarmWaterActivated(bool activated);
void ems_setWarmWaterOnetime(bool activated);
void ems_setWarmTapWaterActivated(bool activated);
void ems_setPoll(bool b);
void ems_setLogging(_EMS_SYS_LOGGING loglevel, bool silent = false);
void ems_setLogging(_EMS_SYS_LOGGING loglevel, uint16_t type_id = 0);
void ems_setEmsRefreshed(bool b);
void ems_setWarmWaterModeComfort(uint8_t comfort);
void ems_setModels();

View File

@@ -33,7 +33,9 @@
#define EMS_TYPE_UBAFunctionTest 0x1D
// EMS+ specific
#define EMS_TYPE_UBAOutdoorTemp 0xD1 // external temp
#define EMS_TYPE_UBAOutdoorTemp 0xD1 // external temp
#define EMS_TYPE_UBAMonitorFast2 0xE4 // Monitor fast for newer EMS+
#define EMS_TYPE_UBAMonitorSlow2 0xE5 // Monitor slow for newer EMS+
#define EMS_OFFSET_UBAParameterWW_wwtemp 2 // WW Temperature
#define EMS_OFFSET_UBAParameterWW_wwactivated 1 // WW Activated
@@ -92,7 +94,6 @@
#define EMS_OFFSET_RC30Set_mode 23 // position of thermostat mode
#define EMS_OFFSET_RC30Set_temp 28 // position of thermostat setpoint temperature
// RC35 specific
#define EMS_TYPE_RC35StatusMessage_HC1 0x3E // is an automatic thermostat broadcast giving us temps on HC1
#define EMS_TYPE_RC35StatusMessage_HC2 0x48 // is an automatic thermostat broadcast giving us temps on HC2

View File

@@ -1 +1 @@
#define APP_VERSION "1.9.4b12"
#define APP_VERSION "1.9.4b13"