fix Arduino 7 (using to<> and not as<>

This commit is contained in:
Proddy
2024-01-05 22:39:35 +01:00
parent 26e4badc1b
commit 19eb755157
4 changed files with 25 additions and 21 deletions

View File

@@ -560,15 +560,15 @@ void EMSESP::publish_device_values(uint8_t device_type) {
// group by device type
for (uint8_t tag = DeviceValueTAG::TAG_BOILER_DATA_WW; tag <= DeviceValueTAG::TAG_HS16; tag++) {
JsonObject json_hc = json;
JsonObject json_tag = json;
bool nest_created = false;
for (const auto & emsdevice : emsdevices) {
if (emsdevice && (emsdevice->device_type() == device_type)) {
if (nested && !nest_created && emsdevice->has_tags(tag)) {
json_hc = doc[EMSdevice::tag_to_mqtt(tag)].add<JsonObject>();
json_tag = doc[EMSdevice::tag_to_mqtt(tag)].to<JsonObject>();
nest_created = true;
}
need_publish |= emsdevice->generate_values(json_hc, tag, false, EMSdevice::OUTPUT_TARGET::MQTT);
need_publish |= emsdevice->generate_values(json_tag, tag, false, EMSdevice::OUTPUT_TARGET::MQTT);
}
}
if (need_publish && ((!nested && tag >= DeviceValueTAG::TAG_DEVICE_DATA_WW) || (tag == DeviceValueTAG::TAG_BOILER_DATA_WW))) {