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 <nick@koston.org>

* Update source/_integrations/mqtt.markdown

Co-authored-by: J. Nick Koston <nick@koston.org>

---------

Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
Jan Bouwhuis 2025-03-07 19:15:46 +01:00 committed by GitHub
parent bde7f6d8eb
commit 2743ce0d24
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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).