Add Time to luup.is_night

Is there a way I can add time to the is night variable (luup.is_night)?
I would like to add 1 hour before sunset and 1 hour after sunrise to extend the trigger times.

Possible?
Thanks!

under schedule you can specify 1 hr (or whatever) before sunset or 1 hr after sunrise and so on.

Are you referring to timers?
I want to use events based on a trigger - where can I do that there?

Here are two workarounds.

One: set up a virtual switch, and create two schedule-scenes that turn it on an hour after sunset, and off an hour before sunrise. Then, instead of testing luup.is_night(), test the virtual switch for being on.

Two: install the Heliotrope plugin, and test its Altitude variable against a value typical of one hour after sunset (probably about -11º). This isn’t strictly the same as “an hour after sunset” because of spherical trigonometry, but it’s better if you are aiming for a particular level of twilight, especially at high latitudes.

I guess I could use 2 virtual switches to accomplish my goal. Let me lay it out…

I want a scene to trigger when I disarm my Elk M1, but only if it was in away mode and it is that 1 hour before sunset / after sunrise. This is what I came up with, but there is probably a much cleaner way…

whenever house is armed away
then turn virtual switch on

whenever house is disarmed
then turn virtual switch off

whenever garage door becomes unsecure (3) are listed because there are different ways the system could be disarmed
then turn virtual switch off

whenever front door becomes unsecure
then turn virtual switch off

whenever virtual switch is turned off
and it is 1 hour before / after sunset/sunrise
then run scene

So, what would be the best way of going about this?

Yeah, that’d work. Try coding it up and let us know how you go.