maxwroc / battery-state-card

Battery state card for Home Assistant
MIT License
848 stars 38 forks source link

How can I show battery level and pass info is charging in same device with two different entities #712

Closed polpas closed 6 months ago

polpas commented 6 months ago

I have a device roomba.

I can get battery level through entity sensor.irobot_bateria. But I need to pass a secondary info when the device is docked that is charging. How can I do it?

maxwroc commented 6 months ago

Without having the entity data I won't be able to help

polpas commented 6 months ago

I can get entity vacuum.irobot whith value docked - it means that is charging I can get sensor.robot.bateria that show battery level.

What I wanted to do is if sensor.robot_bateria is is less than 100% and vacuum.irobot is docked I wanted to pass the text is charging with the battery level displayed as in normal template

maxwroc commented 6 months ago

https://github.com/maxwroc/battery-state-card#secondary-info

https://github.com/maxwroc/battery-state-card?tab=readme-ov-file#charging-state-indicators

polpas commented 6 months ago

Yes I followed your templates but I cant get it right.

sensor.idalina_bateria is returning the level of bateria vacuum.idalina is returning the value docked

vacuum-idalina sensor idalina

I wanted to pass secondary text if value is docked.

Captura de ecrã 2024-03-11, às 12 38 28
maxwroc commented 6 months ago

This is almost right: image

Although you're telling the card that the "charging state" can be found in the attribute "is_charging" of the same entity.

If you take a look at the "charging_state" object/config you can specify entity ID where the charging state should be searched for.

So sth like the following:

charging_state: # uses other entity state value
  entity_id: vacuum.xxxx
  state: "docked"
polpas commented 6 months ago

Ok I'm getting there however In two different devices I have two different behaviors:

in iPhone Francisco I have the text charging but in iRobot device even the symbol charging appear the text does not how come?

Captura de ecrã 2024-03-11, às 13 47 55
polpas commented 6 months ago

secondary info was passing docked instead of charging