69 lines
1.3 KiB
YAML
69 lines
1.3 KiB
YAML
substitutions:
|
|
device_name: "toilet-bulb"
|
|
friendly_name: "Toilet Bulb"
|
|
|
|
esphome:
|
|
name: ${device_name}
|
|
comment: ${friendly_name}
|
|
on_boot:
|
|
then:
|
|
- light.turn_on:
|
|
id: my_light
|
|
- delay: 100ms
|
|
- light.turn_on:
|
|
id: my_light
|
|
brightness: 20%
|
|
- delay: 100ms
|
|
- light.turn_on:
|
|
id: my_light
|
|
color_temperature: 2700 K
|
|
|
|
esp8266:
|
|
board: esp01_1m
|
|
|
|
interval:
|
|
- interval: 15s
|
|
then:
|
|
- if:
|
|
condition:
|
|
api.connected: # check if api connected
|
|
else:
|
|
- light.turn_on:
|
|
id: my_light
|
|
brightness: 100%
|
|
- delay: 100ms
|
|
- light.turn_on:
|
|
id: my_light
|
|
color_temperature: 6500 K
|
|
|
|
|
|
# Enable Home Assistant API
|
|
api:
|
|
batch_delay: 0ms
|
|
|
|
ota:
|
|
platform: esphome
|
|
|
|
wifi:
|
|
ssid: !secret wifi_ssid
|
|
password: !secret wifi_password
|
|
fast_connect: True
|
|
domain: .cloonar.smart
|
|
|
|
output:
|
|
- platform: esp8266_pwm
|
|
id: warm_white
|
|
pin: GPIO4
|
|
- platform: esp8266_pwm
|
|
id: brightness
|
|
pin: GPIO5
|
|
|
|
light:
|
|
- platform: cwww
|
|
id: my_light
|
|
name: ${friendly_name}
|
|
warm_white: warm_white
|
|
cold_white: brightness
|
|
cold_white_color_temperature: 6500 K
|
|
warm_white_color_temperature: 2700 K
|