Advertisement
dykandDK

HA - YAML- Low Battery Level Alert

Nov 12th, 2020
349
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 0.88 KB | None | 0 0
  1. - id: 'low_battery_alert'
  2.   alias: 'Low battery notification'
  3.   description: 'Low battery notification'
  4.   trigger:
  5.   - platform: time
  6.     at: '20:30:00'
  7.   condition:
  8.   - condition: template
  9.     value_template: '{{ states | selectattr(''attributes.device_class'', ''eq'', ''battery'')
  10.       | selectattr(''state'', ''lt'', ''20'') | map(attribute=''attributes.friendly_name'')
  11.       | list | count > 0 }}'
  12.   action:
  13.   - service: notify.notify
  14.     data_template:
  15.       message: 'En eller flere enheder har lavt batteri:
  16.         {{ states | selectattr(''attributes.device_class'', ''eq'', ''battery'') |
  17.        selectattr(''state'', ''lt'', ''20'') | map(attribute=''attributes.friendly_name'')
  18.         | list | join('', '') | replace(" battery level", "") | replace(" Battery
  19.         Level", "") | replace(", ", "\n") }}
  20.  
  21.         Du bør oplade eller skifte batteriet.'
  22.   mode: single
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement