House Mode Based on Day/Night

Hi All, I am fairly new to this and trying to get the house mode plugin to change from mode “away” to either “day” or “night” when I come home based on whether it is actually day or night.

For example, If I’m away and I come home at night time I want the house mode to change to “night”, but if i come home during the day I want it to switch to “day”.

At the moment I have it setup with 2 scenes, each scene has some code in them. Both scenes trigger when I disarm the alarm but I only want one of them to run. Despite having the code in each of them they both still appear to run.

Totry and stop one of the scenes from running if it is night time I have used:

if (luup.is_night()) then
return false
end

And to stop the other scene from running during the day I have used:

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

Despite this they both seem to be running when looking at the scenes last runtimes in the UI and the mode that the system switches to seems to differ

Does anyone have any ideas as to where I may be going wrong? Or is there a better / easier way to do this with one scene or one lot of coding?

Thanks

Hi,

Where did you put the LUA code? In the trigger bit or in the main part (Step 3, Also, execute the following Luup code:)

The above should do when put in the latter.

Cheers Rene

A simple way would be the Day or Night plugin that creates a virtual switch indicating Day/Night which is useful for other scenes as well.

Hi, just under step 3. There isn’t anywhere else to put it is there :thinking:

I have this plugin but if I use this as a trigger for a scene it will trigger every time the Vera switches between day and night given you can’t use multiple triggers in a scene

You can use multiple triggers with AND in the iOS app.

Silly question but which iOS app are you referring to?

The official VeraMobile by Mios

Cool thanks, will check it out. Didn’t even know they had one :man_shrugging:… I’ve just been using VeraMate

downloaded the official vera ios app.

Tried to use multiple triggers with AND in a scene and no matter what I tried I couldn’t get the scene to execute once I added a second trigger and set it as AND

Anyone else have problems trying to use multiple triggers with AND?

If I remember correct I think I had problems when editing existing scenes, try to create a new one strictly from the app (and don’t even edit it in a browser afterwards). Also toggle all the switches including in the scene at least once before it runs on a schedule.