I currently have 7 scenes for each of my ceiling fans triggered via the room temperature and adjusting the fan speed (scenes represent 100%, 90%, 80% 70%, 60%, 55% and OFF)
This has created a lot of scenes but works OK.
What I am trying to do now is wrap each fan control into one scene.
Get temperature from thermostat, if fan is On and temperature = “X” then set fan speed at “%”
Is it possible to use decimals (ie. 77.5 - 77.6 - 77.7 etc) for the temperature set points as this would create a more fluid speed control with a wider field of adjustments than 1 degree temperature swings and the 10% adjustments I’m currently using.
The below code returns an error, but I think I’m on the right track, but how would (once the first set point works) does additional temperature references / loadleveltargets get added in? Just continue with If/Thens and luup.call_actions?
local Switch1 = 162 (State Device to bypass the temperature/speed control)
local Switch2 = 16 (Fan Dimmer)
T-stat = 14
[code]
local Switch1 = 162
local Switch2 = 16
local Light1State= luup.variable_get(“urn:upnp-org:serviceId:SwitchPower1”,“Status”, Switch1)
local Light2State= luup.variable_get(“urn:upnp-org:serviceId:Dimming1”, “LoadLevelStatus”, Switch2)
if (Light1State == “0”) or (Light2State == “0”)
then
return false
else
local lul_temp = luup.variable_get(“urn:upnp-org:serviceId:TemperatureSensor1”,“CurrentTemperature”, 14)
if ((tonumber(lul_temp) < 74
and tonumber(lul_temp) > 72)
then
luup.call_action(“urn:upnp-org:serviceId:Dimming1”, “SetLoadLevelTarget”, {newLoadlevelTarget = “50”}, 16)
return true
end[/code]
Any help greatly appreciated.
JOD.