Scenes with Triggers and schedules

My idea for programming my thermostat is to have two scenes where one runs on cooling and the other runs on heating mode. Then I use these scenes to trigger setpoint scenes with a schedule for when the set-point should be changed. My question is if you have a trigger and a schedule in the same scene, does the trigger control whether or not the schedule is run? This is what I want to happen, but I am getting some heating set points happening that make me wonder if that is the case.

Sent from my iPad using Tapatalk

A scene will run when any of the following happens:

  1. You manually run it:
    OR
  2. Your schedule causes it to run
    OR
  3. Your trigger causes it to run (and there is no LUA code to cancel the trrigger.

You need to use the PLEG plugin if you want to use an AND condition … i.e. IF Motion AND NightTimeSchedule THEN Turn of Lights.
Actually with PLEG you can have very complex logic.

Vera Scenes only provide OR semantics of the possible triggers or schedules (without the use of LUA).

Ok so it could be the trigger or the schedule that runs the scene if both are there. I have done my share of programming, so I will try the LUA approach.
Thanks for the help.

Sent from my iPad using Tapatalk

Ok do you think this would work? It seems to. I got rid of the trigger and just have scheduled set of scenes for setpoint of heating and cooling that have a simple Luup code like below to shut it down if the mode is not correct. The one below I would use for heating set points, and I change to status == “CoolOn” for the cooling set point.

local dID = 19 – Device ID of your Z-Wave Switch
local allow = true – true runs scene if switch is on, false blocks it
local status = luup.variable_get(“urn:upnp-org:serviceId:HVAC_UserOperatingMode1”,“ModeStatus”,dID)
return ((status == “HeatOn”) == allow)

The code seems to prevent the change if the mode does not match.

Sent from my iPad using Tapatalk

I don’t think it’s quite right. It would seem that if ModeStatus is anything other than “HeatOn” and allow is false, then it would still trigger, since false == false.

Perhaps you need

return ((status == "HeatOn") and allow)

It looks to me that we have to return true to keep the scene going. Allow is set to true so you would need true==true to keep the scene going. The variable status would have to be true to run the scene, which would mean status== “HeatOn”. So far it seems to be doing the job, but I need to test it while in heating mode.

Sent from my iPad using Tapatalk

Yes.

Allow is set to true so you would need true==true to keep the scene going.
However, [tt]false == false[/tt] is ALSO [tt]true[/tt].

True enough. However the right side is always set to true so we will never get that combo.

Sent from my iPad using Tapatalk

In that case

return status == "HeatOn"

would suffice.

Not sure how that would work. Don’t I have to get the status of the thermostat first?

Sent from my iPad using Tapatalk

Yes, certainly.

I was just highlighting the redundancy in your return statement. The rest of the code still stands.

Ok I think I see the redundancy. Your are right.

Sent from my iPad using Tapatalk