Is it possible to create sensors for all battery powered devices? I got a tip about this thread but i used to use Script to track all devices with a battery_level but in that thread the author also indicates that it will not be used when he created a PR because they said use templating. So my question would be how can one still do that? Example output that thread would create:
(in all fairness this template does a better job at finding all battery powered devices) would be sweet to have a similar look too. (its better to get a feeling on battery levels by looking at them every now and then to know when the time is getting close to replace them)
No, this won’t create the template sensors for you, but if you do create them, it should automatically alert on them if entity’s name contains battery.
One thing that could be done is to create a single template sensor similar to @tboyce1’s suggestion in Howto create battery alert without creating a template for every device, but make it include all entities that have betteries instead of just ones that are low. This wouldn’t be a clean as your screenshot, but it would give you a single place to look to see current battery status of everything.
It’s probably possible with either an automation, custom component, or python script that runs every so often and creates/updates template sensors for any sensor that has a battery level attribute. I may play around with this when I have some time if nobody comes up with a better solution before then.
If the custom component from the other thread works for what you want, there’s really nothing wrong with just keeping it in your custom components for personal use. You could possibly modify it to pick up the same battery levels as the templates.
I tried this and it is great.
Only got one problem.
I have sensors always reporting battery level 0. They don’t use battery.
Is there a way to not exclude those sensors? Like, set the minimum value to 1?
I have a Fibaro Water Sensor (Vannsensor) and a Fibaro Smoke Sensor in my setup.
Your code shows this (looks like the Smoke Sensor is not present: Maybe battery level ok? ):
And when running “Confirguration - General - Check Config”, error is reported:
2017-12-19 22:28:25 INFO (MainThread) [homeassistant.setup] Setting up updater
2017-12-19 22:28:25 ERROR (MainThread) [homeassistant.config] 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/
2017-12-19 22:28:26 ERROR (MainThread) [homeassistant.config] Invalid config for [automation]: not a valid value for dictionary value @ data[‘condition’][0][‘condition’]. Got None
required key not provided @ data[‘condition’][0][‘entity_id’]. Got None. (See ?, line ?). Please check the docs at https://home-assistant.io/components/automation/
2017-12-19 22:28:26 INFO (MainThread) [homeassistant.setup] Setting up sensor
is the line in your “condition” statements just wrapping due to formatting in drop drop display or did you actually put in a before the word(s) “lower”?
Can you post a sanitized version of your configuration.yaml? The battery_alert.yaml looks fine. I’m wondering if the issue is how the package is being included.
I’m still not seeing anything that could cause that error. Do you have any automations in your automations.yaml? If you remove the package, does your config validate ok?
My automations.yaml is emty. When commenting out packages (#…packages: !include_dir_named packages), the Configuration Validation goes all fine (I am sorry to say)