I am trying to develop an automation that alerts me to a low battery level on any of my z wave devices, but I am getting some errors after I reload the automation module. Note that the config checker does not result in any errors and the log file does not show any errors from actually loading it, but shows this (multiple times):
I think this might mean that too many messages are trying to go through Join? Will this format of an automation actually work? There are 20 actual devices listed in my config.
I found another thread that helped me simplify this but the notification does not work correctly. Instead of “(Friendly_name of entity) needs new batteries” it says " Low Battery Alert needs new batteries." Anyone have any ideas?
- alias: Low Battery Notification
hide_entity: True
trigger:
- platform: template
value_template: >
{% for zwave in states.zwave if zwave.attributes.battery_level %}
{%- if zwave.attributes.battery_level | int < 60 -%}
{{true}}
{%- endif -%}
{%- endfor -%}
action:
- service: notify.join_name
data_template:
message: >
{{ trigger.to_state.attributes.friendly_name }} needs new batteries.
The automation posted in this topic was helpful, however it was only triggering once and it wasn’t sending the correct entity id in the notifications.
This automation will trigger every day at a certain time and it will send the correct friendly names and current battery levels in the notification.
- alias: 'Low Battery Notification'
trigger:
platform: time
at: '17:30:00'
condition:
condition: template
value_template: >
{%- for zwave in states.zwave if zwave.attributes.battery_level is defined and zwave.attributes.battery_level | int < 25 -%}
{%- if loop.index == 1 -%} {{ True }} {%- endif -%}
{%- endfor -%}
action:
- service: notify.ios_chris_iphone
data_template:
message: >
{%- for zwave in states.zwave if zwave.attributes.battery_level is defined and zwave.attributes.battery_level | int < 25 -%}
The {{zwave.attributes.friendly_name | replace('_', ' ') }} battery is at {{ zwave.attributes.battery_level }}%!{{'\n'}}
{%- endfor -%}
I have a similar config that runs att 06, 12 and 18:00 every day.
Still, When I’m planning to be out of the house for some days, I have also created a group on the frontend showing me all the current battery levels.