Guest User

Untitled

a guest
Mar 10th, 2021
37
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. - alias: Accensione Presa USB
  2. trigger:
  3. - platform: template
  4. value_template: "{{ states('sensor.time') == states('input_datetime.multi1_usb_on')[:5] or states('sensor.time') == states('input_datetime.multi1_usb_off')[:5]}}"
  5. condition:
  6. condition: and
  7. conditions:
  8. - condition: template
  9. value_template: "{{ (states('input_datetime.multi1_usb_on')[:5]) != '00:00' and (states('input_datetime.multi1_usb_off')[:5]) != '00:00' }}"
  10. - condition: state
  11. entity_id: 'input_boolean.att_progr_presa'
  12. state: 'on'
  13. action:
  14. - service: >
  15. {% if states('sensor.time') == states('input_datetime.multi1_usb_on')[:5] %}
  16. switch.turn_off
  17. {% elif states('sensor.time') == states('input_datetime.multi1_usb_off')[:5] %}
  18. switch.turn_on
  19. {% endif %}
  20. entity_id: switch.multi1_presa_usb
  21. - service: >
  22. {% if states('sensor.time') == states('input_datetime.multi1_usb_off')[:5] %}
  23. switch.turn_on
  24. {% endif %}
  25. entity_id: switch.multi1_presa_usb
  26. - service: notify.telegram
  27. data_template:
  28. title: '*-- Multipresa Wi-Fi --*'
  29. message: >
  30. {% if states('sensor.time') == states('input_datetime.multi1_usb_on')[:5] %}
  31. {{now().strftime("%H:%M")}}: {{ states.sensor.multi1_usb.state }} SPENTA, si accenderà alle {{states('input_datetime.multi1_usb_off')[:5]}}
  32. {% elif states('sensor.time') == states('input_datetime.multi1_usb_off')[:5] %}
  33. {{now().strftime("%H:%M")}}: {{ states.sensor.multi1_usb.state }} ACCESA
  34. {% endif %}
  35.  
RAW Paste Data