benct / lovelace-battery-entity-row Goto Github PK
View Code? Open in Web Editor NEWShow battery states or attributes with dynamic icon on entity rows in Home Assistant's Lovelace UI
License: MIT License
Show battery states or attributes with dynamic icon on entity rows in Home Assistant's Lovelace UI
License: MIT License
This would be an excellent complement to the auto-entities card for all batteries within the HA system.
There are BinarySensors with device_state: battery available...
default state, when the battery is OK -> is OFF
When the battery becomes empty, the state will switch to ON
Unfortunately it seems, the battery-entity-row does not support binary sensors
This is how the battery looks like in a regular entity card:
And this, when I apply the battery-entity-row:
I would really appreciate if the entity-row would support these binary sensors, since I have a lot of them that should be included into one card - and I would really like to have the color-indication for their state.
I am aware of the fact, that these sensors could only be green & red - nothing in between :)
Hi
I need reload UI to see charging ststus icon change.
I see in Developers tool that the value was changed but it does not change (charging icon) on dashboard
entity: sensor.wall_panel_2_battery_level
charging:
attribute: charging
state:
- "True"
tested also with separate charging sensor entity defined
entity: sensor.wall_panel_2_battery_level
charging:
entity: sensor.wall_panel_2_battery_charging_state
state:
- "True"
HA: 2021.1.4
Hello,
First, thank you for this card!
In the latest release 2020.12.x
, HA made a breaking change in the way it works with dates. Due to this change, the last-changed
variable no longer works for secondary-info
attribute.
For example:
- type: 'custom:battery-entity-row'
entity: sensor.parlor_motion_st_battery
name: Parlor Motion
unit: '%'
secondary_info: last-changed
warning: 50
critical: 25
Will result in
In a nushell, you need to use a timestamp value, instead of a duration in seconds value. Is this something the card controls or is the 'last-changed' property from the sensor?
As a follow-up to #4 , some entities are a bit different and require a bit more than the boolean .
Two examples of this that I have are my iOS App devices, and my vacuum (Roomba).
Vacuum:
By default, it's using these attributes (example):
battery_level: 100
battery_icon: 'mdi:battery-charging-100'
status: Charging
The main thing here is that the status could also indicate other things than just the battery status, ie stopped, running, etc
The other is the iOS devices, using the official iOS app. These have a battery state sensor, for example: sensor.my_iphone_battery_state
where it has the actual state being either Charging
or Not Charging
. This sensor also has some other attributes, such as the below:
Battery Level: 20
Low Power Mode: false
friendly_name: My iPhone Battery State
icon: 'mdi:battery'
device_class: battery
Further to that, the sensor which is actually used in the battery entity card is the sensor.my_iphone_battery_level
. This has an attribute called Battery State:
which seems to be referencing the battery state sensor. Attribute example:
Battery State: Charging
Low Power Mode: false
unit_of_measurement: '%'
friendly_name: My iPhone Battery Level
icon: 'mdi:battery-charging-20'
device_class: battery
Most of this can be found in the HA Companion Documentation, and more specifically, the Battery Sensors
Avoid unnecessary re-rendering.
Can it work with multiple-entity-row for at least the main entity?
I would Iike to use your card with Auto Entities card but it says that a entity must be provided. The purpose of the auto entities is to provide the entity_id to various cards. Can this be added to your feature list?
I noticed that items which are charging do not show the charging icon as it does with the standard icon.
Could this be added?
Additionally, to add the battery state as secondary info (charging / not charging). Although Iโd say the icon has priority.
HA: 2021.2.3
Theme: yourname
I built up this for my batteries:
type: 'custom:auto-entities'
card:
type: entities
sort:
method: state
numeric: true
filter:
exclude:
- entity_id: '*mobil*'
- entity_id: '*h8*'
- entity_id: '*life360*'
- entity_id: '*netatmo*'
- entity_id: binary_sensor.*
- state: '> 50'
include:
- entity_id: '*_battery'
options:
type: 'custom:battery-entity-row'
warning: 50
critical: 25
charging: true
- entity_id: '*_battery_level'
options:
type: 'custom:battery-entity-row'
warning: 50
critical: 25
charging: true
- entity_id: '*_batteriniveau'
options:
type: 'custom:battery-entity-row'
warning: 50
critical: 25
charging: true
- entity_id: '*_battery_charge'
options:
type: 'custom:battery-entity-row'
warning: 50
critical: 25
charging: true
And it works for the most part, except tht the 'critical' doesn't show:
Hi, I've got a few battery powered devices I monitor, where the unit is: normal or low
When using your battery-entity-row, what unit should I be using for these devices?
Defaulting to % is great, in most cases, for these devices, it just shows 0%, when in-fact the state is actually normal. I've tried "unit: " & "unit: string" but not getting the result I'd expect. Are their more options for unit than "%"?
cheers
I have a battery sensor that is a voltage, not a percentage, and want to show "2.65" for example, and compare to that. It is truncated/turned into an int, so it is always shown as "2". can't see a way to change that.
The ask is to handle float values for non-percent, including comparisons to critical etc.
Example desired config:
- type: custom:battery-entity-row
entity: sensor.smartweather_battery
name: Smartweather Battery
unit: volts
warning: 2.5
critical: 1.95
thanks for considering!
Hi
I have the following configuration.
type: 'custom:auto-entities'
card:
type: entities
title: Windows
filter:
include:
- entity_id: binary_sensor.*_window
options:
type: 'custom:battery-entity-row'
warning: 85
critical: 83
secondary_info: last_updated
sort:
method: attribute
attribute: battery_level
Each entity has these attributes:
How can I get the display like this:
Thank you.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.