From 2743ce0d24dc0f26f6a060932000fa5378076365 Mon Sep 17 00:00:00 2001 From: Jan Bouwhuis Date: Fri, 7 Mar 2025 19:15:46 +0100 Subject: [PATCH] Document how MQTT reports entity state updates (#37856) * Document how MQTT reports entity state updates * Update source/_integrations/mqtt.markdown Co-authored-by: J. Nick Koston * Update source/_integrations/mqtt.markdown Co-authored-by: J. Nick Koston --------- Co-authored-by: J. Nick Koston --- source/_integrations/mqtt.markdown | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/source/_integrations/mqtt.markdown b/source/_integrations/mqtt.markdown index b00d3ac5dfe..4e2d9f937d6 100644 --- a/source/_integrations/mqtt.markdown +++ b/source/_integrations/mqtt.markdown @@ -1408,6 +1408,18 @@ If you have a large number of manually configured items, you might want to consi Documentation on the MQTT components that support YAML [can be found here](/integrations/mqtt/#configuration-via-yaml). {% endnote %} +## Entity state updates + +Entities receive state updates via MQTT subscriptions. The payloads received on the state topics are processed to determine whether there is a significant change. If a change is detected, the entity will be updated. + +Note that MQTT device payloads often contain information for updating multiple entities that subscribe to the same topics. For example, a light status update might include information about link quality. This data can update a link quality sensor but is not used to update the light itself. MQTT filters out entity state updates when there are no changes. + +### The last reported state attribute + +Because MQTT state updates are often repeated frequently, even when no actual changes exist, it is up to the MQTT subscriber to determine whether a status update was received. If the latest update is missed, it might take some time before the next one arrives. If a retained payload exists at the broker, that value will be replayed first, but it will be an update of a previous last state. + +MQTT devices often continuously generate numerous state updates. MQTT does not update `last_reported` to avoid impacting system stability unless `force_update` is set. Alternatively, an MQTT sensor can be created to measure the last update. + ## Using Templates The MQTT integration supports templating. Read more [about using templates with the MQTT integration](/docs/configuration/templating/#using-templates-with-the-mqtt-integration).