zigbee2mqtt
zigbee2mqtt copied to clipboard
"last_seen" is still part of MQTT message even when disabled
What happened?
I previously had "last_seen" enabled. However, this was bloating the HA database, so I disabled it again. However, it's still being reported in latest the MQTT messages as last_seen: '2024-04-26T16:32:40.187Z', which is the time that I disabled it again.
What did you expect to happen?
"last_seen" attribute removed when disabled, rather than retaining the last value.
How to reproduce it (minimal and precise)
- Set "last seen" to "ISO_8601"
- Save, restart or reload config
- Set "last seen" to "disable"
- Save, restart or reload config
- Observe MQTT messages
Zigbee2MQTT version
1.37.0
Adapter firmware version
20230507
Adapter
Sonoff USB
Setup
Docker container
Debug log
No response
I have a separate issue that the last seen entities aren't removed from HA, but I think this is an HA issue since the discovery topics are missing.
Same issue here. Had enabled the last seen option, but my HA database became too large, so I disabled it. Any ZigBee device which had it once enabled, still has the last_seen in the state message. Devices, which have been added after deactivation, do not have the last_seen information in the message.
Device which has been in network during last seen enable / disable:
{ "child_lock": "UNLOCK", "current": 0, "energy": 135.47, "indicator_mode": "off/on", "last_seen": "2024-04-23T09:01:07+02:00", "linkquality": 240, "power": 0, "power_outage_memory": "restore", "state": "ON", "update": { "installed_version": 192, "latest_version": 192, "state": "idle" }, "voltage": 225, "update_available": null }
Device which has been added after last seen enable / disable:
{ "child_lock": "LOCK", "countdown": 0, "current": 0, "energy": 4.04, "indicator_mode": "off/on", "linkquality": 140, "power": 0, "power_outage_memory": "off", "state": "ON", "update": { "installed_version": 192, "latest_version": 192, "state": "idle" }, "voltage": 227, "update_available": null }