House mode set times

i have a function that sets the house mode for the house depending locations of our phones and also time for night mode. since serveral things get called depending on the house mode, i want to check that the house mode is set before i continue. i have a loop that checks the current state vs. the new state after calling this code:

[code]luup.call_action("urn:micasaverde-com:serviceId:HomeAutomationGateway1","SetHouseMode", {Mode = newHouseMode}, 0)	[/code]

it works fantastic for home/away/vacation, but for some reason, setting the mode for night takes forever. does anyone know why it takes so long to set night mode? in case it is needed, here is my very simple code for the wait loop:

local count = 0 while currentHouseMode ~= newHouseMode do if count < retries then luup.sleep(300) status, currentHouseMode = luup.inet.wget("http://127.0.0.1:3480/data_request?id=variableget&Variable=Mode",0) currentHouseMode = tonumber(currentHouseMode) else sendNotification("ERROR setting HOUSE MODE" , "SMS") return false end count = count + 1 end

You might have a delay in the vera house mode. Go all the way to the bottom of the screen, there is actually a delay parameter for non home house mode settings.

thought about that, and checked. no delay there. the weird thing is that from home → away, away → vacation, Away → home, and even Night → home all work almost immediately. it’s just the home → night that takes forever.

I looked at your code and found it interesting that you want it to notify you when it fails to change housemode. I am actually doing the opposite and have it notify me when the house mode changes successfully (by TTS or notification). I have never seen it fail to change actually and have implemented it with a 2s delay. Not quite sure why night mode would have a delay as I am not seeing it…

yeah, i am trying to make it more of a synchronous process. as soon as the mode finishes changing i set the security cameras (enabled at night/away/vacation and disabled when home), I also lock doors and set off some lighting. i guess i am going to have to change the functions and add a watcher on house mode to call the functions for the security cameras.

well, apparently you cannot set a watcher for house mode natively, had to install the House Modes plugin, but now things seem to be working. thanks!

Aren’t you already using Reactor? It has conditions for house mode, and also has a watchable/event-sending variable (HouseMode in service urn:toggledbits-com:serviceId:Reactor on the Reactor master device) you can use externally.

Aren’t you already using Reactor? It has conditions for house mode, and also has a watchable/event-sending variable (HouseMode in service urn:toggledbits-com:serviceId:Reactor on the Reactor master device) you can use externally.[/quote]

i didn’t even think about that! You sir are my hero!

As usual, Rigpapa had the answer. All working now.