Please see my code below, I can only get this scene to work when the conditions on the first line are true, what am I missing? I need this to work when either set of conditions are met.
Thanks,
local t = os.date(‘*t’)
local dayOfWeek = t.wday
away = luup.variable_get(“urn:upnp-org:serviceId:VSwitch1”,“Status”,19)
avg = luup.variable_get(“urn:upnp-org:serviceId:TemperatureSensor1”, “CurrentTemperature”, 49)
outside = luup.variable_get(“urn:upnp-org:serviceId:TemperatureSensor1”, “CurrentTemperature”, 5)
local runScene = false
if (away==“0”) and (t.hour > 7) and (t.hour < 18) and (dayofweek~=7) and (tonumber(avg) > 74) and (tonumber(outside) > 60) then
runScene = true
end
if (away==“0”) and (t.hour < 7) and (t.hour > 18) and (dayofweek~=7) and (tonumber(avg) > 72) and (tonumber(outside) > 60) then
runScene = true
end
if (away==“0”) and ((dayofweek==1) or (dayofweek==7)) and (tonumber(avg) > 72) and (tonumber(outside) > 60) then
[quote=“resq93, post:1, topic:171584”]if (away==“0”) and (t.hour < 7) and (t.hour > 18) and (dayofweek~=7) and (tonumber(avg) > 72) and (tonumber(outside) > 60) then
runScene = true
end[/quote]
If I’m reading this right I don’t think that this section will ever return true. How can t.hour be less than 7 AND greater than 18 at the same time. Were you intending it to be an OR so more like:
if (away==“0”) and ((t.hour < 7) or (t.hour > 18)) and (dayofweek~=7) and (tonumber(avg) > 72) and (tonumber(outside) > 60) then
runScene = true
end
if (away=="0") and (t.hour > 7) and (t.hour < 18) and (dayofweek~=7) and (tonumber(outside) > 60) and
(
((tonumber(avg) <= 74) and (tonumber(DewPoint) < 64))
or
((tonumber(avg) <= 72) and (tonumber(DewPoint) > 64))
)
then
runScene = true
end
I’d like <= 72 to be the trigger when the dewpoint is > 64 but <=74 to be the trigger when the dewpoint is <64 (in other words, A/C runs longer when dewpoint is high)
Yes I tried. Yesterday, the dew point was above 64 yet the AC kept shutting down when the temp hit 74. According to my arguments it should have only shut off at 72
avg represents the indoor temp, correct? Then wouldn’t you want it to be (tonumber(avg) >= 74) and (tonumber(avg) >= 72) so that the scene runs until the indoor temp has come down to either 74 or 72?
Yes, avg is indoor. I want the temp to go below (or equal) to 74 or 72 before it shuts off. Remember, this is a scene that triggers an ‘off’ function. So I think <= is correct.
Should it make a difference whether its ((tonumber(avg) <= 74) and (tonumber(DewPoint) < 64)) or ((tonumber(DewPoint) < 64) and (tonumber(avg) <= 74))?
Will that make a difference? When I was testing, the dew point was 66 yet the AC kept shutting off at 74 instead of running until 72. (If it does make a difference I would say that at 64 I would go with the 74 setting)