Would appreciate any help for this novice esphome user. Having trouble getting the below config to work to:
Turn on light full brightness between 5am & 7am and between 4pm & 9pm.
Turn on light 20% brightness between 9pm & 5am.
Off all other times.
Appreciate any tips
esphome:
name: smart-toilet
friendly_name: Toilet Light
platform: ESP8266
board: d1_mini
on_boot:
priority: 600
# turn on the light when powered on
then:
- light.turn_on:
id: toilet_light
brightness: 100%
red: 100%
green: 70%
blue: 45%
# Enable logging
logger:
# Enable Home Assistant API
api:
# Enable over the air updates
ota:
platform: esphome
wifi:
networks:
- ssid: !secret 1_wifi_ssid
password: !secret 1_wifi_password
- ssid: !secret 2_wifi_ssid
password: !secret 2_wifi_password
manual_ip:
static_ip: 192.168.0.231**strong text**
gateway: 192.168.0.1
subnet: 255.255.255.0
preferences:
flash_write_interval: "48h"
time:
- platform: sntp
id: toilet_time
sensor:
- platform: uptime
name: "toilet light"
- platform: dht
pin: D2
temperature:
name: "Shower Vent Temperature"
humidity:
name: "Shower Vent Humidity"
update_interval: 10s
model: AM2302
- platform: wifi_signal # Reports the WiFi signal strength/RSSI in dB
name: "Toilet WiFi"
id: wifi_signal_db
update_interval: 60s
entity_category: "diagnostic"
binary_sensor:
- platform: gpio
pin:
number: D5
name: "PIR Toilet"
id: toilet_pir
device_class: motion
filters:
- delayed_on: 100ms
on_press:
then:
- if:
condition:
or:
- lambda: 'return id(toilet_time).now().hour >= 5 && id(toilet_time).now().hour < 8;'
- lambda: 'return id(toilet_time).now().hour >= 16 && id(toilet_time).now().hour < 21;'
then:
- light.turn_on:
id: toilet_light
brightness: 100%
transition_length: 0.5s
- if:
condition:
- lambda: 'return id(toilet_time).now().hour >= 21 && id(toilet_time).now().hour < 5;'
then:
- light.turn_on:
id: toilet_light
brightness: 20%
transition_length: 0.5s
switch:
- platform: restart
name: "Toilet Light Reboot"
light:
- platform: neopixelbus
type: GRB
variant: WS2812X
pin: GPIO3
num_leds: 20
name: "Toilet Light"
id: toilet_light
restore_mode: ALWAYS_ON
default_transition_length: 10ms
on_turn_on:
then:
- delay:
minutes: 2
- light.turn_off: toilet_light