We have moved at community.getvera.com

Author Topic: Read "IsHome"value by user for geofence  (Read 177 times)

Offline connormacleod

  • Sr. Newbie
  • *
  • Posts: 28
  • Karma: +2/-0
Read "IsHome"value by user for geofence
« on: January 08, 2019, 12:10:18 am »
Hi Everyone!

I'm still rather new at this, so I hope someone can point me in the right direction.  I'm using a geofence, and I want to use a virtual switch (probably reactor?) to determine if each user is home, so I can then conditionally run a scene. (turn the lights on, when either user enters the geofence, not just when no users are at home).    I know there is an "ishome" variable that get's set by the controller when a user enters or exits a geofence. But I don't know how I can read this value into a variable I can use in my reactor scene :(

here's the logs, u can see by the last line, it's setting a value for "ishome" when I exit the geofence..

JobHandler_LuaUPnP::HandleActionRequest device: 0 service: urn:micasaverde-com:serviceId:HomeAutomationGateway1 action: SetGeoFence <0x74185520>
08   01/05/19 11:41:57.164   JobHandler_LuaUPnP::HandleActionRequest argument serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1 <0x74185520>
08   01/05/19 11:41:57.164   JobHandler_LuaUPnP::HandleActionRequest argument action=SetGeoFence <0x74185520>
08   01/05/19 11:41:57.164   JobHandler_LuaUPnP::HandleActionRequest argument userId=2338371 <0x74185520>
08   01/05/19 11:41:57.164   JobHandler_LuaUPnP::HandleActionRequest argument event=Exit <0x74185520>
08   01/05/19 11:41:57.164   JobHandler_LuaUPnP::HandleActionRequest argument deviceId=50017188 <0x74185520>
08   01/05/19 11:41:57.165   JobHandler_LuaUPnP::HandleActionRequest argument GeofenceId=1 <0x74185520>
07   01/05/19 11:41:57.165   JobHandler_LuaUPnP::SetGeofence user: 2338371 isenter 0 id 1 device 50017188 ishome 1 <0x74185520>

So from the above, I can get the ServiceID of the geofence, myuserid, and the deviceid

So... I tried building this little piece of code with some snippets off the forums to see if I can extract the value of ishome, but I must be doing something wrong, because all I get is "OK"

service = "urn:micasaverde-com:serviceId:HomeAutomationGateway1"
device = "50017188"
resultCode, resultString, job, returnArguments = luup.call_action(service, "users_settings", { userId = 23338371} , device)
local name, value
for name,value in pairs(returnArguments) do
  --luup.log("Debug Name: " .. name)
  --luup.log("Debug Value: " .. value)
  print("Debug Name: " .. name, "Debug Value: " .. value)
end


Can anyone advice as to how I can extract the value of the ishome variable for each userid, so I can make use of it in a reactor virtual switch?



« Last Edit: January 08, 2019, 12:13:17 am by connormacleod »