Advertisement
xangin

ESPhome Xmas light effect

Dec 3rd, 2022
1,277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.20 KB | None | 0 0
  1. # Example configuration entry
  2. light:
  3.   - platform: monochromatic
  4.     output: output_component1
  5.     id: xmas_light
  6.  
  7. # Example output entry
  8. output:
  9.   - platform: esp8266_pwm
  10.     id: output_component1
  11.     pin: D3
  12.  
  13. switch:
  14.   - platform: template
  15.     id: xmas_light_switch
  16.     name: "${device_name}"
  17.     restore_state: true
  18.     turn_on_action:
  19.       - switch.template.publish:
  20.           id: xmas_light_switch
  21.           state: on    
  22.       - while:
  23.          #只要開關是打開的就一直持續這個流程
  24.           condition:
  25.             switch.is_on: xmas_light_switch
  26.           then:
  27.            #10秒間將亮度調到最大
  28.             - light.turn_on:
  29.                 id: xmas_light
  30.                 brightness: 100%
  31.                 transition_length: 10s  
  32.             - delay: 10s
  33.             - delay: 30s
  34.             #5秒間將亮度調到關閉
  35.             - light.turn_on:
  36.                 id: xmas_light
  37.                 brightness: 0%    
  38.                 transition_length: 5s  
  39.             - delay: 5s    
  40.     turn_off_action:  
  41.       - switch.template.publish:
  42.           id: xmas_light_switch
  43.           state: off    
  44.       - light.turn_off:
  45.           id: xmas_light
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement