Advertisement
yurghie

toggle charger

Apr 11th, 2024
750
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 0.44 KB | None | 0 0
  1. automation:
  2.   - alias: S21U toggle charger
  3.     trigger:
  4.       - platform: state
  5.         entity_id: sensor.s21u_battery_level
  6.       - platform: homeassistant
  7.         event: start
  8.     condition: "{{states('sensor.s21u_battery_level')|int(0)<=20 or states('sensor.s21u_battery_level')|int(0) >= 80}}"
  9.     action:
  10.       service: "switch.turn_{{'off' if states('sensor.s21u_battery_level')|int(0)>=80 else 'on'}}"
  11.       entity_id: switch.s21u_charger
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement