metbril
(Robert 🇳🇱🇪🇺)
January 16, 2020, 5:09pm
28
Nice! Out of curiously. The big batteries group topic uses an automation to periodically (or at startup) populate a group. Wouldn’t that be an options for those who REALLY want those groups back?
Edit May 14th, 2019: The latest code and instructions are available on GitHub at:
Original post:
I have many battery powered devices that have various methods to track battery level. Some of my devices have a separate entity that just represents battery while most of them have a battery_level attribute. To make it even more complex, I have some devices that report an 0-100 integer and others that use strings (Low, Medium, Full, etc.).
I’ve been wanting a way to identify any batteries that…
{%- set attribval = trigger.event.data.new_state.attributes.battery_critical -%}
{%- set attribname = 'battery_critical' -%}
{%- endif -%}
"entity_id": "{{ trigger.event.data.entity_id }}",
{% if attribname is defined -%}
"{{ attribname }}": "{{ attribval }}",
{%- endif %}
"delete_battery_sensor": "homeassistant/sensor/{{ trigger.event.data.entity_id.split('.')[1] }}_battery"
}
- alias: update_battery_status_group_members
initial_state: 'on'
trigger:
- platform: time_pattern
minutes: '/1'
seconds: 00
action:
- service: group.set
data_template:
object_id: "battery_status"
entities: >-