Need some newbie Lua scripting help please!!! ![]()
I have tried this numerous ways using a virtual switch/device and this doesnt seem to be working. I am not doing something right if someone would be so kind to point me in the right direction or to correct me please?
The virtual switch is a binarylight device representing if the house is occupied or not. Virtual switch is labeled as Inhabited Device, Device#94 - Status: 0 = Unoccupied, 1 = Occupied.
I am trying to make a scene where the lights will be triggered by a timer, based on whether or not the house is occupied or not. I have not yet added the timer as I could not get this to work without the timer.
If device#94 has a status of 1, meaning occupied, then the light will come on. If device#94 has a status of 0, meaning unoccupied, then the light will not turn on.
urn:schemas-upnp-org:device:BinaryLight:1
This is what I have tried thus far:
[b][This always turns the light on, and doesnt seem to return false when device#94 actually has a status of "0".][/b]local in_device=luup.variable_get(“urn:upnp-org:serviceId:BinaryLight1”,“Status”,94)
if (in_device == “0”) then
return false
else
return true
end[This never seems to activate the light, and doesnt seem to return true when device#94 actually has a status of “1”.]
local in_device=luup.variable_get(“urn:upnp-org:serviceId:BinaryLight1”,“Status”,94)
if (in_device == “1”) then
return true
else
return false
end[This never seems to activate the light, and doesnt seem to return true when device#94 actually has a status of “1”.]
local in_device=luup.variable_get(“urn:upnp-org:serviceId:BinaryLight1”,“Status”,94)
if not (in_device == “1”) then
return false
end[please excuse the rather messy scripting below, sought in desperation. This below is the same as the two above. Doesnt seem to return true when device#94 actually has a status of “1”.]
local in_device=luup.variable_get(“urn:upnp-org:serviceId:BinaryLight1”,“Status”,94)
if not (in_device == “1”) then
return false
else
return true
end
Is the service ID that I am using incorrect or is the {“Status”} that I am using incorrect?
Please help if anyone can, thank you so much!!!