maxwroc/battery-state-card

Wrong values shown for sensors with multiply attributes

programmdesign opened this issue · 1 comments

Describe what is wrong

  • I'm using filters, e.g., to get all device temperatures automatically into one card
  • The sensors / entities I'm filtering usually have several attributes (temperature, humidity, device temperature, etc.).
  • For some entities, the battery state card plugin shows wrong values in the card.
  • Instead of taking the device temperature it shows for example the battery value.
  • If I click on the output of the state card to see more details, I see the correct values though.
  • I've tried to also specify the attribute of the sensor, w/o any luck.

Is there anything I'm missing in terms of the settings or is this maybe a potential bug? Thanks for any help!

YAML configuration

type: custom:battery-state-card
title: Sensortemperatur
icon: mdi:thermometer
color_thresholds:
  - value: 25
    color: green
  - value: 35
    color: yellow
  - value: 100
    color: red
tap_action:
  action: more-info
sort_by_level: desc
unit: °C
round: 1
filter:
  include:
    - name: entity_id
      value: sensor.*_device_temperature
  exclude:
    - name: state
      value: 25
      operator: <=

Screenshot

Output from battery state card
image

Pop-Up, when I click on the output from the battery state card
image

Output from Entity Card for the exact same entity
image

Exposed value of the sensor / entity
image

Version
2.1.1

It's because this card was mainly designed for showing battery state. It automatically takes "battery" attribute value if such exists. If all your devices have the same attributes you can add the attribute: device_temperature (at the "unit" level) e.g.:

type: custom:battery-state-card
title: Sensortemperatur
icon: mdi:thermometer
color_thresholds:
  - value: 25
    color: green
  - value: 35
    color: yellow
  - value: 100
    color: red
tap_action:
  action: more-info
sort_by_level: desc
unit: °C
attribute: device_temperature
round: 1
filter:
  include:
    - name: entity_id
      value: sensor.*_device_temperature
  exclude:
    - name: state
      value: 25
      operator: <=