Happy Easter Everyone
Debian GNU/Linux 10 (buster)
Raspberry Pi 4 Model B Rev 1.4
Within the easter break i have received lots of new sonoff zigbee sensors, i have successfully connected them all to the sonoff zigbee bridge running tasmota to mqtt.
Im trying to create a rule to turn a light on when motion is detected but only if night_state = ON. i then want to start a timer for say 5 minutes and then turn off said light if there is no motion. If there is motion detected once the 5 minutes is up, the timer should be reset.
Any input is much appreciated.
This is a very common thing that we start with when we do home automation. It is unfortunate that each of us has to do the same thing again and again. Reusable sets of rule would be useful here, but unfortunately that is still far away due to the low level of abstractions in OpenHab. The general idea is to combine the Astro sensor, motion sensor, timer, and the light switches.
If you search the forum, you will see many solutions. I myself went through 3 iterations.
- A HABApp based Python3 solution (more reusable): zone-apis/turn_on_switch.py at master · yfaway/zone-apis · GitHub
- A Jython based solution: openhab-rules/turn_on_switch.py at master · yfaway/openhab-rules · GitHub
- An Xtend solution: openhab-rules/lights.rules at master · yfaway/openhab-rules · GitHub
I have actually just stumbled across this video by a community poster.it’s perfect for what I want to do .https://youtu.be/vXvB0p7SpVw