From eebd806eff48c9c517c1d45c74367b7ea9d0e077 Mon Sep 17 00:00:00 2001 From: wst-tdb <63517776+wst-tdb@users.noreply.github.com> Date: Sat, 24 Jul 2021 00:37:46 -0400 Subject: [PATCH 1/2] Update battery_alert.yaml Many of my integrations push battery status into device attributes as well as sensors. This adjusts the update_battery_status_group_members to check all entity items for battery_level or battery attributes --- packages/battery_alert.yaml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/battery_alert.yaml b/packages/battery_alert.yaml index 6ca0c03..b0c7245 100644 --- a/packages/battery_alert.yaml +++ b/packages/battery_alert.yaml @@ -193,6 +193,11 @@ ## Added ## - Added Lovelace install instructions :) ## +## 1.3.1 (2020-11-05) by @wst-tdb +## Fixed +## - Changed device detection in group creation to check all devices, +## not just sensors, if they have battery information. +## ################################################################ ################################################################ @@ -816,13 +821,17 @@ automation: data_template: object_id: "battery_status" entities: >- - {%- for item in states.sensor if ( + alertGroup = self.get_state("group.battery_alert", attribute = "all") + {%- for item in states if ( not is_state_attr(item.entity_id, 'hidden', true) + and + not item.entity_id in state_attr("group.battery_alert", "entity_id") and ( is_state_attr(item.entity_id, 'device_class', 'battery') or 'battery' in item.attributes.icon | lower or (item.entity_id | lower).endswith('_bat') or (item.name | lower).endswith('_bat') + or (item.attributes.battery_level or item.attributes.battery) ) or ( ( 'battery' in item.entity_id | lower From a8fc910c5d356d2a2d72dfbf0b5e26f8db6c149a Mon Sep 17 00:00:00 2001 From: wst-tdb <63517776+wst-tdb@users.noreply.github.com> Date: Mon, 26 Jul 2021 02:26:48 -0400 Subject: [PATCH 2/2] Update battery_alert.yaml --- packages/battery_alert.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/battery_alert.yaml b/packages/battery_alert.yaml index b0c7245..b6ed160 100644 --- a/packages/battery_alert.yaml +++ b/packages/battery_alert.yaml @@ -821,7 +821,6 @@ automation: data_template: object_id: "battery_status" entities: >- - alertGroup = self.get_state("group.battery_alert", attribute = "all") {%- for item in states if ( not is_state_attr(item.entity_id, 'hidden', true) and