Add MQTT connection uptime sensor

To debug network connectivity issues.
This commit is contained in:
2025-03-15 20:50:05 +00:00
parent b5bed25f78
commit b34d601ffd
+12
View File
@@ -10,3 +10,15 @@ mqtt:
# No point in publishing NaN as it will not be accepted by # No point in publishing NaN as it will not be accepted by
# HA and only generate error messages. # HA and only generate error messages.
publish_nan_as_none: true publish_nan_as_none: true
on_connect:
- sensor.duty_time.start: mqtt_connection_uptime
on_disconnect:
- sensor.duty_time.stop: mqtt_connection_uptime
- sensor.duty_time.reset: mqtt_connection_uptime
sensor:
- platform: duty_time
id: mqtt_connection_uptime
name: "ESP chip MQTT connection uptime"
entity_category: diagnostic
accuracy_decimals: 0