zigbee2mqtt icon indicating copy to clipboard operation
zigbee2mqtt copied to clipboard

"last_seen" is still part of MQTT message even when disabled

Open jamesmyatt opened this issue 1 year ago • 2 comments

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)

  1. Set "last seen" to "ISO_8601"
  2. Save, restart or reload config
  3. Set "last seen" to "disable"
  4. Save, restart or reload config
  5. Observe MQTT messages

Zigbee2MQTT version

1.37.0

Adapter firmware version

20230507

Adapter

Sonoff USB

Setup

Docker container

Debug log

No response

jamesmyatt avatar May 03 '24 13:05 jamesmyatt

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.

jamesmyatt avatar May 03 '24 13:05 jamesmyatt

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 }

jchristianj avatar May 22 '24 18:05 jchristianj