I’m a noobie for Home Assistant have a lot of wishes but a lot more questions So I hope that someone can help me with the following problem because I’m already stuck for a couple of evenings! The Challenge I have is as followed.
I have a Sonoff Zigbee Bridge (not Tasmotized) and a Sonoff SNZB-03 Motion Sensor. In my Bathroom I have also installed a Sonoff T1 switch, this switch is Tasmotized.
All these devices/entities are visible in Home Assistant so I tried with Node red to switch on and off the light.
But unfortunately I don’t get it done…
What am I doing wrong? Is Node Red the correct way too handle this? Or do I need to install more options in HA to get it work?!
Hi Arie… For simple automations you can use the automation function in the HA itself. Node red will also work. Its just your choice thats all. Since you already see all the entities in HA and I believe its working as intended, you wont have to install any more addons for this process. You can make new automations by going to configurations>automations>create new automaton.
In that you have to give a name first.
Then add the trigger which defines when to trigger the automation. Since you want the switch on the light when motion sensor state is on, select state as the trigger type, then select the entity i,e the motion sensor and give the state from off to on.
Next is the conditions tab, here you can give any condtions to check like to check time between sunset to sunrise or so. If you dont have any conditions, just leave it.
Next is the actions window, here you give the actions to do. Since you want the light to turn on, select action type as call_service, select switch.turn_on as service and then the light enity .
Next is that when the lights are turned on, you will want to turn that off after the motion sensor is in off state. For this add a next action which would be “wait for trigger”. Give the trigger as motion sensor off for 1 minute or so, then action as switch off.
Please try it and if you need help just let us know.
Many thanks for your help I was thinking way too much out of the box hadn’t discovered the automation of HA yet.
With your help I succeeded to trigger to switch the lights on if motion was detected on the SNZB-03.
I’m wondering if I interpreted your explanation correctly for switching off the light. ( I attached a screenshot of the last part as you described) Is 60 the correct number for 1 minute? Because the light doesn’t go out after a minute.
If I switch off the light manually with the switch and I make some motion for the Sensor than nothing happens. I would have thought that the light than would go on immediately. It looks like the sensor has a lot of delay before responding.!
i am not able to see the screen shot. You can share the automation yaml. Just go the automation and on the top right end there will be settings. Click it and select “edit as yaml”. You will see a code, this is the code that does the automation. Select all the code and copy it and paste it between ``` so that it will appear as a code here. When you share the code I will be able to see the issue and suggest corrections.
I copied / paste your script in the automation file, after excuting it the light switched on immediately while I wasn’t near the motion sensor.
After a minute the light was still lit.
So I switched of the light manually, again I waited a minute.
Than make some movement for the Motion sensor, a red light in the Motion Sensor lit up.
Unfortunately the light didn’t switched.
After leaving the motion sensor alone for about 10 minutes, and makeing some movement the light lit up.
After a minute the light went, again made a movement for the motion sensor the light but then again it didn’t go after a minute.
I’m beginning to think that the Motion Sensor is not a very stable one.
The automation will only trigger off the light if the motion sensor is off for 1 minute. if you switch on the light manually, this wont switch it off. The automation looks for motion detection to trigger. if you manually switch it on the automation is not trigger but if you manually switch it on and then make some movements in front of the motion sensor, then the automation will be triggered and the light will switch off after the motion sensor is off for 1 minute.