Advertisement
cperryoh

Untitled

May 2nd, 2022
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. output:
  2. - platform: gpio
  3. pin: D7
  4. id: relay
  5. switch:
  6. - platform: template
  7. id: pc
  8. name: "PC"
  9. lambda: 'return id(pc_power).state;'
  10. turn_on_action:
  11. - switch.turn_on: pc_switch
  12. turn_off_action:
  13. - switch.turn_off: pc_switch
  14. - platform: template
  15. name: "PC switch"
  16. id: pc_switch
  17. turn_on_action:
  18. - output.turn_on: relay
  19. - delay: 0.5s
  20. - output.turn_off: relay
  21. turn_off_action:
  22. - output.turn_on: relay
  23. - delay: 0.5s
  24. - output.turn_off: relay
  25. # Example configuration entry
  26. binary_sensor:
  27. - platform: analog_threshold
  28. id: pc_power
  29. sensor_id: led
  30. threshold: 0.1
  31. sensor:
  32. - platform: adc
  33. pin: A0
  34. id: led
  35. update_interval: 1s
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement