I’m new to Home Assistant and would appreciate if you could critique my idea, advise if it’s possible or if there’s a better alternative.
I want to put a PIR at the top and bottom of my stairs (roof mounted). I then want 3 strings of LEDS (WS2812b) to be activated in sequence, depending on if the PIR was triggered at the top or the bottom of the stairs - in effect, I will mount the strips inside 3 individual light housing in the stairwell. These lights will light up top, middle, bottom with a slight delay between each if triggered from the top (or vice-versa).
The “top” PIR I will utilise a WEMOS D1 Mini, and a larger PIR relay (therefore closing a circuit upon movement). This will then send a movement MQTT message.
The “bottom” PIR will be of the same kind of sensor (relay) - it will be hooked up to a Wemos D1 - in addition to the 3 LED channel outputs. I want this device to not only send a movement message in the same manner as the Top sensor, but to also control the lighting whether it was triggered locally (Bottom PIR) or via the Top PIR, and sequence the lights in the direction of travel up or down the stairs.
The PIR topics I’d like to be flexible and re-use them for other automation and security notifications.
Sounds very do-able. I would look at Tasmota, which provides a simple way to add MQTT support to an ESP8266 board. The logic within home assistant, or node-red is quite simple IMHO.
Thanks @nickrout
I have put Tasmota on the devices already, still learning the ropes with MQTT and having a few issues with the ESP library. Not sure of how best to utilise the 2 sequences of lighting direction though - do I make HA do this, or do I put this code on the Wemos D1?
I’m normally the go-to for tech stuff but I’m still struggling getting to terms with the coding side of things. I think I’m getting old haha.
Well I think you need two automations, one triggered by the top sensor, one for the bottom sensor.
In pseudo code the one for the top sensor would look like:
trigger:
- entity_id: sensor_stairtop
from: off
to: on
action:
# it would take a bit of playing around to get this right
# but you want to turn on the top light, pause x seconds, then
# turn on middle light, and turn off top light, pause x seconds
# then turn on bottom light and turn off middle light, then pause
# x seconds then turn off bottom light.
In other words I don’t know the exact method to perform a series of time delayed actions in an automation, but there will be docs somewhere.