I did add the updated code to my veralite. The light that would normally trigger will not trigger. If the light that is being triggered is already on when triggered it doesn’t go off after the delay in the scene is reached.
I did add the updated code to my veralite. The light that would normally trigger will not trigger. If the light that is being triggered is already on when triggered it doesn’t go off after the delay in the scene is reached.
Any thoughts?[/quote]
Sorry @kiether, I don’t understand what your problem is. Are you saying that the scene does not now turn on the light at all? Even when the door is opened during the specified time period?
If the light that is being triggered is already on when triggered it doesn't go off after the delay in the scene is reached.
Isn't that what you wanted to happen?
Maybe I don’t understand what you want to happen. Can you explain how you want it to work?
I guess i was trying to give to much information. You are correct the trigger to turn on the light when the door is open is not working after i added the code.
You are correct the trigger to turn on the light when the door is open is not working after i added the code.
Is the light using a regular Z-Wave switch or is it a dimmer? Some dimmers don't update [b]SwitchPower1 Status[/b] in which case you may need to check [b]LoadLevelStatus[/b] instead.
@keithr, try this code and post the section from LuaUPnP.log where you test it.
[code]local switchOnOff = luup.variable_get(“urn:upnp-org:serviceId:SwitchPower1”, “Status”, 32)
if (switchOnOff == “1”) then
luup.log(“Scene Debug: Light is already on.”)
return false
end
luup.log(“Scene Debug: Light is off.”)
local endTime = “23:59”
local ssTime = luup.sunset() % 86400
local hour = math.floor(ssTime / 3600)
local minute = math.floor((ssTime % 3600) / 60)
if startTime <= endTime then
– Both the start time and the end time are in the same day:
– if the current time is in the given interval, run the scene.
if startTime <= currentTime and currentTime <= endTime then
return true
end
else
– The start time is before midnight, and the end time is after midnight:
– if the current time is not outside the given interval, run the scene.
if not (endTime < currentTime and currentTime < startTime) then
return true
end
end
luup.log(“Scene Debug: Skipping actions.”)
return false[/code]
Attached is the log, I think it captured it correctly. The first part of the log is with the triggered light off when the door sensor is tripped. The second part is with the triggered light on when the door sensor is tripped.
Thank you again for taking time to help me with this.
I changed the time zone to mexico, when my veralite restarted i confirmed it was showing the correct time in mexico. I then reset it back to where it should be, reloaded the code you supplied and we will see what happens this evening.
@RexBeckett If you have any other suggestions please let me know.
If your Timezone, City, Latitude and Longitude are all correct but Sunrise and Sunset are still wrong, I have no idea what’s broken - raise an MCV Support ticket.
One last thought before i submit a help ticket. I have the day/night app installed and i use it to turn on and off outdoor lights. It works fine. Doesn’t the sunset/sunrise information that app uses come from the same place the code here gets its information?
Day/Night uses Vera’s luup.call_timer(…) function to get callbacks for sunrise and sunset. The times should be the same as those returned by luup.sunrise() and luup.sunset() but, on your system, are apparently not.
I have a smart switch that turn on the living room lights if a motion is detected and turn it off after 1 minute. But whenever I’m watching tv and someone walks in the light goes on. I want to convert the smart switch to a PLEG action ( which I can easily do ) but I want this scene to only run if XBMC is not playing. I have the XBMC addon installed. Any help with that ?
[quote=“Ramiii, post:57, topic:178331”]Here is my scenario
I have a smart switch that turn on the living room lights if a motion is detected and turn it off after 1 minute. But whenever I’m watching tv and someone walks in the light goes on. I want to convert the smart switch to a PLEG action ( which I can easily do ) but I want this scene to only run if XBMC is not playing. I have the XBMC addon installed. Any help with that ?[/quote] @Ramiii, would you mind posting this question on the Program Logic Plugins board? Thanks.
@RexBeckett no problem. But I don’t want this to be done using PLEG. I mean the condition. I’ll just use PLEG for the lights and Luup code for the condition , that’s why I posted here
Well you got me confused. Smartswitch, PLEG, XMBC…
If your problem is with determining if XMBC is playing, I cannot help you as I don’t use it. You may have more success posting your question on the XMBC plugin thread so another user can assist you.