Shelly for Hass door/window additional sensors?

I have just set up a Shelly Door/window sensor using the Shelly for Hass integration. I only see the open/close binary sensor, but none of the others (battery, tilt, lux etc.). Should they show or are they not supported?

Taking a closer look, I can see all of the attributes in the binary sensor details:


Is there any way that I can expose these attributes as sensors?

Use a template sensor.


I am probably just being stupid, but can’t work out how to access the data from the individual sensors.

In template editor:

{% set battery = states('binary_sensor.shelly_shdw_2_e8db84d52025_door_window.battery') | float %}

The battery level is {{ battery }}.

Always returns zero?

Never mind - figured it!

{% set battery = state_attr('binary_sensor.shelly_shdw_2_e8db84d52025_door_window', 'battery') %}

The battery is {{ battery }}.

More something like:

  - platform: template
        friendly_name: "Shelly Battery"
        unit_of_measurement: '%'
        value_template: "{{ state_attr('binary_sensor.shelly_shdw_2_e8db84d52025_door_window', 'battery') }}"
1 Like

Exactly - thanks!

For completeness sakes (if anyone else finds it useful), the sensor returns the battery level in text format with the β€œ%” already appended. This makes it difficult to use the battery level in an automation. To fix this, and display correctly as a battery level device:

      friendly_name: "Front Door Sensor Battery"
      unit_of_measurement: '%'
      device_class: 'battery'
      value_template: "{{ state_attr('binary_sensor.shelly_shdw_2_e8db84d52025_door_window', 'battery').split(' ')[0] }}"

Same principal can be used for the other sensors - e.g. lux, tilt, vibration.