Author Topic: House mode set times  (Read 1602 times)

Online sebby

  • Sr. Member
  • ****
  • Posts: 268
  • Karma: +9/-3
House mode set times
« on: November 09, 2018, 12:30:03 pm »
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: [Select]
luup.call_action("urn:micasaverde-com:serviceId:HomeAutomationGateway1","SetHouseMode", {Mode = newHouseMode}, 0)
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:

Code: [Select]
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

Offline rafale77

  • Hero Member
  • *****
  • Posts: 1410
  • Karma: +71/-24
Re: House mode set times
« Reply #1 on: November 09, 2018, 01:47:52 pm »
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.
openLuup (97 devices, 134 scenes, 20 apps) controlling HomeAss + VeraPlus (138 zwave nodes, 8 Zigbee nodes, 205 devices, 20 scenes , 2 app) Bridged to Homekit and Alexa. VeraPlus ExtRooted!

Online sebby

  • Sr. Member
  • ****
  • Posts: 268
  • Karma: +9/-3
Re: House mode set times
« Reply #2 on: November 09, 2018, 06:00:52 pm »
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.

Offline rafale77

  • Hero Member
  • *****
  • Posts: 1410
  • Karma: +71/-24
Re: House mode set times
« Reply #3 on: November 09, 2018, 06:13:41 pm »
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...
openLuup (97 devices, 134 scenes, 20 apps) controlling HomeAss + VeraPlus (138 zwave nodes, 8 Zigbee nodes, 205 devices, 20 scenes , 2 app) Bridged to Homekit and Alexa. VeraPlus ExtRooted!

Online sebby

  • Sr. Member
  • ****
  • Posts: 268
  • Karma: +9/-3
Re: House mode set times
« Reply #4 on: November 09, 2018, 06:33:45 pm »
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. 

Online sebby

  • Sr. Member
  • ****
  • Posts: 268
  • Karma: +9/-3
Re: House mode set times
« Reply #5 on: November 09, 2018, 07:15:59 pm »
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!

Offline rigpapa

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 759
  • Karma: +115/-1
Re: House mode set times
« Reply #6 on: November 09, 2018, 08:46:55 pm »
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.
Author of Reactor, DelayLight, SiteSensor, Rachio, Deus Ex Machina II, Intesis WMP Gateway, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3 sandbox.

Online sebby

  • Sr. Member
  • ****
  • Posts: 268
  • Karma: +9/-3
Re: House mode set times
« Reply #7 on: November 09, 2018, 09:29:56 pm »
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.

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

Online sebby

  • Sr. Member
  • ****
  • Posts: 268
  • Karma: +9/-3
Re: House mode set times
« Reply #8 on: November 10, 2018, 03:53:44 pm »
As usual, Rigpapa had the answer.  All working now.