watch unknown and fixes (see #619 comments)

This commit is contained in:
MichaelDvP
2020-11-18 13:33:04 +01:00
parent 0b19ea7a0d
commit 780be4ff57
7 changed files with 16 additions and 10 deletions

View File

@@ -8,7 +8,7 @@
- expose test framework via api (#611)
- SysLog has enable/disable flag in WebUI
- Add solar configuration telegrams (#616) [thanks @hpanther]
- log trace shows decoded telegrams, watch 0xFF for unknown telegrams
- `log trace` shows decoded telegrams, `watch unknown` for only unknown telegrams
- WM10 switch
### Fixed

View File

@@ -307,10 +307,15 @@ void EMSESPShell::add_console_commands() {
emsesp::EMSESP::watch(EMSESP::WATCH_ON); // on
} else if (arguments[0] == read_flash_string(F_(off))) {
emsesp::EMSESP::watch(EMSESP::WATCH_OFF); // off
} else if (arguments[0] == read_flash_string(F_(unknown))) {
emsesp::EMSESP::watch(EMSESP::WATCH_UNKNOWN); // unknown
watch_id = WATCH_ID_NONE;
} else {
watch_id = Helpers::hextoint(arguments[0].c_str());
if ((emsesp::EMSESP::watch() == EMSESP::WATCH_OFF) && watch_id) {
emsesp::EMSESP::watch(EMSESP::WATCH_ON); // on
} else if ((emsesp::EMSESP::watch() == EMSESP::WATCH_UNKNOWN) || !watch_id) {
return;
}
}
@@ -335,8 +340,10 @@ void EMSESPShell::add_console_commands() {
if (watch == EMSESP::WATCH_ON) {
shell.printfln(F("Watching incoming telegrams, displayed in decoded format"));
} else {
} else if (watch == EMSESP::WATCH_RAW) {
shell.printfln(F("Watching incoming telegrams, displayed as raw bytes")); // WATCH_RAW
} else {
shell.printfln(F("Watching unknown telegrams")); // WATCH_UNKNOWN
}
watch_id = emsesp::EMSESP::watch_id();

View File

@@ -1040,7 +1040,6 @@ void Boiler::process_UBAMaintenanceStatus(std::shared_ptr<const Telegram> telegr
}
// 0x10, 0x11
// not yet implemented
void Boiler::process_UBAErrorMessage(std::shared_ptr<const Telegram> telegram) {
// data: displaycode(2), errornumber(2), year, month, hour, day, minute, duration(2), src-addr
if (telegram->message_data[4] & 0x80) { // valid date
@@ -1430,7 +1429,7 @@ bool Boiler::set_reset(const char * value, const int8_t id) {
if (v == false) {
return false;
}
LOG_INFO(F("reseting boiler"));
LOG_INFO(F("restarting boiler"));
write_command(0x05, 0x08, 0xFF);
return true;

View File

@@ -140,9 +140,9 @@ void Switch::register_mqtt_ha_config() {
ids.add("ems-esp-switch");
Mqtt::publish_retain(F("homeassistant/sensor/ems-esp/switch/config"), doc.as<JsonObject>(), true); // publish the config payload with retain flag
Mqtt::register_mqtt_ha_sensor(PSTR("switch"), nullptr, F_(flowTemp), this->device_type(), "activated", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(PSTR("switch"), nullptr, F_(flowTemp), this->device_type(), "flowTemp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(PSTR("switch"), nullptr, F_(flowTemp), this->device_type(), "status", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(activated), this->device_type(), "activated", nullptr, nullptr);
Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(flowTemp), this->device_type(), "flowTemp", F_(degrees), F_(icontemperature));
Mqtt::register_mqtt_ha_sensor(nullptr, nullptr, F_(status), this->device_type(), "status", nullptr, nullptr);
mqtt_ha_config_ = true; // done
}

View File

@@ -648,7 +648,7 @@ bool EMSESP::process_telegram(std::shared_ptr<const Telegram> telegram) {
if (!found) {
LOG_DEBUG(F("No telegram type handler found for ID 0x%02X (src 0x%02X)"), telegram->type_id, telegram->src);
if ((watch() == WATCH_ON) && (watch_id_ == 0xFF)) {
if (watch() == WATCH_UNKNOWN) {
LOG_NOTICE(pretty_telegram(telegram).c_str());
}
}

View File

@@ -116,7 +116,7 @@ class EMSESP {
return (!(dallassensor_.sensors().empty()));
}
enum Watch : uint8_t { WATCH_OFF, WATCH_ON, WATCH_RAW };
enum Watch : uint8_t { WATCH_OFF, WATCH_ON, WATCH_RAW, WATCH_UNKNOWN };
static void watch_id(uint16_t id);
static uint16_t watch_id() {
return watch_id_;

View File

@@ -111,7 +111,7 @@ MAKE_PSTR(deep_optional, "[deep]")
MAKE_PSTR(tx_mode_fmt, "Tx mode = %d")
MAKE_PSTR(bus_id_fmt, "Bus ID = %02X")
MAKE_PSTR(watchid_optional, "[ID]")
MAKE_PSTR(watch_format_optional, "[off | on | raw]")
MAKE_PSTR(watch_format_optional, "[off | on | raw | unknown]")
MAKE_PSTR(invalid_watch, "Invalid watch type")
MAKE_PSTR(data_mandatory, "\"XX XX ...\"")
MAKE_PSTR(percent, "%")