Author Topic: API: is it better to use "user_settings" or "geofences"  (Read 909 times)

Offline chef

  • Newbie
  • *
  • Posts: 18
  • Karma: +0/-0
API: is it better to use "user_settings" or "geofences"
« on: December 15, 2016, 11:33:08 am »
Hello, I am finding that the REST API json request result a little unstable.

I use my home AI server to poll the Vera for various reasons.

However, when requesting geofence info for "ishome" information for my users, I can see that sometimes "user_settings" does not update itself and reads "0" even if I am home, where as requesting geofence info and reading the "PK_User" info will read correctly as "1".

Then, sometimes the PK_User info reads incorrectly and the "user_settings" "ishome" info will update correctly.

Strange stuff! 

Which object would be best to try and read the correct info?

Thanks guys!
« Last Edit: December 15, 2016, 08:25:21 pm by chef »

Offline chef

  • Newbie
  • *
  • Posts: 18
  • Karma: +0/-0
Re: API: is it better to use "user_settings" or "geofences"
« Reply #1 on: December 17, 2016, 07:53:00 am »
Well it would seem that my issue has happened yet again.

My internet went down and "user_settings" json object now read "ishome:":"0" for both me an my wife, and the "PK_User" object "ishome" read "1".

Yesterday it was the opposite.


I may end up creating my own geofence, somehow.

Offline pulpman52

  • Sr. Newbie
  • *
  • Posts: 40
  • Karma: +1/-0
Re: API: is it better to use "user_settings" or "geofences"
« Reply #2 on: March 08, 2017, 02:00:36 pm »
I am trying to figure out how I can set virtual switches based on individual iduser numbers. I am trying to use the ishome variable for each user to set a Vswitch but I am not sure how to get the information out of http://<ip>:3480/data_request?id=user_data&output_format=xml.

Once I have the information I am not sure how I could monitor it, but if you could tell me how you are getting it I would be one step closer.

Offline reneboer

  • Hero Member
  • *****
  • Posts: 1301
  • Karma: +72/-30
Re: API: is it better to use "user_settings" or "geofences"
« Reply #3 on: March 09, 2017, 05:15:16 am »

I use the following solution. I have the MultiSwitch plugin installed and one instance I have a button assigned per person's phone. I use two simple scenes with the geofence enter/exit as the trigger to turn the matching button off or on set on each (android) phone. That way I can see who is home or not. Also added some code triggered by the button states to determine someone is home or not and based on that I set the Vera's Home/Away status. Sounds a bit cumbersome you might say, but I have near 100% reliable (meets WAF standard!) multi user geofencing working for two years now.

So works without poking into the undocumented at random changing Vera internals. I basically stopped trying that.

Cheers Rene
2xVeraLite, VeraEdge, openLuup, ALTUI, 20 switches, 10 dimmers, 20 sensors, 10 scene controllers, 1 Harmony Hub, many plug-ins. Not enough time.