How do I view 'last seen' status of zigbee/mqtt devices

Zigbee2mqtt dashboard shows ‘last seen’ for each device.

I is presented in mqqt payload:

image

However, I don’t see ‘last seen’ as a sensor/entity property. All I see is the following:

  - entity: sensor.aqara_outdoor_temperature
  - entity: sensor.aqara_outdoor_humidity
  - entity: sensor.aqara_outdoor_pressure
  - entity: sensor.aqara_outdoor_battery

How do I add/enable the ‘last seen’ property?

Thanks

After some digging, I figured out that ‘last_seen’, as well as ‘link_quality’, are attributes that are disabled. After enabling them, now I can see them on dashboards.

2 Likes

how do you enable them?

1 Like

Were you able to enable them?

You can easily enable it by following this path: Zigbee2MQTT → Settings → Availability → Availability (Advanced)

2 Likes

Did anyone find how to enable the last_seen entity by default?
I just enabled 100+ entities one-by-one.

In z2m configuration.yaml:

device_options:
  homeassistant:
    last_seen:
      enabled_by_default: true
3 Likes

For some extra info. To be able to enable the “last_seen” attribute of existing devices, you will need to rename the sensor in Z2M to force a regeneration in Home Assistant and then rename it back to it’s original name.

I just enabled last_seen.enabled_by_default in Z2M and enabled last_seen entities. Worked flawlessly.

How did you do it? Do you need to edit HA configuration.yaml?

I’ve enabled from Zigbee2mqtt so it started to report this data. You might have entities already in HA but not enabled yet. So you have to mass enable from entities page.

But I’ve disabled last-seen data completely, it’s spamming DB too much and couldn’t exclude from recorder reliably.

Hello, unfortenately it doesn’t seem to be working for me.

I’m getting a bit crazy at this. For some reason I can get availability but last seen is alway NA on my aquara H1 neutral rockers.

  'xxxxxxxxxxxxxxxxxxxxx':
    friendly_name: Int - Bureau
    homeassistant:
      enabled: true
      last_seen:
    enabled_by_default: true
    availability:
      topic: zigbee2mqtt/bridge/state
      payload_available: online
      payload_not_available: offline

Am I doing it wrong?

Indentation is extremely important in yaml. Move that enabled_by_default: true by 4 spaces to the right, like this:

'xxxxxxxxxxxxxxxxxxxxx':
    friendly_name: Int - Bureau
    homeassistant:
      enabled: true
      last_seen:
        enabled_by_default: true
    availability:
      topic: zigbee2mqtt/bridge/state
      payload_available: online
      payload_not_available: offline

It’s easier now, just have to:

  1. Open Zigbee2MQTT from the sidebar
  2. Click on SETTINGS in Z2M sidebar
  3. Click on SETTINGS in toolbar
  4. Click on ADVANCED
  5. Scroll down to find LAST_SEEN
  6. Choose the reporting attribute (I chose ISO_8601 over ISO_8601_local and epoch)
  7. Restart Z2M (may not be necessary, but always a good practice)

Then go into MQTT and have to enable for each device. I did NOT have to change the device name anywhere, it just appeared.

Hope this helps someone.

2 Likes