andrey-git / home-assistant-custom-ui

Custom UI elements for https://home-assistant.io
https://home-assistant.io
MIT License
526 stars 97 forks source link

Badges: specify attribute and unit from separate entity #140

Open coreyo opened 6 years ago

coreyo commented 6 years ago

From the short documentation on the 'extra_badge' parameter, it seems that the 'entity_id' sub-parameter causes the 'attribute' and 'unit' sub-parameter values to be ignored. This seems to be the case when I use the following:

lock.office_deadbolt_locked:
  custom_ui_state_card: state-card-custom-ui
  extra_data_template: 
    - "Battery: ${entities['zwave.office_french_doors_deadbolt'].attributes.battery_level}%"
    - "Last Opened: ${attributes.notification}"
  extra_badge:
    - entity_id: zwave.office_deadbolt
      attribute: battery_level
      unit: "%"

This configuration seems to produce a badge that simply says "ready".

The 'extra_data_template' directives seem to be working as expected. Because the actual lock and deadbolt meta-info show up in different entities, It would be nice if I could specify an arbitrary attribute of an arbitrary entity with an arbitrary unit. Is this possible now? Is there another option? Thanks in advance for any advice or extra features.