Very Nice
Like it very much.
Hi,
I have tried you RSSI example, but the card stays empty-
but I have many devices where
include:
- name: attributes.device_class
value: signal_strength
should match
Please update the card. There was a bug introduced in v3.1.1. The v3.1.2 should be working fine
I can’t seem to add any custom setting to this amazing card without having it disappear from the dashboard. I am using the latest 3.1.3 version.
I wanted to add a screenshot of the card showing how it works fine when I don’t change anything from the default definition in YAML, but the forum let’s me only add a single image to a new post, so just believe me the card works fine ‘stock’.
Here is an image once I change anything (e.g. “title” / “collapse” or anything else):
I’ve made sure to do a hard refresh of the page, tried in a couple of past version, to no avail. I cannot seem to edit anything in the card without having it disappear (just to be clear - I am able to edit lots of other custom/template cards).
The display no longer works for me either. Before the update everything worked normally.
type: custom:battery-state-card
title: Thermostate
sort_by_level: desc
color_gradient1:
- ‘#ff0000’
- ‘#ffff00’
- ‘#00ff00’
color_thresholds:- value: 2.4
color: ‘#ff2a00’- value: 2.6
color: ‘#ffff00’- value: 4
color: ‘#00ff00’
bulk_rename:- from: thermostat.
to: ‘’- from: sensor.
to: ‘’- from: OPERATING_VOLTAGE
to: ‘’
unit: V
round: 1
tap_action:
action: more-info
filter:
include:
- name: entity_id
value: climate*
exclude:- name: entity_id
value: climate.bad_og_fussbodenheizung_thermostat
collapse1:- name: ‘Homematic Sensoren (min: {min}V, count: {count})’
secondary_info: Battery levels {range}V
icon: mdi:thermostat
Hi,
I have an issue after last HA update to 2024.1, it seem sort does not work.
This code work:
type: custom:battery-state-card
title: Battery Levels
tap_action: more-info
collapse: 6
entities:
- group.batteries_levels_sensors
filter:
exclude:
- name: state
value: Unknown
operator: '='
- name: state
value: Unavailable
operator: '='
If I add sort operator in many way, but it does not work, and nothing is shown. I tried:
sort: state
sort:
by: state
sort:
- state
Thanks for help.
Marco
In case of any issues you’ve had after v3.1.0 release please try to update the card to the latest v3.1.4. In case of any problems in the newest version please report them via github issues.
Quick question I hope! I have battery stats installed and I’d like to be able to see what batteries are needed in the secondary info.
For some reason though, it just shows
{"entity_id":"sensor.name}
instead of what I’m expecting with the battery type. The guide says “You can use full “path” to the other entity data”. What is a full path and is that where I’m going wrong?
My secondary info line is as follows:
secondary_info: "Batteries required: {sensor.motion_ground_floor_battery_type}"
Im having an issue where the battery icon has the question mark in it when I am casting to my google hub but in browsers and the mobile app the battery icon is showing the proper charge level/statues. What would cause it to not work when casting?
Searched this thread and cant seem to find an answer. Installed the Battery State Card from HACS. Used the default card configuration in a manual card.
Refreshed page and I get the battery entities I expect BUT the battery icons are grey (no colour) and have a question mark inside them. Also, the order is not correct even though I changed to the new format after the breaking change.
I’ve checked the resources and they are fine. Removed and readded multiple times, no difference.
Anyone got a clue why?
Open the browser’s dev tools, reload the page and check for errors.
It looks like it is because of the default HA state formatting. The card expects to have the value where the number is followed by space and then the unit. In your case the unit is together with the value.
This will be fixed in the next release although I’m not sure when exactly it will happen.
Meanwhile please disable state formatting by adding the following to your card config:
default_state_formatting: false
@thearchitectuk The full path needs to contain the entity “property” to display. Since you want to display it’s state you should have the following:
secondary_info: "Batteries required: {sensor.motion_ground_floor_battery_type.state}"
Hey, you might find my config interesting.
That does it, thank you!
Oh this looks really cool. I think I’ll add this to my overview. Thank you!
Maks, you are a genius !! Thanks.
Ok, I’d like to get a Ha for dummies approach to this. I have the battery stats card 2.1.0 installed at the moment. I tried to just upgrade thru HACS, to the newest available version, but after restarting my HA the -whole- lovelace dashboard setup disappeared, and scattered my menus everywhere. And the battery card was empty. I currently have it working, (displaying) although for some reason the battery levels on most devices are frozen, (2.1.0-thank goodness for 2 day backups!)) is there a better install trick I can use, or do I need to change something in a yaml file somewhere to get this going? Thanks!
- Nix that, I got it installed, now things have changed and I need to work on the aesthetics.
It appears possible in the current version (v3.2.0) using ‘| reltime()
’ inside the { }
(disregard the erroneous in 6 hours as that is a UTC timestamp bug in Battery Notes to be fixed in the next release)
type: custom:auto-entities
card:
type: custom:battery-state-card
title: Low Batteries
debug: false
filter:
include:
- integration: battery_notes
domain: sensor
attributes:
device_class: battery
state: <= 60
options:
name: '{attributes.friendly_name} ({attributes.battery_type_and_quantity})'
secondary_info: 'Last reported: {attributes.battery_last_reported|reltime()}'
exclude:
- integration: mobile_app
sort:
method: state
numeric: true
I’ve been battling this for days and no success. I’d like to use config-template-card either as a wrapper around battery-state-card or inside of it to template variables for a tap action service call inside battery-state-card like what I found in another topic using the tile card and have tweaked for use with Battery Notes.
type: custom:auto-entities
card:
type: vertical-stack
card_param: cards
filter:
exclude:
- state: unavailable
- entity_id: binary_sensor.*
- entity_id: '*.battery_charge'
- hidden_by: integration
include:
- attributes:
device_class: battery
options:
type: custom:config-template-card
entities:
- this.entity_id
variables:
getBatteryLabel: |
() => {
let battery_label = states[this._config.entities[0]].attributes.friendly_name.replace(/(battery|level)/gi, '').trim()
let battery_type = states[this._config.entities[0]].attributes.battery_type_and_quantity
if (battery_type) {
return `${battery_label} (${battery_type})`
}
return battery_label
}
getIconAction: |
() => {
let battery_button = states['button.' + this._config.entities[0].replace(/_plus/gi, '_replaced').split('.')[1]]
let ret = {'action': 'more-info'}
if (battery_button) {
ret.action = 'call-service'
ret.confirmation = {'text': 'Battery replaced?'}
ret.data = {'entity_id': battery_button.entity_id}
ret.service = 'button.press'
}
return ret
}
card:
type: tile
entity: this.entity_id
icon_tap_action: ${getIconAction()}
name: ${getBatteryLabel()}
sort:
method: name
sort:
method: state
numeric: true
This code displays but is not templated (i.e. tap action doesn’t work):
type: custom:auto-entities
card:
type: custom:battery-state-card
card_param: entities
filter:
exclude:
- state: unavailable
- entity_id: binary_sensor.*
- entity_id: '*.battery_charge'
- hidden_by: integration
include:
- attributes:
device_class: battery
integration: battery_notes
state: < 60
options:
type: custom:config-template-card
entities:
- this.entity_id
variables:
getBatteryLabel: |
() => {
let battery_label = states[this._config.entities[0]].attributes.friendly_name.replace(/(battery|level)/gi, '').trim()
let battery_type = states[this._config.entities[0]].attributes.battery_type_and_quantity
if (battery_type) {
return `${battery_label} (${battery_type})`
}
return battery_label
}
getIconAction: |
() => {
let battery_button = states['button.' + this._config.entities[0].replace(/_plus/gi, '_replaced').split('.')[1]]
let ret = {'action': 'more-info'}
if (battery_button) {
ret.action = 'call-service'
ret.service_data = {'entity_id': battery_button.entity_id}
ret.service = 'button.press'
}
return ret
}
card:
entity: this.entity_id
tap_action: ${getIconAction()}
name: ${getBatteryLabel()}
sort:
method: name
sort:
method: state
numeric: true