Apologies for the ultra Newbie question. I have an outdoor PIR switching on outdoor lights. I obviously do not want the lights to come on during the day, so I have installed the Day or Night Plug in. I have set up a scene to turn on the lights with two triggers one when the PIR detects movement and the second when Day or Night indicates night.This does not work, the PIR fires the lights Day or Night.
I rather assumed that the logic works as: IF a PIR event is fired AND the state of Day or Night is Night THEN switch on the lights. The alternative way it may work is ; IF a PIR event is fired AND Day or Night changes state to Night THEN switch on the Lights, But in the latter case the light would never fire?
I am sure that I can fix this with LUUP or, more likely PLEG but in the first instance would like to understand what I am doing wrong with the basic triggers.
Thanks for any help
That’s if I can get pased the FOUR am I a human questions
As to your question, the triggers are OR’d. AND has been missing for a very long time, but there is now a hint of it if you use the iOS app or you load the latest AltUI. It is also entirely possible to make conditional AND behavior with lua code.
And, as @zedrally mentions, PLEG can do this quite well.
It does seem a bit odd that such a straightforward requirement can’t be done out of the box. Ah well.
The other oddity is that if the triggers are OR’d then I would expect the lights to go on at Night when the Day and Night triggers a change to Night, which it doesn’t.
[quote=“BrianVickers, post:4, topic:196928”]The other oddity is that if the triggers are OR’d then I would expect the lights to go on at Night when the Day and Night triggers a change to Night, which it doesn’t.[/quote]That is odd. If the trigger is set up correctly, it should indeed trigger on the change to night. Nothing in the log when the transition to night occurs and this scene should fire? Of course you may not want to spend time to track this down if you are switching to PLEG.
I am interested in tracking it down, but not too sure how to progress further, There are no Logs shown against the Day or Night plug in, my loaction is set up correctly and, most curiously, the scene triggers the lights when I change the Day or Night to Night. The scene only turns on the lights for 10 minutes so it is possible I have missed it. I will extend the time the the lights stay on so will check tonight.
(The ludicrous level of Am I robot control, is putting me off posting however)
If you dont care about setting specifically for DAY/NIGHT but want to restrict for time you can limit the times a trigger will be acted on in the trigger setup. you could also just use the lua code luup.is_night() as part of a function to fail or not fail the scene.
First of all My Bad, the lights are being triggered by the Day or Night Plug in - not that that us the behaviour I wanted - but at least that is a mystery solved and a behaviour understood.
I could use schedules and may well do pro-tem until I work out an alternative fix, but really want the scene to align with the hours of dusk.
All fixable in due course - that Luup snippet looks as if it would be useful - but right now need to focus on other issues. I hadn’t really picked up that all this stuff is still closer to the hobbiest than the mainstream.
[quote=“BrianVickers, post:9, topic:196928”]Thanks once again Guys.
First of all My Bad, the lights are being triggered by the Day or Night Plug in - not that that us the behaviour I wanted - but at least that is a mystery solved and a behaviour understood.[/quote]
So can you tell us what behaviour you had expected or want?
Initially you asked for lights to come on at Dusk, now you are saying it isn’t what you expected.
[quote=“BrianVickers, post:4, topic:196928”]Thanks for the help, PLEG it is then.
It does seem a bit odd that such a straightforward requirement can’t be done out of the box. Ah well.
The other oddity is that if the triggers are OR’d then I would expect the lights to go on at Night when the Day and Night triggers a change to Night, which it doesn’t.[/quote]
[quote=“zedrally, post:10, topic:196928”][quote=“BrianVickers, post:9, topic:196928”]Thanks once again Guys.
First of all My Bad, the lights are being triggered by the Day or Night Plug in - not that that us the behaviour I wanted - but at least that is a mystery solved and a behaviour understood.[/quote]
So can you tell us what behaviour you had expected or want?
Initially you asked for lights to come on at Dusk, now you are saying it isn’t what you expected.[/quote]
I wanted the Garden lights to come on when the PIR detects motion, but only at night. My initial assumption was that Triggers works as AND not OR. Apologies if that was not clear.
(Clearly this can be done but needs Luup or add-ons)
[quote=“BrianVickers, post:13, topic:196928”]I wanted the Garden lights to come on when the PIR detects motion, but only at night. My initial assumption was that Triggers works as AND not OR. Apologies if that was not clear.
(Clearly this can be done but needs Luup or add-ons)[/quote]
This particular one can be done quite easily with one line of lua in your scene. Set up the trigger for motion and have the scene turn on the lights, and put this in your scene lua code:
return luup.is_night()
If you use the iOS app, then AND is built in (no add-on needed). And supposedly this will appear soon for the other interfaces. (But why wasn’t this there from the beginning?)
For more sophisticated logic there are multiple paths to explore: PLEG, more advanced lua, AltUI’s workflows, rules engine, etc.