Indigo and location changes

Forum rules

This is a legacy forum which is locked for new topics. New topics should be started in one of the other forums under Extending Indigo

Posted on
Fri Jun 07, 2013 11:53 am
Perry The Cynic offline
Posts: 836
Joined: Apr 07, 2008

Indigo and location changes

Indigo has a neat call for telling me what geographic location it uses. I take this and feed it to a software layer that caches the location (because some calculations depend on it, or because I fetched information about it, etc.)

How does Indigo tell me that the location has changed? This could be either because the user has edited the preference, or because Indigo uses the system default and the laptop has moved. :-)

Cheers
-- perry

Posted on
Fri Jun 07, 2013 12:58 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Indigo and location changes

Can you elaborate on what you are looking for here? Indigo has the API but no type of trigger or change callback hook for it. You can, of course, cache off the value and periodically call the API to see if it has changed.

Image

Posted on
Fri Jun 07, 2013 1:34 pm
Perry The Cynic offline
Posts: 836
Joined: Apr 07, 2008

Re: Indigo and location changes

Can you elaborate on what you are looking for here? Indigo has the API but no type of trigger or change callback hook for it. You can, of course, cache off the value and periodically call the API to see if it has changed.


Of course I can poll periodically, but polling sucks.

The easy way would be a Plugin method that gets called whenever there's a change to what server.getLatitudeAndLongitude() would return. Call that when the preference is changed, or when the system location changes. (You are getting notifications about this, right? Or at least checking when the system wakes up?)

If the location were a state or property or variable, then us interested developers could just register for change notifications and you'd be all set. (Of course, here we run into the fascinating limitations of the current implementation as to the supported types of these various things. The location is a tuple.)

I can work around this particular issue by re-checking upon wake-up, and by just sternly telling my users to restart my plugin whenever they change the Indigo preference. But I'd like you to give some thought to unifying instance attributes, utility function results, plugin properties, device properties, and device states into something that can be observed in a uniform way. 'cause that's easier on all of us... and 'cause Python can totally do this (with descriptors).

Cheers
-- perry

Posted on
Fri Jun 07, 2013 2:08 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Indigo and location changes

You'll have to poll or check it on startup.

As you know we do provide hooks for notifications on when devices and variables change which are critical for HA plugins. I agree it would be neat to have a change publish/subscribe system for every possible preference/setting/attribute/state in Indigo, that isn't going to happen anytime soon. There is quite a bit that is higher on our priority list, like supporting additional hardware, improving the UI (and giving plugins the ability to show custom UI/states/etc.), and upgrading Indigo Touch.

Keep in mind we are just a couple of guys here (that have to do a lot more than just development) and not a $400 billion market cap tech giant. ;-)

Image

Posted on
Fri Jun 07, 2013 2:48 pm
AndrewGWalsh offline
Posts: 67
Joined: Feb 20, 2013

Re: Indigo and location changes

Yet.

Posted on
Fri Jun 07, 2013 3:21 pm
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Indigo and location changes

LOL.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 3 guests