Two conditions for a scene

This is a very simple question, but haven’t found how to setup the following scene:

I have a fan attached to an appliance module and a z-wave enabled temperature sensor.

I created a scene in which, if the temperature goes above 25 Cº tha fan turns on… so far so good.

The thing is that I have that setup in my office, so I want this scene to be active only on weekdays.

In other words I want my fan to turn on when two conditions are true: It is a weekday AND the temperature is above 25 Cº

Is that possible through the “normal” interface? If I require a luup code, anyone has a sample?


Question, is the sensor that you are using one that can be armed and disarmed? If so, this you should be able to make this work via the normal interface as you put it, by setting up additional scenes to arm and disarm the sensor based on scene timers (day of the week, time of day, etc).

That being said, it will probably be easier to do this with a single scene (that actually turns on the fan), and adding in some LUUP code to check for the day of the week before triggering the command. This should be fairly straight forward to do. If nobody else chimes in with some code, I can find check back in with you later on when I’ve got a second to try this out.

Here is some LUUP code that will check to see if it is a weekday or not. If it is a weekday, it’ll simply log that fact and continue executing the scene. If it is a weekend, it’ll “return false” which means the scene won’t execute.

day_of_week ='*t',os.time())["wday"]

if (day_of_week > 1) and ( day_of_week < 7)
-- 1=Sunday - 7=Saturday
luup.log("Today is a Weekday")
  return false

I used code provided by the esteemed Ap15e over at this thread [url=][/url] to put this together. If you want to also add in time of day checks, have a look there.