Activate a scene based on a trigger... but only at night?

I know this is possible using LUA code, but I don’t know the code :frowning:

I found if (luup.is_night()) then
return false
else
return true
end

This code is perfect for something I only want to happen during the daytime… However in my case I want this scene to activate ONLY at night based on a trigger (alarm panel armed). Help?

Invert the logic. Swap true with false.

I tried this, however it doesn’t work. When testing the code in the “Develop Apps” section it fails with the inverted statement.

Develop Apps > Test Luup Code is useless for what you want to do. Just put the code into the scene’s Luup textarea.

…as ‘fail’ means it returned false, or there was a problem. Very handy. ::slight_smile:

I am not going to say how long I spent on that :-X

Thanks for the help!

Time to try the Day or Night and Program Logic Event Generator plugins.

I actually use both already, however I couldn’t figure out how to tie them into the scene.

I should be more specific on what I am trying to achieve:

  • When it is night
    AND
  • TRIGGER - The Honeywell alarm panel changes from “Armed” to “Disarmed” state
  • Activate some lighting

It was the “And” part that I was having difficulty with. PLEG would seem to be the anwer, however I couldn’t figure out how to use it for this scenario. So I plan to use the use the Luup code to inhibit the scene during the day, which bypasses the “AND” portion of the logic.

PLEG Tigger Inputs:
Night When Day or Night Indicates Night
Disarmed When The Honeywell alarm panel changes from “Armed” to “Disarmed” state.

PLEG Conditions:
AutoOn Night && (Night; Disarmed)

PLEG Actions:
AutoOn Run your scene … or just turn on the lights directly.
[hr]
The above condition will only fire if the alarm is disarmed AFTER it’s night.

I would like to execute a similar scenario, turning on lights when the alarm is active only at night, but im lost in the condition tab, i will appreciate your help

Tigers
Night When Day or Night Indicates Night
Alarm Active When the DSC indicates an active alarm

Conditions
??

Actions
Turn on lights

Thanks

[quote=“petequintanilla, post:10, topic:175208”]I would like to execute a similar scenario, turning on lights when the alarm is active only at night, but im lost in the condition tab, i will appreciate your help

Tigers
Night When Day or Night Indicates Night
Alarm Active When the DSC indicates an active alarm

Conditions
??

Actions
Turn on lights

Thanks[/quote]

How about:

Conditions
TurnOnLight Night AND Alarm

Actions
TurnOnLight Turn on lights

Br,
Tomas

Great, now I understand, thanks.