I’m new to esphomeyaml/lib but not to HA. Everything I’m trying to do I know how to do within HA but would like to cover the use cases where any of the HA/MQTT/Wifi services are down. I would like to turn the lights on automatically when motion is detected and then have them fade out if motion is not detected for, say, 5 minutes. I figured out the turning on part, but I’m not sure how to wait for a period of time after no motion. The timer should be reset after every sensed motion. Just using the delay turns the light off regardless if motion is detected during the countdown period.
Relevant hardware:
- Wemos D1 mini R2
- PIR sensor on pin D6
- WS2812b strand on pin D1
Relevant code snip:
light:
- platform: fastled_clockless
chipset: WS2812b
pin: D1
num_leds: 127
rgb_order: GRB
name: "Under Cab Light"
id: under_cab_lights
binary_sensor:
- platform: gpio
pin: D6
name: "Motion"
device_class: motion
on_press:
then:
- light.turn_on:
id: under_cab_lights
transition_length: 0.5s
red: 100%
green: 95%
blue: 95%
brightness: 100%
Thanks!!
-Josh