kvvhost

Touch_change_

Jun 18th, 2020
32
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. esphome:
  2. name: bedroom_bedside_nightlight1
  3. platform: ESP8266
  4. board: nodemcuv2
  5.  
  6. # Wifi
  7. wifi:
  8. ssid: '123'
  9. password: '123'
  10.  
  11. logger:
  12.  
  13. api:
  14. password: 'bedroom_bedside_nightlight1'
  15.  
  16. ota:
  17. password: 'bedroom_bedside_nightlight1'
  18.  
  19. # Пины светодиодов
  20. output:
  21.  
  22. - platform: esp8266_pwm
  23. id: output_red
  24. pin: D5
  25. max_power: 0.75
  26.  
  27.  
  28. - platform: esp8266_pwm
  29. id: output_green
  30. pin: D6
  31. max_power: 0.75
  32.  
  33.  
  34. - platform: esp8266_pwm
  35. id: output_blue
  36. pin: D7
  37. max_power: 0.75
  38.  
  39.  
  40. - platform: esp8266_pwm
  41. id: output_white
  42. pin: D8
  43. max_power: 0.75
  44.  
  45. # Ночник
  46. light:
  47. - platform: rgbw
  48. name: bedroom_bedside_nightlight1
  49. id: bedroom_bedside_nightlight1
  50. red: output_red
  51. green: output_green
  52. blue: output_blue
  53. white: output_white
  54. effects:
  55. - strobe:
  56. - flicker:
  57. - random:
  58.  
  59. binary_sensor:
  60. - platform: gpio
  61. pin:
  62. number: D1
  63. name: bedroom_nightlight1_light_button
  64. id: bedroom_nightlight1_light_button
  65. on_click:
  66. then:
  67. - light.toggle: bedroom_bedside_nightlight1
  68.  
  69. on_press:
  70. then:
  71. - if:
  72. condition:
  73. light.is_off: bedroom_bedside_nightlight1
  74. then:
  75. - delay: 0.5s
  76. - while:
  77. condition:
  78. binary_sensor.is_on: bedroom_nightlight1_light_button
  79. then:
  80. - light.dim_relative:
  81. id: bedroom_bedside_nightlight1
  82. relative_brightness: 5%
  83. transition_length: 0.1s
  84. - delay: 0.1s
  85. else:
  86. - delay: 0.5s
  87. - while:
  88. condition:
  89. and:
  90. - binary_sensor.is_on: bedroom_nightlight1_light_button
  91. - light.is_on: bedroom_bedside_nightlight1
  92. then:
  93. - light.dim_relative:
  94. id: bedroom_bedside_nightlight1
  95. relative_brightness: -5%
  96. transition_length: 0.1s
  97. - delay: 0.1s
RAW Paste Data