expression to return geofence "ishome" variable [Feature Request]

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 :frowning:

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!)

I found it. It’s buried in user_data. I will add a condition type to Reactor for geofencing and pull the data out, make it reactable. Stay tuned…

OMG you are awesome!! I won’t ask how you found it, as I probably wouldn’t understand ??? ha ha. I just know the ishome / isenter / isexit all sounded like good variables to extract and possibly use for condition evaluations!

Will watch for your update! :slight_smile:

[quote=“connormacleod, post:3, topic:200389”]OMG you are awesome!! I won’t ask how you found it, as I probably wouldn’t understand ??? ha ha. I just know the ishome / isenter / isexit all sounded like good variables to extract and possibly use for condition evaluations!

Will watch for your update! :)[/quote]

I found ishome on the geofence geotags, but I don’t see any references in my userdata to isenter or isexit. Where did you dig that up?

Oh! I just saw those in the logs… the last line from my original post, where I saw the ishome variable the isenter is just prior… (i swore I saw isexit too, but maybe it was just isenter)

07 01/05/19 11:41:57.165 JobHandler_LuaUPnP::SetGeofence user: 2338371 isenter 0 id 1 device 50017188 ishome 1 <0x74185520>

I figured they’d all be stored under the same users_settings (or userdata as you found), but perhaps the ishome is the only one that’s there, and the isenter variable is in another data set? Would isenter be the better variable to be monitoring to detect geofence enter/exits?

Oh! I just saw those in the logs… the last line from my original post, where I saw the ishome variable the isenter is just prior… (i swore I saw isexit too, but maybe it was just isenter)

07 01/05/19 11:41:57.165 JobHandler_LuaUPnP::SetGeofence user: 2338371 isenter 0 id 1 device 50017188 ishome 1 <0x74185520>

I figured they’d all be stored under the same users_settings (or userdata as you found), but perhaps the ishome is the only one that’s there, and the isenter variable is in another data set?[/quote]

OK. From what I see, ishome is the only one stored, at least in my config. We’ll see if it pops out at some point. I’ve got the geofence condition implemented, and I’m shaking it down right now. I should have something up toward (my/Atlanta) evening.

Thanks Sir! Can’t wait to try it out and see if I can get it to trip a virtual switch when I enter the geofence! :slight_smile:

You will, although the VSwitch may be redundant. What are doing with that?

OH? Perhaps there’s an easier way than I’m envisioning… here’s the AND conditions I setup on the virtual switch so far. (uploading a screen cap) I just needed one final condition for the geofence to make it work I think…

Essentially:

  1. check to make sure it’s dark (i.e. not between sunrise - sunset)
  2. check to make sure the outside lights aren’t already on for some reason
  3. run in any mode (home, away, vacation, night)

and… the last condition (which you’re working on extracting from the userdata)

  1. a check when the ishome variable changes from 0 to 1 (i.e. someone entered the geofence)

So basically, when someone enters the geofence, the outside lights will turn on provided it’s dark out, and the lights are presently off, in any mode :slight_smile:

I was then going to use this virtual switch as a device trigger for a scene

does my logic seem sound?

ReactorSensors are themselves SecuritySensor1 devices (like motion and door sensors), so they can directly trigger a scene. If you go into the scene editor and choose device triggering, you’ll see your existing ReactorSensors listed there.

Since 1.5, Reactor has been able to trigger scenes itself, from the Activities tab. The advantage in letting Reactor do it is that any failure of the scene to complete due to a crash/power-fail/reload, Reactor will complete the scene when the system is back up.

And even that is now seriously old school… as of 2.0 just released, Reactor has a bunch of actions it can perform without the need to create scenes, all found on the Activities tab.

Check out this page: Activities · toggledbits/Reactor Wiki · GitHub

So indeed, no VSwitch needed… it’s redundant just adds small pieces of plumbing that don’t add value, at least in this case.

Oh nice, so I can continue with the logic I was setting up in the virtual sensor, add in the goefence piece once u get it added, and then simply execute from the activities tab inside the virtual sensor :slight_smile: nice. Sounds simpler. Can’t wait to try it

Sent from my LG-H990 using Tapatalk

[quote=“connormacleod, post:11, topic:200389”]Oh nice, so I can continue with the logic I was setting up in the virtual sensor, add in the goefence piece once u get it added, and then simply execute from the activities tab inside the virtual sensor :slight_smile: nice. Sounds simpler. Can’t wait to try it

Sent from my LG-H990 using Tapatalk[/quote]

It is time… I’ll PM you instructions.

[quote=“rigpapa, post:12, topic:200389”][quote=“connormacleod, post:11, topic:200389”]Oh nice, so I can continue with the logic I was setting up in the virtual sensor, add in the goefence piece once u get it added, and then simply execute from the activities tab inside the virtual sensor :slight_smile: nice. Sounds simpler. Can’t wait to try it

Sent from my LG-H990 using Tapatalk[/quote]

It is time… I’ll PM you instructions.[/quote]

Nope. We’re going to be denied, at least for now. So it turns out, the “ishome” value is just a flag indicating whether or not the location is your home or not. You can create multiple geofences, and mark one as your home. That’s all it is. When I tested it earlier, I created a second address at some distance from my house, and didn’t notice that the “This is my home” checkbox, which is “below the fold” on the screen, wasn’t checked. After repeating the test (location at some distance from where I am) but this time setting the checkbox, the ishome variable is 1, as it would be to match the checkbox, but that’s irrelevant as a test to see if you’re inside the geofence or not.

