Hey community,
I’m currently working on a dashboard and want to show some chips there for critical states of devices (e.g. windows open/lights on/batteries of devices empty).
This is the frontend coding for it:
- type: custom:mushroom-chips-card
chips:
- type: conditional
conditions:
- entity: binary_sensor.helfer_leere_akkus
state: 'on'
chip:
type: entity
entity: sensor.helfer_anzahl_leerer_akkus
icon_color: red
tap_action:
action: fire-dom-event
browser_mod:
service: browser_mod.popup
data:
title: Akkus austauschen/laden
content:
type: custom:auto-entities
filter:
include:
- domain: sensor
attributes:
device_class: battery
state: "<= 25"
show_empty: false
card:
type: entities
alignment: center
The popup is working well, the auto-entities is showing the correct entities. But unfortunately the helper-sensor for showing the number of empty batteries is not working.
This is the template for the helper entity:
{{ states.sensor | selectattr('attributes.device_class', 'eq', 'battery') | selectattr('state', 'lt', '25') | list | count }}
If I remove the count it shows the following list:
[<template TemplateState(<state sensor.nicole_smartphone_battery_level=100; unit_of_measurement=%, device_class=battery, icon=mdi:battery, friendly_name=Nicoles Smartphone @ 2023-11-14T21:45:49.134681+01:00>)>]
That makes absolutly no sense for me, since the state of the device is “100”. Why is it showing up? If I replace the “lt” in the template with “gt”, it’s showing up all devices with full battery, but not this one anymore. How is that working?
Thanks for your advice.
BR