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 in reactor to determine when a user enters a geofence so I can then conditionally run a scene.
Essentially, I want to turn the lights on, when any authorized user that’s setup enters the geofence, not just when no users are at home (vera’s native controls only allow a geofence to flip between house modes when no one is home, and when 1 person comes 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 some relevant 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 see 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
I think all I really need is to be able to extract the value of the ishome in an expression, that I could then use for conditions in reactor. Has anyone successfully built an expression snippet to poll this variable by user ID?
(open to any other ideas that someone may have who’s already successfully done something like this!)