diff --git a/src/MqttHandleHass.cpp b/src/MqttHandleHass.cpp index a2f38f0..9578daf 100644 --- a/src/MqttHandleHass.cpp +++ b/src/MqttHandleHass.cpp @@ -134,7 +134,7 @@ void MqttHandleHassClass::publishField(std::shared_ptr inv, Ch createDeviceInfo(deviceObj, inv); if (Configuration.get().Mqtt_Hass_Expire) { - root["exp_aft"] = Hoymiles.getNumInverters() * Configuration.get().Mqtt_PublishInterval * 3; + root["exp_aft"] = Hoymiles.getNumInverters() * max(Hoymiles.PollInterval(), Configuration.get().Mqtt_PublishInterval) * inv->getReachableThreshold(); } if (devCls != 0) { root["dev_cla"] = devCls;