battery-state-card
battery-state-card copied to clipboard
Battery charging status not working
Describe what is wrong
I do not see a charging indicator on my card.
YAML configuration
- type: custom:battery-state-card
title: Battery Levels
filter:
include:
- name: entity_id
value: "*battery_level*"
tap_action:
action: more-info
charging_state:
attribute: # whenever one of below attributes is matching
- name: "Battery State"
value: "Charging"
- name: "is_charging"
value: true
state: # or if entity state matches one of the following
- "charging"
- "Charging"
color_gradient:
- "#ff0000" # red
- "#ffff00" # yellow
- "#00ff00" # green
Screenshot
Entities (developer tools):
How the card looks:
Version
2.1.0
It looks like it is a bug. When you have the charging attribute specified it doesn't look at the state. I will fix it
Thanks. Worth noting I took that yaml from your examples.
Hello. This doesn't look like it's been fixed. I am using v2.1.1 and I tried all possible combinations in then YAML code. The charging phone does not get the secondary info based on it's state.
It was a while since this issue was reported... TBH I don't know why I haven't noticed this back then when I looked at this issue for the first time.
The reason why this doesn't work for you is that in your case the charging state is in a separate entity. To get it you need to specify that other entity name (it doesn't happen automatically)
https://github.com/maxwroc/battery-state-card#charging-state-object
In the charging_state
section you need to add the entity_id
charging_state:
entity_id: sensor.pixel_6_pro_battery_state
state:
- "charging"
And you don't need the rest of the junk in this section.
Copy-pasting stuff without understanding and trying to adjust it for your case is not always a good idea. It's not possible to provide examples which would work for all of the people.
Hope this helped and your problem is solved.