From ac5a96058182bc6fb87a089e1342a10fea569b49 Mon Sep 17 00:00:00 2001 From: Thomas Basler Date: Tue, 24 Sep 2024 20:42:38 +0200 Subject: [PATCH] MQTT Hass: Move yield into the publish method --- src/MqttHandleHass.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/MqttHandleHass.cpp b/src/MqttHandleHass.cpp index 213ea8443..4cc1a967e 100644 --- a/src/MqttHandleHass.cpp +++ b/src/MqttHandleHass.cpp @@ -69,8 +69,6 @@ void MqttHandleHassClass::publishConfig() publishDtuBinarySensor("Status", config.Mqtt.Lwt.Topic, config.Mqtt.Lwt.Value_Online, config.Mqtt.Lwt.Value_Offline, "connectivity", "diagnostic"); - yield(); - // Loop all inverters for (uint8_t i = 0; i < Hoymiles.getNumInverters(); i++) { auto inv = Hoymiles.getInverterByPos(i); @@ -89,8 +87,6 @@ void MqttHandleHassClass::publishConfig() publishInverterBinarySensor(inv, "Reachable", "status/reachable", "1", "0"); publishInverterBinarySensor(inv, "Producing", "status/producing", "1", "0"); - yield(); - publishInverterSensor(inv, "TX Requests", "radio/tx_request", "", "", "", "diagnostic"); publishInverterSensor(inv, "RX Success", "radio/rx_success", "", "", "", "diagnostic"); publishInverterSensor(inv, "RX Fail Receive Nothing", "radio/rx_fail_nothing", "", "", "", "diagnostic"); @@ -98,8 +94,6 @@ void MqttHandleHassClass::publishConfig() publishInverterSensor(inv, "RX Fail Receive Corrupt", "radio/rx_fail_corrupt", "", "", "", "diagnostic"); publishInverterSensor(inv, "TX Re-Request Fragment", "radio/tx_re_request", "", "", "", "diagnostic"); - yield(); - // Loop all channels for (auto& t : inv->Statistics()->getChannelTypes()) { for (auto& c : inv->Statistics()->getChannelsByType(t)) { @@ -112,8 +106,6 @@ void MqttHandleHassClass::publishConfig() } } } - - yield(); } } @@ -335,6 +327,7 @@ void MqttHandleHassClass::publish(const String& subtopic, const String& payload) String topic = Configuration.get().Mqtt.Hass.Topic; topic += subtopic; MqttSettings.publishGeneric(topic, payload, Configuration.get().Mqtt.Hass.Retain); + yield(); } void MqttHandleHassClass::publishBinarySensor(JsonDocument& doc, const String& root_device, const String& unique_id_prefix, const String& name, const String& state_topic, const String& payload_on, const String& payload_off, const String& device_class, const String& category)