So, haven’t yet found where/how they store who is “home”. The answer may be… they don’t, at least, not on the Vera itself.

you and I must have been testing this at the same time!! I literally just took a run a couple miles from my place to test whether or not the ishome variable changed. I got the notification on my phone when I exited the geofence and re-entered…, but you are right, the value of the ishome variable didn’t change :frowning: As such, the condition just stayed true, it didn’t flip to false, and then back to true again when I re-entered the geofence as I’d have hoped.

Damn we’re cheated lol!!! You did such an awesome job programming, and the code even enumerated the users I have defined and put them as checkboxes beside the geofence condition! so I do have to say that’s some super nice work~!

Makes sense though, guess the ishome variable is just identifying whether the geofence is the home location. :frowning:

must be the other variable I found in the logs, the “isenter”, I see that one flips between 0 & 1 quite often in my log history…

JobHandler_LuaUPnP::SetGeofence user: 2338371 isenter 1 id 1 device 50017188 ishome 1 <0x73985520>

But I think you mentioned this one didn’t show up in the user settings. Wonder where Vera has this one buried…

[quote=“connormacleod, post:14, topic:200389”]you and I must have been testing this at the same time!! I literally just took a run a couple miles from my place to test whether or not the ishome variable changed. I got the notification on my phone when I exited the geofence and re-entered…, but you are right, the value of the ishome variable didn’t change :frowning: As such, the condition just stayed true, it didn’t flip to false, and then back to true again when I re-entered the geofence as I’d have hoped.

Damn we’re cheated lol!!! You did such an awesome job programming, and the code even enumerated the users I have defined and put them as checkboxes beside the geofence condition! so I do have to say that’s some super nice work~!

Makes sense though, guess the ishome variable is just identifying whether the geofence is the home location. :([/quote]

I’ve seen plenty of complaints about the geofencing, which is among the reasons why I’ve stayed away from it, but now trying to figure this thing out, I really understand why people are so frustrated with it. Up until a few minutes ago, I could move in and out of my geofence and get the notification from the app. But only once have I seen a call to “SetGeoFence” in my logs. Now, when I go in and out of the geofence, I don’t even get notices, and no logged calls. Didn’t change anything in the app or Vera, it just stopped. And when I try and log in at Getvera.com, it just loops.

I’m going to walk away from this today and take another cut at it tomorrow.

[quote=“rigpapa, post:15, topic:200389”][quote=“connormacleod, post:14, topic:200389”]you and I must have been testing this at the same time!! I literally just took a run a couple miles from my place to test whether or not the ishome variable changed. I got the notification on my phone when I exited the geofence and re-entered…, but you are right, the value of the ishome variable didn’t change :frowning: As such, the condition just stayed true, it didn’t flip to false, and then back to true again when I re-entered the geofence as I’d have hoped.

Damn we’re cheated lol!!! You did such an awesome job programming, and the code even enumerated the users I have defined and put them as checkboxes beside the geofence condition! so I do have to say that’s some super nice work~!

Makes sense though, guess the ishome variable is just identifying whether the geofence is the home location. :([/quote]

I’ve seen plenty of complaints about the geofencing, which is among the reasons why I’ve stayed away from it, but now trying to figure this thing out, I really understand why people are so frustrated with it. Up until a few minutes ago, I could move in and out of my geofence and get the notification from the app. But only once have I seen a call to “SetGeoFence” in my logs. Now, when I go in and out of the geofence, I don’t even get notices, and no logged calls. Didn’t change anything in the app or Vera, it just stopped. And when I try and log in at Getvera.com, it just loops.

I’m going to walk away from this today and take another cut at it tomorrow.[/quote]

Whoa… I got it. I think. Having traversed the geofence one time successfully, there’s a new data structure in user_data… five minutes, I’ll have something for you to play with…

[quote=“rigpapa, post:15, topic:200389”]I’ve seen plenty of complaints about the geofencing, which is among the reasons why I’ve stayed away from it, but now trying to figure this thing out, I really understand why people are so frustrated with it. Up until a few minutes ago, I could move in and out of my geofence and get the notification from the app. But only once have I seen a call to “SetGeoFence” in my logs. Now, when I go in and out of the geofence, I don’t even get notices, and no logged calls. Didn’t change anything in the app or Vera, it just stopped. And when I try and log in at Getvera.com, it just loops.

I’m going to walk away from this today and take another cut at it tomorrow.[/quote]

Ya it seems kinda buggy doesn’t it?? Sure would be cool to get it working, if we can find the right variable to poll.

I always seem to get the notifications on my app when I move in and out of the geofence… but there has been times I’ve gone to the logs to try and find an entry with the timestamp I know should exist… and can’t find it.

Appreciate all the time you’ve spent on this today! (and tomorrow!), still awesome progress dude!! :slight_smile:

ha ha! I`m still up another hour so sure lol! Make sure you get some sleep though, must be gettin late in GA!

;D ;D ;D ;D PMing you now with new instructions for a one-file update…

I have a ticket open for this very issue. Not hearing much back though :frowning:

C

[quote=“Catman, post:19, topic:200389”]I have a ticket open for this very issue. Not hearing much back though :frowning:

C[/quote]

It’s kinda good to know I’m not the only one! I was testing a beta piece of reactor code that rigpapa sent me last night, and after he got logic piece working, the geofence on my vera app stopped working, which it hasn’t done before, so I couldn’t test the new code.

Geofence has stopped sending a message on exit or entry. grrr… frustrating. Going to try to kill the app, and drive through the geofence again and see what happens.