Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- esphome:
- name: bedroom_bedside_nightlight1
- platform: ESP8266
- board: nodemcuv2
- # Wifi
- wifi:
- ssid: '123'
- password: '123'
- logger:
- api:
- password: 'bedroom_bedside_nightlight1'
- ota:
- password: 'bedroom_bedside_nightlight1'
- # Пины светодиодов
- output:
- - platform: esp8266_pwm
- id: output_red
- pin: D5
- max_power: 0.75
- - platform: esp8266_pwm
- id: output_green
- pin: D6
- max_power: 0.75
- - platform: esp8266_pwm
- id: output_blue
- pin: D7
- max_power: 0.75
- - platform: esp8266_pwm
- id: output_white
- pin: D8
- max_power: 0.75
- # Ночник
- light:
- - platform: rgbw
- name: bedroom_bedside_nightlight1
- id: bedroom_bedside_nightlight1
- red: output_red
- green: output_green
- blue: output_blue
- white: output_white
- effects:
- - strobe:
- - flicker:
- - random:
- binary_sensor:
- - platform: gpio
- pin:
- number: D1
- name: bedroom_nightlight1_light_button
- id: bedroom_nightlight1_light_button
- on_click:
- then:
- - light.toggle: bedroom_bedside_nightlight1
- on_press:
- then:
- - if:
- condition:
- light.is_off: bedroom_bedside_nightlight1
- then:
- - delay: 0.5s
- - while:
- condition:
- binary_sensor.is_on: bedroom_nightlight1_light_button
- then:
- - light.dim_relative:
- id: bedroom_bedside_nightlight1
- relative_brightness: 5%
- transition_length: 0.1s
- - delay: 0.1s
- else:
- - delay: 0.5s
- - while:
- condition:
- and:
- - binary_sensor.is_on: bedroom_nightlight1_light_button
- - light.is_on: bedroom_bedside_nightlight1
- then:
- - light.dim_relative:
- id: bedroom_bedside_nightlight1
- relative_brightness: -5%
- transition_length: 0.1s
- - delay: 0.1s
Add Comment
Please, Sign In to add comment