Changing the status of node during scene activation based on temperature

I have checked the forum and help files but cant find the answer

I have several devices in this scene
The code below works at running the scene or blocking it from running based on temperature
When true it works out and I get the result I wanted
When false it blocks the scene I would like the scene to run but change the status of node 10 to off
Node 10 uses D_BinaryLight1.xml

local dID = 13 – Device ID of your thermostatic/temperature sensor
local tLow = 1 – Lowest temperature of range
local tHigh = 19 – Highest temperature of range
local allow = true – true runs scene when in range, false blocks it
local tCurrent = tonumber((luup.variable_get(“urn:upnp-org:serviceId:TemperatureSensor1”,“CurrentTemperature”,dID)))
return (((tCurrent >= tLow) and (tCurrent <= tHigh)) == allow)

You have two options:

(1) Use two scenes - one for each case - with the Lua code in each. In the Off scene, set allow to false.

(2) Implement the action directly in the Lua code instead of returning true or false. This would look something like this:

local dID = 13 -- Device ID of your thermostatic/temperature sensor local tLow = 1 -- Lowest temperature of range local tHigh = 19 -- Highest temperature of range local allow = true -- true runs scene when in range, false blocks it local tCurrent = tonumber((luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1","CurrentTemperature",dID))) if (((tCurrent >= tLow) and (tCurrent <= tHigh)) == allow) then luup.call_action("urn:upnp-org:serviceId:SwitchPower1", "SetTarget", {newTargetValue = "1"}, 10) return true else luup.call_action("urn:upnp-org:serviceId:SwitchPower1", "SetTarget", {newTargetValue = "0"}, 10) return false end

This assumed device 10 is a switch. For other device types, see Service IDs, Variables and Actions.

If you use option 2, remove the existing action for device 10 from the scene.

I have several devices in this scene

I’m not sure what you wanted to do about this. The code above still blocks the scene according to the temperature range. This is easy to change by adjusting the two return statements.

Or do this in a single PLEG device.