Indigo and location changes

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
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
Perry The Cynic
Posts: 857
Joined: Mon Apr 07, 2008 9:46 pm

Indigo and location changes

Post by Perry The Cynic »

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
User avatar
matt (support)
Site Admin
Posts: 21542
Joined: Mon Jan 27, 2003 1:17 pm
Location: Texas
Contact:

Re: Indigo and location changes

Post by matt (support) »

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
Perry The Cynic
Posts: 857
Joined: Mon Apr 07, 2008 9:46 pm

Re: Indigo and location changes

Post by Perry The Cynic »

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
User avatar
matt (support)
Site Admin
Posts: 21542
Joined: Mon Jan 27, 2003 1:17 pm
Location: Texas
Contact:

Re: Indigo and location changes

Post by matt (support) »

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
AndrewGWalsh
Posts: 67
Joined: Wed Feb 20, 2013 5:23 am

Re: Indigo and location changes

Post by AndrewGWalsh »

Yet.
User avatar
jay (support)
Site Admin
Posts: 19232
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

Re: Indigo and location changes

Post by jay (support) »

LOL.
Jay (Indigo Support)
Twitter | Facebook | LinkedIn
Locked

Return to “Extending Indigo with Plugins and Python”