diff --git a/CHANGELOG_LATEST.md b/CHANGELOG_LATEST.md index a0f144814..08ae4c2db 100644 --- a/CHANGELOG_LATEST.md +++ b/CHANGELOG_LATEST.md @@ -9,8 +9,7 @@ See https://github.com/proddy/EMS-ESP/issues/632 ### Fixed - telegrams matched to masterthermostat 0x18 -- multible roomcontrollers - +- multiple roomcontrollers ### Changed - split `show values` in smaller packages (edited) diff --git a/src/dallassensor.cpp b/src/dallassensor.cpp index 2aae1438c..01f0b417b 100644 --- a/src/dallassensor.cpp +++ b/src/dallassensor.cpp @@ -42,9 +42,7 @@ void DallasSensor::start() { #endif // API call - Command::add_with_json(EMSdevice::DeviceType::DALLASSENSOR, F_(info), [&](const char * value, const int8_t id, JsonObject & json) { - return command_info(value, id, json); - }); + Command::add_with_json(EMSdevice::DeviceType::DALLASSENSOR, F_(info), [&](const char * value, const int8_t id, JsonObject & json) { return command_info(value, id, json); }); } // load the MQTT settings @@ -252,13 +250,11 @@ const std::vector DallasSensor::sensors() const { // skip crc from id. DallasSensor::Sensor::Sensor(const uint8_t addr[]) - : id_(((uint64_t)addr[0] << 48) | ((uint64_t)addr[1] << 40) | ((uint64_t)addr[2] << 32) | ((uint64_t)addr[3] << 24) | ((uint64_t)addr[4] << 16) - | ((uint64_t)addr[5] << 8) | ((uint64_t)addr[6])) { + : id_(((uint64_t)addr[0] << 48) | ((uint64_t)addr[1] << 40) | ((uint64_t)addr[2] << 32) | ((uint64_t)addr[3] << 24) | ((uint64_t)addr[4] << 16) | ((uint64_t)addr[5] << 8) | ((uint64_t)addr[6])) { } uint64_t DallasSensor::get_id(const uint8_t addr[]) { - return (((uint64_t)addr[0] << 48) | ((uint64_t)addr[1] << 40) | ((uint64_t)addr[2] << 32) | ((uint64_t)addr[3] << 24) | ((uint64_t)addr[4] << 16) - | ((uint64_t)addr[5] << 8) | ((uint64_t)addr[6])); + return (((uint64_t)addr[0] << 48) | ((uint64_t)addr[1] << 40) | ((uint64_t)addr[2] << 32) | ((uint64_t)addr[3] << 24) | ((uint64_t)addr[4] << 16) | ((uint64_t)addr[5] << 8) | ((uint64_t)addr[6])); } uint64_t DallasSensor::Sensor::id() const { @@ -267,13 +263,7 @@ uint64_t DallasSensor::Sensor::id() const { std::string DallasSensor::Sensor::to_string() const { std::string str(20, '\0'); - snprintf_P(&str[0], - str.capacity() + 1, - PSTR("%02X-%04X-%04X-%04X"), - (unsigned int)(id_ >> 48) & 0xFF, - (unsigned int)(id_ >> 32) & 0xFFFF, - (unsigned int)(id_ >> 16) & 0xFFFF, - (unsigned int)(id_)&0xFFFF); + snprintf_P(&str[0], str.capacity() + 1, PSTR("%02X-%04X-%04X-%04X"), (unsigned int)(id_ >> 48) & 0xFF, (unsigned int)(id_ >> 32) & 0xFFFF, (unsigned int)(id_ >> 16) & 0xFFFF, (unsigned int)(id_)&0xFFFF); return str; } diff --git a/src/dallassensor.h b/src/dallassensor.h index 1cfdfebe8..40e6bfe89 100644 --- a/src/dallassensor.h +++ b/src/dallassensor.h @@ -65,7 +65,7 @@ class DallasSensor { const std::vector sensors() const; uint32_t fails() { - return sensorfails_; + return sensorfails_; } private: diff --git a/src/devices/mixer.cpp b/src/devices/mixer.cpp index 49944cccd..458c0af04 100644 --- a/src/devices/mixer.cpp +++ b/src/devices/mixer.cpp @@ -54,7 +54,7 @@ Mixer::Mixer(uint8_t device_type, uint8_t device_id, uint8_t product_id, const s if (device_id <= 0x27) { type_ = Type::HC; hc_ = device_id - 0x20 + 1; - uint8_t tag = TAG_HC1 + hc_ - 1; + uint8_t tag = TAG_HC1 + hc_ - 1; register_device_value(tag, &flowSetTemp_, DeviceValueType::UINT, nullptr, F("flowSetTemp"), F("Setpoint flow temperature"), DeviceValueUOM::DEGREES); register_device_value(tag, &flowTemp_, DeviceValueType::USHORT, FL_(div10), F("flowTemp"), F("Current flow temperature"), DeviceValueUOM::DEGREES); register_device_value(tag, &pumpStatus_, DeviceValueType::BOOL, nullptr, F("pumpStatus"), F("Pump status"), DeviceValueUOM::NONE); diff --git a/src/devices/thermostat.cpp b/src/devices/thermostat.cpp index 5e53109eb..1279b6081 100644 --- a/src/devices/thermostat.cpp +++ b/src/devices/thermostat.cpp @@ -231,7 +231,6 @@ std::shared_ptr Thermostat::heating_circuit(const ui // returns pointer to the HeatingCircuit or nullptr if it can't be found // if its a new one, the object will be created and also the fetch flags set std::shared_ptr Thermostat::heating_circuit(std::shared_ptr telegram) { - // look through the Monitor and Set arrays to see if there is a match uint8_t hc_num = 0; bool toggle_ = false; diff --git a/src/emsesp.cpp b/src/emsesp.cpp index ea33edb28..5139410da 100644 --- a/src/emsesp.cpp +++ b/src/emsesp.cpp @@ -874,8 +874,7 @@ bool EMSESP::add_device(const uint8_t device_id, const uint8_t product_id, std:: bool EMSESP::command_info(uint8_t device_type, JsonObject & json, const int8_t id) { bool has_value = false; for (const auto & emsdevice : emsdevices) { - if (emsdevice && (emsdevice->device_type() == device_type) && - ((device_type != DeviceType::THERMOSTAT) || (emsdevice->device_id() == EMSESP::actual_master_thermostat()))) { + if (emsdevice && (emsdevice->device_type() == device_type) && ((device_type != DeviceType::THERMOSTAT) || (emsdevice->device_id() == EMSESP::actual_master_thermostat()))) { has_value |= emsdevice->generate_values_json(json, DeviceValueTAG::TAG_NONE, (id != 0)); // verbose mode } } diff --git a/src/mqtt.cpp b/src/mqtt.cpp index a3cfa1739..8ad6ff8a9 100644 --- a/src/mqtt.cpp +++ b/src/mqtt.cpp @@ -511,9 +511,9 @@ void Mqtt::ha_status() { doc["~"] = mqtt_base_; // default ems-esp // doc["avty_t"] = FJSON("~/status"); // commented out, as it causes errors in HA sometimes // doc["json_attr_t"] = FJSON("~/heartbeat"); // store also as HA attributes - doc["stat_t"] = FJSON("~/heartbeat"); - doc["name"] = FJSON("EMS-ESP status"); - doc["val_tpl"] = FJSON("{{value_json['status']}}"); + doc["stat_t"] = FJSON("~/heartbeat"); + doc["name"] = FJSON("EMS-ESP status"); + doc["val_tpl"] = FJSON("{{value_json['status']}}"); JsonObject dev = doc.createNestedObject("dev"); dev["name"] = F_(EMSESP); // "EMS-ESP" diff --git a/src/roomcontrol.h b/src/roomcontrol.h index 8d034b8d9..57fa42c0b 100644 --- a/src/roomcontrol.h +++ b/src/roomcontrol.h @@ -42,7 +42,6 @@ class Roomctrl { static bool switch_off_[HCS]; static uint32_t rc_time_[HCS]; static int16_t remotetemp_[HCS]; - }; } // namespace emsesp