How to display sensor component event id with its dedicated state (On/Off)?

Hi all,

I would like to access sensor.vibration_sensor_battery_level state from its event_id.

Therefore, I created a template sensor to access event_id.

  • platform: template
    sensors:
    vibration_sensor:
    friendly_name: “Vibration Sensor”
    value_template: “{{ state_attr(‘sensor.vibration_sensor_battery_level’, ‘event_id’) }}”

This have created another sensor component as per below:

But the state shown is vibration_sensor, which does not make sense.

What I can do in order to display state as On (vibration detected) or Off (vibration clear) mentioned in vibration device class of Binary sensor - Home Assistant?

Thanks.

Well first off all; You created a template sensor, but what you want is a template binary_sensor. But I don’t think the battery sensor has the value vibration_detected (yes/no). Does the event_id change when the sensor detects vibrations??

When the sensor detects vibrations, there is no changes of values in event_id.

What are you trying to do then?

It’s a deconz sensor?

Take a look at this: deCONZ: Remote control devices

In short, your sensor has no state, only events. That’s why the battery level has a entity on its own.

I would like to display state (On/Off) of vibration sensor in HA home page.

Yes, it a deCONZ sensor.

If only events, then means cannot display state (On/Off) of vibration sensor in HA home page?

Theres no state to show, only events to react to.

1 Like

Thanks for the info.