U option for scanning thermostats

This commit is contained in:
proddy
2019-01-03 17:02:07 +01:00
parent 2aa669e0d0
commit a980e5dd40

View File

@@ -40,8 +40,8 @@ Ticker ledcheckTimer;
// thermostat scan - for debugging // thermostat scan - for debugging
Ticker scanThermostat; Ticker scanThermostat;
#define SCANTHERMOSTAT_TIME 4 #define SCANTHERMOSTAT_TIME 1
uint8_t scanThermostat_count; uint8_t scanThermostat_count = 0;
Ticker showerColdShotStopTimer; Ticker showerColdShotStopTimer;
@@ -100,16 +100,17 @@ command_t PROGMEM project_cmds[] = {
{"h", "list supported EMS telegram type IDs"}, {"h", "list supported EMS telegram type IDs"},
{"M", "publish to MQTT"}, {"M", "publish to MQTT"},
{"Q", "print Tx Queue"}, {"Q", "print Tx Queue"},
{"U [n]", "do a deep scan of all thermostat messages types, start at n"},
{"P", "toggle EMS Poll response on/off"}, {"P", "toggle EMS Poll response on/off"},
{"X", "toggle EMS Tx transmission on/off"}, {"X", "toggle EMS Tx transmission on/off"},
{"S", "toggle Shower timer on/off"}, {"S", "toggle Shower timer on/off"},
{"A", "toggle shower Alert on/off"}, {"A", "toggle shower Alert on/off"},
{"r [s]", "send raw telegram to EMS (s=XX XX XX...)"}, {"r [s]", "send raw telegram in hex to EMS (s=XX XX XX...)"},
{"b [xx]", "send boiler read request (xx=telegram type ID in hex)"}, {"b [xx]", "send boiler read request (xx=telegram type ID in hex)"},
{"t [xx]", "send thermostat read request (xx=telegram type ID in hex)"}, {"t [xx]", "send thermostat read request (xx=telegram type ID in hex)"},
{"w [nn]", "set boiler warm water temperature (min 30)"}, {"w [n]", "set boiler warm water temperature (min 30)"},
{"a [n]", "set boiler warm tap water (0=off, 1=on)"}, {"a [n]", "set boiler warm tap water (0=off, 1=on)"},
{"T [xx]", "set thermostat temperature"}, {"T [n]", "set thermostat temperature"},
{"m [n]", "set thermostat mode (0=low/night, 1=manual/day, 2=auto)"} {"m [n]", "set thermostat mode (0=low/night, 1=manual/day, 2=auto)"}
}; };
@@ -296,7 +297,7 @@ void showInfo() {
EMS_Sys_Status.emsTxPkgs, EMS_Sys_Status.emsTxPkgs,
EMS_Sys_Status.emxCrcErr); EMS_Sys_Status.emxCrcErr);
myDebug(""); // newline? myDebug("");
myDebug("%sBoiler stats:%s", COLOR_BOLD_ON, COLOR_BOLD_OFF); myDebug("%sBoiler stats:%s", COLOR_BOLD_ON, COLOR_BOLD_OFF);
@@ -613,12 +614,12 @@ void myDebugCallback() {
ems_setExperimental((uint8_t)strtol(&cmd[2], 0, 16)); // takes HEX param ems_setExperimental((uint8_t)strtol(&cmd[2], 0, 16)); // takes HEX param
break; break;
case 'U': // thermostat scan case 'U': // thermostat scan
myDebug("Doing a type ID scan on thermostat...");
ems_setLogging(EMS_SYS_LOGGING_THERMOSTAT); ems_setLogging(EMS_SYS_LOGGING_THERMOSTAT);
publishValuesTimer.detach(); publishValuesTimer.detach();
systemCheckTimer.detach(); systemCheckTimer.detach();
regularUpdatesTimer.detach(); regularUpdatesTimer.detach();
scanThermostat_count = (uint8_t)strtol(&cmd[2], 0, 16); scanThermostat_count = (uint8_t)strtol(&cmd[2], 0, 16);
myDebug("Doing a deep scan on all message types to the thermometer start at 0x%02. Reboot ESP when finished.", scanThermostat_count);
scanThermostat.attach(SCANTHERMOSTAT_TIME, do_scanThermostat); scanThermostat.attach(SCANTHERMOSTAT_TIME, do_scanThermostat);
break; break;
default: default:
@@ -738,7 +739,7 @@ void do_ledcheck() {
// Thermostat scan // Thermostat scan
void do_scanThermostat() { void do_scanThermostat() {
myDebug("Scanning thermostat type calls, starting at %d...", scanThermostat_count); myDebug("> Scanning thermostat message type #0x%02X..", scanThermostat_count);
ems_doReadCommand(scanThermostat_count, EMS_Thermostat.type_id); ems_doReadCommand(scanThermostat_count, EMS_Thermostat.type_id);
scanThermostat_count++; scanThermostat_count++;
} }
@@ -887,7 +888,8 @@ void loop() {
myESP.loop(); myESP.loop();
// publish the values to MQTT, regardless if the values haven't changed // publish the values to MQTT, regardless if the values haven't changed
if (ems_getEmsRefreshed()) { // we don't want to publish when doing a deep scan of the thermostat
if (ems_getEmsRefreshed() && (scanThermostat_count == 0)) {
publishValues(true); publishValues(true);
ems_setEmsRefreshed(false); ems_setEmsRefreshed(false);
} }