Access properties of a binary sensor

I recently setup a Eufy HomeBase 3. The integration creates properties under a binary sensor. Some of them are at the “top level” and are things like:

  • model
  • name
  • softwareVersion

While others are nested under an item like storageinfoHdd, which has sub-properties like

  • disk_size
  • disk_used

My templating/accessing variables skills are still pretty rough, so any advice on how to access this informaton would be greatly appreciated.

TIA

It would make it easier for us to help, if you share a screenshot of the entity’s state data from the States tool so we can see the structure.

That’s a bit weird - yes you need to post a screenshot from Developer Tools | States like @Didgeridrew suggested…

Hopefully this helps. I can’t fit it all in one screen short and I blurred out specific values.


In developer tools → template, try these out:

{{ state_attr('binary_sensor.home_base_debug_station', 'model') }}

{{ state_attr('binary_sensor.home_base_debug_station', 'storageInfoHdd').serial_number }}

{{ state_attr('binary_sensor.home_base_debug_station', 'storageInfoHdd')['serial_number'] }}

{% set storage_info = state_attr('binary_sensor.home_base_debug_station', 'storageInfoHdd') %}
{{ storage_info.serial_number }}

Fist one comes backup “none”
Second one comes back "None’ has no attribute ‘serial_number’
Thrid one comes back ‘None’ has no attribute ‘serial_number’
Fourth one comes back ‘None’ has not attribute ‘serial_number’

Thanks for trying.

It’s hard to tell from the formatting of the attributes. Perhaps they are all under the key “properties”.

{{ state_attr('binary_sensor.home_base_debug_station', 'properties') }}
{{ state_attr('binary_sensor.home_base_debug_station', 'properties').name }}
{{ state_attr('binary_sensor.home_base_debug_station', 'properties').model }}

etc...

And maybe:

{{ state_attr('binary_sensor.home_base_debug_station', 'properties').storageInfoHdd.serial_number }}

It’s hard to tell the hierarchy because you split the screen shot.

Paste the result of:

{{ state_attr('binary_sensor.home_base_debug_station', 'properties') }}

@zoogara

state_attr('binary_sensor.home_base_debug_station', 'properties').storageInfoHdd.disk_used }}

Works perfectly. Thank you for getting me on the right path.