80 lines
1.4 KiB
YAML
80 lines
1.4 KiB
YAML
substitutions:
|
|
device_name: "bathroom-bulb-1"
|
|
friendly_name: "Bathroom Bulb 1"
|
|
|
|
esphome:
|
|
name: ${device_name}
|
|
comment: ${friendly_name}
|
|
on_boot:
|
|
priority: 300
|
|
then:
|
|
- light.turn_on:
|
|
id: my_light
|
|
- delay: 100ms
|
|
- light.turn_on:
|
|
id: my_light
|
|
brightness: 30%
|
|
- delay: 100ms
|
|
- light.turn_on:
|
|
id: my_light
|
|
red: 100%
|
|
green: 50%
|
|
blue: 0%
|
|
white: 100%
|
|
|
|
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%
|
|
|
|
# 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
|
|
|
|
light:
|
|
- platform: rgbw
|
|
id: my_light
|
|
name: ${friendly_name}
|
|
red: pwm_r
|
|
green: pwm_g
|
|
blue: pwm_b
|
|
white: pwm_w
|
|
|
|
output:
|
|
- platform: esp8266_pwm
|
|
pin: GPIO13
|
|
frequency: 1000 Hz
|
|
id: pwm_r
|
|
|
|
- platform: esp8266_pwm
|
|
pin: GPIO12
|
|
frequency: 1000 Hz
|
|
id: pwm_g
|
|
|
|
- platform: esp8266_pwm
|
|
pin: GPIO14
|
|
frequency: 1000 Hz
|
|
id: pwm_b
|
|
|
|
- platform: esp8266_pwm
|
|
pin: GPIO5
|
|
frequency: 1000 Hz
|
|
id: pwm_w |