notoriousbdg / home-assistantconfig Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
Hi,
Thanks for this great package. Gives great insights on all of my battery powered devices!
I added information of my car to Home Assistant which also has some battery info which is irrelevant to be notified about. So I looked up the battery_alert_disabled: true customization, but I still receive notifications on the notify.notify notifier.
Example of my customize.yaml:
sensor.last_trip_average_electric_consumption:
battery_alert_disabled: 'true'
Thanks for your help!
When trying to create an automation i keep receiving this error:
The yaml code for this automatisation is:
`alias: Telenet Test pauze
description: ""
trigger:
Can anyone help me with this please?
Thanks in advance!
a couple of warnings in 2022.2.9 (and previous 2022.x versions)
2022-02-27 18:00:00 WARNING (MainThread) [homeassistant.helpers.template] Template warning: 'int' got invalid input 'unknown' when rendering template '{% macro battery_level() %} {% for entity_id in states.group.battery_status.attributes.entity_id if (
not (
is_state_attr(entity_id, 'battery_alert_disabled', true)
or is_state_attr(entity_id, 'restored', true)
)
and states(entity_id) is not none
and (
(
(
states(entity_id) is number
or states(entity_id) | length == states(entity_id)| int | string | length
or states(entity_id) | length == states(entity_id)| float | string | length
)
and states(entity_id) | int < states.input_number.battery_alert_threshold_max.state | int
and states(entity_id) | int > states.input_number.battery_alert_threshold_min.state | int
)
or states(entity_id) | lower == 'low'
or states(entity_id) | lower == 'unknown'
or states(entity_id) | lower == 'unavailable'
)
) -%}
{{ state_attr(entity_id, "friendly_name") }} ({{ states(entity_id) }})
{% endfor -%} {% endmacro %} {{ battery_level() }}' but no default was specified. Currently 'int' will return '0', however this template will fail to render in Home Assistant core 2022.1
2022-02-27 18:00:00 WARNING (MainThread) [homeassistant.helpers.template] Template warning: 'float' got invalid input 'unknown' when rendering template '{% macro battery_level() %} {% for entity_id in states.group.battery_status.attributes.entity_id if (
not (
is_state_attr(entity_id, 'battery_alert_disabled', true)
or is_state_attr(entity_id, 'restored', true)
)
and states(entity_id) is not none
and (
(
(
states(entity_id) is number
or states(entity_id) | length == states(entity_id)| int | string | length
or states(entity_id) | length == states(entity_id)| float | string | length
)
and states(entity_id) | int < states.input_number.battery_alert_threshold_max.state | int
and states(entity_id) | int > states.input_number.battery_alert_threshold_min.state | int
)
or states(entity_id) | lower == 'low'
or states(entity_id) | lower == 'unknown'
or states(entity_id) | lower == 'unavailable'
)
) -%}
{{ state_attr(entity_id, "friendly_name") }} ({{ states(entity_id) }})
{% endfor -%} {% endmacro %} {{ battery_level() }}' but no default was specified. Currently 'float' will return '0', however this template will fail to render in Home Assistant core 2022.1
there are also a couple of errors
2022-02-27 17:58:00 ERROR (MainThread) [homeassistant.components.automation.update_battery_status_group_members] update_battery_status_group_members: Error executing script. Invalid data for call_service at pos 1: Entity ID is an invalid entity ID for dictionary value @ data['entities']
2022-02-27 17:58:00 ERROR (MainThread) [homeassistant.components.automation.update_battery_status_group_members] Error while executing automation automation.update_battery_status_group_members: Entity ID is an invalid entity ID for dictionary value @ data['entities']
this is with the fixes in pull request #33 added.
I have 2 tradfri remote.
1 Wireless dimmer
2 Remote control
The battery sensor for the remote control is created and showing up. The battery for for the wireless dimmer is not showing up.
The Wireless dimmer is in the entity list of home assistant
'''
sensor.tradfri_wireless_dimmer | 87 | battery_level: 87 model_number: TRADFRI wireless dimmer power_source: Battery manufacturer: IKEA of Sweden firmware_version: 1.2.248 serial: friendly_name: TRADFRI wireless dimmer unit_of_measurement: % |
---|
'''
Can you color the status off the battery level like https://bonani.tech/track-battery-levels-with-home-assistant-and-custom-ui/
Thanks for helping and your great work
Hi,
Following the configuration instructions for battery_alert package can't get passed the error after adding the packages section in config.yaml
Regards.
I have a device using zanzitto to publish the battery info, the device isn't often used resulting in a value 'unknown'.
HA constantly shows Tablet Battery (Unknown), is there a way to filter out the 'unknown' value from the notification message?
Hi,
Anyone noticed issues since the upgrade to home-assistant 0.87 with errors like the following:
ERROR (MainThread) [homeassistant.components.automation] Error while executing automation automation.update_battery_status_group_members. Invalid data for call_service at pos 1: Entity ID is an invalid entity id for dictionary value @ data['entities']
None of the previous auto-created sensor.battery_* are created show up in the battery status panel.
I wonder if it's something to do with the new entity registry?
MQTT broker still seems to be publishing correct information...
David
First, thanks for the package, very well done and useful.
My ios phones defined are coming with a "sensor.xxxxx_battery_level" sensor which is well detected by "automation.update_battery_status_group_members". On the other hand, I want to filter them out and they are not.
I think this is because the following condition " not is_state_attr(entity_id, 'battery_alert_disabled', true)" should apply to any item and not only to the ones with battery in their name. Indeed ios phones objects have a battery icon and are therefore matching
the condition "or 'battery' in item.attributes.icon | lower"
I aso think " not is_state_attr(entity_id, 'battery_alert_disabled', true)" should in fact test item.entity_id.
A plant (https://www.home-assistant.io/integrations/plant/) entity will falsely trigger the creation of a battery entity from attribute. Please exclude, by design a battery entity must exist that feeds into the plant entity.
Would have created a PR but wasn't sure how to check for entity type.
Example:
"plant.gruenlilie":
problem: 'moisture low, conductivity low'
sensors:
moisture: sensor.gruenlilie_moisture
battery: sensor.gruenlilie_battery
temperature: sensor.gruenlilie_temperature
conductivity: sensor.gruenlilie_conductivity
brightness: sensor.gruenlilie_light
unit_of_measurement_dict:
brightness: lux
temperature: °C
moisture: '%'
conductivity: µS/cm
battery: '%'
moisture: 3
battery: 95
temperature: 20.9
conductivity: 11
brightness: 76
max_brightness: 76
friendly_name: Grünlilie
Logger: homeassistant.components.hassio
Source: components/hassio/init.py:420
Integration: Hass.io (documentation, issues)
First occurred: 22:45:00 (1 occurrences)
Last logged: 22:45:00
expected a dictionary for dictionary value @ data['packages']['automation']
version | core-2021.2.3 |
---|---|
installation_type | Home Assistant OS |
dev | false |
hassio | true |
docker | true |
virtualenv | false |
python_version | 3.8.7 |
os_name | Linux |
os_version | 5.4.83-v7 |
arch | armv7l |
timezone | Europe/Kiev |
GitHub API | ok |
---|---|
Github API Calls Remaining | 4997 |
Installed Version | 1.11.2 |
Stage | running |
Available Repositories | 746 |
Installed Repositories | 5 |
host_os | Home Assistant OS 5.11 |
---|---|
update_channel | stable |
supervisor_version | supervisor-2021.02.6 |
docker_version | 19.03.13 |
disk_total | 28.6 GB |
disk_used | 9.7 GB |
healthy | true |
supported | true |
board | rpi3 |
supervisor_api | ok |
version_api | ok |
installed_addons | Samba share (9.3.0), File editor (5.2.0), Home Assistant Google Drive Backup (0.103.1), InfluxDB (4.0.3), Grafana (6.1.1), ESPHome (1.16.0), Mosquitto broker (5.1), MariaDB (2.2.1), ADB - Android Debug Bridge (0.7.0), phpMyAdmin (0.2.0), Terminal & SSH (9.0.1) |
dashboards | 2 |
---|---|
resources | 14 |
views | 11 |
mode | yaml |
Sometime i will receive this error in the log:
2020-01-04 05:00:00 INFO (MainThread) [homeassistant.helpers.script] Script battery_persistent_notification_clear: Test condition template: False
2020-01-04 05:15:00 ERROR (MainThread) [homeassistant.helpers.condition] Error during template condition: UndefinedError: 'None' has no attribute 'attributes'
2020-01-04 05:15:00 INFO (MainThread) [homeassistant.helpers.script] Script battery_persistent_notification_clear: Test condition template: False
2020-01-04 05:30:00 ERROR (MainThread) [homeassistant.helpers.condition] Error during template condition: UndefinedError: 'None' has no attribute 'attributes'
2020-01-04 05:30:00 INFO (MainThread) [homeassistant.helpers.script] Script battery_persistent_notification_clear: Test condition template: False
2020-01-04 05:45:00 ERROR (MainThread) [homeassistant.helpers.condition] Error during template condition: UndefinedError: 'None' has no attribute 'attributes'
2020-01-04 05:45:00 INFO (MainThread) [homeassistant.helpers.script] Script battery_persistent_notification_clear: Test condition template: False
2020-01-04 06:00:00 ERROR (MainThread) [homeassistant.helpers.condition] Error during template condition: UndefinedError: 'None' has no attribute 'attributes'
2020-01-04 06:00:00 INFO (MainThread) [homeassistant.helpers.script] Script battery_persistent_notification: Test condition template: False
2020-01-04 06:00:00 ERROR (MainThread) [homeassistant.helpers.condition] Error during template condition: UndefinedError: 'None' has no attribute 'attributes'
There is a way to solve the problem?
I have update to version 1.11 and now I have trouble with battery sensor created from device_trackers:
homeassistant.exceptions.InvalidStateError: Invalid state encountered for entity id: sensor.philippe_smartphone_battery. State max length is 255 characters.
2018-08-23 19:46:33 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 282, in async_update_ha_state
self.entity_id, state, attr, self.force_update, context)
File "/usr/local/lib/python3.6/site-packages/homeassistant/core.py", line 853, in async_set
context)
File "/usr/local/lib/python3.6/site-packages/homeassistant/core.py", line 623, in __init__
"State max length is 255 characters.").format(entity_id))
homeassistant.exceptions.InvalidStateError: Invalid state encountered for entity id: sensor.philippe_smartphone_battery. State max length is 255 characters.
MQTT info:
homeassistant/sensor/philippe_smartphone_battery/config {
"device_class": "battery",
"name": "Philippe Smartphone Battery",
"state_topic": "homeassistant/sensor/philippe_smartphone_battery/state",
"unit_of_measurement": "%",
"value_template": "{{ value_json.value | int }}",
"unique_id": "philippe_smartphone_battery",
"json_attributes": [
"entity_id",
"attribute",
"mqtt_config_topic",
"mqtt_state_topic"
]
}
homeassistant/sensor/philippe_smartphone_battery/state {
"value":47,
"entity_id": "device_tracker.philippe_smartphone",
"attribute": "battery",
"mqtt_config_topic": "homeassistant/sensor/philippe_smartphone_battery/config",
"mqtt_state_topic": "homeassistant/sensor/philippe_smartphone_battery/state"
}
Hey guys
I still have this package installed in my HA 2021.6.6
I can see that it was updated not so long ago, so I hope that it's still working.
I have two 'MQTT alarmpanel' by ThanksMister installed.
They, like the Wallpanel by ThanksMister, integrate to HA with MQTT.
Looking in MQTT with MQTT Explorer, I see this entry for one of the panels:
So for me that looks good.
But I don't see a battery entry created in HA.
I have the
configuration.yaml
mqtt: !include mqtt.yaml
mqtt.yaml:
discovery: true
discovery_prefix: homeassistant
What have I missed?
With the release of HA 0.86 Lovelace will be the default. By default there's no way of showing all the items in a group.
Having an automation to update a view might be one option or an example Lovelace card.
Hello,
I'm using your package for a while now. Today i've updated to the lastest version and getting errors like the one below.
Any idea how to handle?:
Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 313, in async_update_ha_state self.entity_id, state, attr, self.force_update, self._context) File "/usr/local/lib/python3.6/site-packages/homeassistant/core.py", line 853, in async_set context) File "/usr/local/lib/python3.6/site-packages/homeassistant/core.py", line 623, in __init__ "State max length is 255 characters.").format(entity_id)) homeassistant.exceptions.InvalidStateError: Invalid state encountered for entity id: sensor.fibaro_system_fgms001_motion_sensor_battery_2. State max length is 255 characters.
Neo CoolCam Battery Powered PIR Sensor Luminance (22.0)
This shows up when i set my "Max" over 22. Seems like it reacts to "Battery" in the name of the node?
The HA log get's spammed with the following error after enabling this package:
WARNING (MainThread) [homeassistant.components.automation.battery_sensor_from_attributes] battery_sensor_from_attributes: Already running
I think this is due to the new automation running mode feature in HA > 0.113 -> https://www.home-assistant.io/blog/2020/07/22/release-113/#automations--scripts-running-modes
I currently use HA 2021.1.5.
First of all, very convenient addon to use!
I have a lot of similar entities for which I don't want an entity being created. Usage of wildcards or regular expressions would really help with that instead of keeping a long list. Especially with zigbee2mqtt where every battery operated device has a status, link quality and battery level entity where I get 3x a battery per device.. Excluding everything with link quality and status would really help!
The following warning appears (many times) under 2021.10, and says that the template will no longer work under 2021.12:
Template warning: 'float' got invalid input 'Not Charging' when rendering template '{% macro battery_level() %} {% for entity_id in states.group.battery_status.attributes.entity_id if ( not is_state_attr(entity_id, 'battery_alert_disabled', true) and states(entity_id) is not none and ( ( ( states(entity_id) is number or states(entity_id) | length == states(entity_id)| int | string | length or states(entity_id) | length == states(entity_id)| float | string | length ) and states(entity_id) | int < states.input_number.battery_alert_threshold_max.state | int and states(entity_id) | int > states.input_number.battery_alert_threshold_min.state | int ) or states(entity_id) | lower == 'low' or states(entity_id) | lower == 'unknown' or states(entity_id) | lower == 'unavailable' ) ) -%} {{ state_attr(entity_id, "friendly_name") }} ({{ states(entity_id) }}) {% endfor -%} {% endmacro %} {{ battery_level() | trim == "" }}' but no default was specified. Currently 'float' will return '0', however this template will fail to render in Home Assistant core 2021.12
Check out breaking changes for 0.107 https://www.home-assistant.io/blog/2020/03/18/release-107/ and the note related to Groups. Because the battery_alert package uses group.set, it's having some issues with this new release because that service no longer exists - at least, not with that name.
Not sure how to fix, but wanted to report the issue.
Error returned by HA is "Unable to find service group/set."
2021-04-09 13:17:00 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'mappingproxy object' has no attribute 'icon' when rendering '{%- for item in states.sensor if (.....
Warning is created in the update_battery_status_group_members
automation
After using the latest version of both your package and hassio i get this error:
expected dict for dictionary value @ data['packages']['battery_alert']['retain']
Any idea on this?
First: awesome work, it's the best battery alert solution I found on the internet.
My issue: I have a bunch of Homematic IP Devices with Battery Info.
At the Moment, all of them report "Normal" as state, but no integer that's why I believe they are not recognized by the script and hidden in the UI
And I think they won't trigger an alert.
How could I solve this?
After updating the system to 0.96.2, the battery group is gone. Batteries are no longer automatically grouped together. I have just deleted all the entries and no battery is being created automatically as well
Hi,
I tried to copy and paste your package file in my HA but when I tried to check it a lot of errors comes out.
Is something that I have to change inside the battery_alert.yaml file ?
tnx
Home assistant version 0.88.1.
Invalid config for [automation]: required key not provided @ data['action']. Got None required key not provided @ data['trigger']. Got None. (See ?, line ?). Please check the docs at https://home-assistant.io/components/automation/
How repair it?
Some recent changes in HA and this custom script causing the following issue in the logs:
configuration variable "json_attributes" is deprecated, replace with "json_attributes_topic"
More information:
home-assistant/core#19223
Code probably causing the issue:
https://github.com/notoriousbdg/Home-AssistantConfig/blob/master/packages/battery_alert.yaml#L583
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.