Hi all,
I have been playing around with Home Assistant and an RF433-to-MQTT gateway. This allows me to receive triggers from a 433Mhz PIR. The triggers are one offs and can be used in automation rules as a trigger.
I’d like to turn a simple light on, or an input_boolean to trigger other events, with this trigger and let it switch off after no trigger is received for a certain time. Creating an automation rule that switches on a light and switch it off after a set time I can but not sure how I can reset this timer so that it stays on longer and only switches off after no PIR motion has been detected for a while (e.g. 5 minutes).
Hi Keith,
This works indeed. Usng scripts is new to me and I am also still learning to code automation and any other file.The speed to check configurations on a Pi2 and the error messages I got makes it challanging to quickly find errors and improve. E.g syntax errors. But you script helped me getting this bit done.
Thanks,
Patrick
I haven’t been able to validate this, but how would the timer be extended/reset in case motion is detected again prior to expiry of the timer?
I’d like to avoid the state to be changed to down based on the first event when a consequent one comes in before expiry.
I tried but couldn’t get the “FOR” to work. Again, I still struggle with the yaml syntax but I don’t know how to further progress this or what exactly to expect. Here the piece I was working on in my automation.yaml file.
# PIR test to trigger timer.
- action:
- alias: Switch on boolean
service: homeassistant.turn_on
entity_id: input_boolean.motion_detected_1
trigger:
platform: mqtt
topic: "home/433toMQTT"
payload: "14250874"
for:
minutes: 3
alias: PIR trigger test basic
initial_state: on
hide_entity: true
id: '1497893919247'
Ahhh! Sorry, for doesn’t work with a MQTT trigger. You will need to use MQTT to trigger; set a boolean, and then use the boolean as a state trigger with the for…
Did you ever get this working with your MQTT setup? I am doing something very similar with MQTT PIR sensors, I would be very appreciative of seeing your working automation yaml code.
Hi Sparky,
I did get it working. But I still struggle with the sensitivity of Home Assistent. Too often my automations stop working or scripts don’t work which could be a result of a small error somewhere, which is mostly very hard to find with the very cryptic logging that is available. I am considering to stop using Home Assistant for now and consider again when it is mature enough, like with version 3.1 or so.
Patrick