GeoFence - the Beacon replacement plugin

Posted on
Thu Jul 28, 2022 6:44 pm
FlyingDiver offline
User avatar
Posts: 7210
Joined: Jun 07, 2014
Location: Southwest Florida, USA

GeoFence - the Beacon replacement plugin

Design goals:

NO port forwarding required - used Indigo reflector instead.

Indigo 2022.X (Python3) compatible.

Support multiple Geofence type apps. Right now, I am only able to test Locative. I can't seem to find the other apps the original plugin supported on the iOS app store.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Thu Jul 28, 2022 11:35 pm
GlennNZ offline
User avatar
Posts: 1562
Joined: Dec 07, 2014
Location: Central Coast, Australia

Beacon replacement plugin

Great idea!

Thanks for taking this on - as It is in regular use by me. Using the reflector address is a great idea.

Geofency - seems to be the most common (or at least was)
https://www.geofency.com/

This sends a “webhook” command for each location with a enter/exit that previous Beecon plugin would create devices and then update location based on these enter/exit’s.
(The good thing about Geofency is appears to use wifi network range and GPS location - so moment wifi connected it sends update - in my usage is within seconds of arrival)

Glenn


Sent from my iPad using Tapatalk

Posted on
Fri Jul 29, 2022 6:56 am
FlyingDiver offline
User avatar
Posts: 7210
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Beacon replacement plugin

https://github.com/FlyingDiver/Indigo-B ... g/2022.0.3

Supports all beacon types from original plugin. Only Locative and Geofency have been tested,

Geofency supports both POST and POST (JSON), but not GET.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Fri Jul 29, 2022 7:21 am
FlyingDiver offline
User avatar
Posts: 7210
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Beacon replacement plugin

I'm hoping this is a drop-in replacement for the original plugin. The only required change should be to put a Reflector API key in the plugin config in place of the server Port. You will need to edit the URL on your geofence apps to the new reflector URL, which is printed to the Indigo log on plugin restart.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Fri Jul 29, 2022 9:30 am
jltnol offline
Posts: 994
Joined: Oct 15, 2013

Re: Beacon replacement plugin

So I'm sure I've got something setup wrong, but when trying a test with Locative, I get this error message:
Code: Select all
Web Server Warning              You are not authorized to access that resource "http://indigodomo.net:15940/" from indigo @ 127.0.0.1

Note that I've enable HTTP Basic Authentication in the Locative app, and have tried using both the login credentials for the Indigo Server, as well as my Indigo store login, but still get the same error message, or a slight variation of the 'from' part.

When I start up my Indigo Server, that page indicates that my Reflector is "active", I have checked the box concerning "Enable OAuth and API....", and can use the Reflector URL with the iOS Touch app to connect to the server.... So while I think I've got all that setup correctly, I'm still getting the above error message with Locative, so I must be missing something......

Posted on
Fri Jul 29, 2022 9:35 am
FlyingDiver offline
User avatar
Posts: 7210
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Beacon replacement plugin

jltnol wrote:
So I'm sure I've got something setup wrong, but when trying a test with Locative, I get this error message:
Code: Select all
Web Server Warning              You are not authorized to access that resource "http://indigodomo.net:15940/" from indigo @ 127.0.0.1

Note that I've enable HTTP Basic Authentication in the Locative app, and have tried using both the login credentials for the Indigo Server, as well as my Indigo store login, but still get the same error message, or a slight variation of the 'from' part.

When I start up my Indigo Server, that page indicates that my Reflector is "active", I have checked the box concerning "Enable OAuth and API....", and can use the Reflector URL with the iOS Touch app to connect to the server.... So while I think I've got all that setup correctly, I'm still getting the above error message with Locative, so I must be missing something......


If you have the correct URL with the API Token, all other authentication should be disabled. There is no username/password. The API token handles that.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Fri Jul 29, 2022 9:37 am
FlyingDiver offline
User avatar
Posts: 7210
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Beacon replacement plugin

The URL you use should look something like:

Code: Select all
https://XXXX.indigodomo.net/message/se.furtenbach.indigo.plugin.beacon/webhook?api_key=XXXX-XXX-XXX-XXX-XXX

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Sat Jul 30, 2022 12:29 am
GlennNZ offline
User avatar
Posts: 1562
Joined: Dec 07, 2014
Location: Central Coast, Australia

Beacon replacement plugin

Update:

Geofency working well for me:

One Error on setting up - clicked on link - created a GET and got below, but working fine since.

Further to below: Think that was an inadvertent click on the link I emailed to myself to copy and paste into iPhone.

Code: Select all
incoming_request_method : GET (string)
   Beacon Error                    Exception: 'key Content-Type not found in dict'
Traceback (most recent call last):
  File "plugin.py", line 231, in process_message
    ctype = action_props['headers']['Content-Type']
KeyError: 'key Content-Type not found in dict'


Only minor issue is the URL is loooongg... hard to type into iPhone etc.
But can use tinyurl.com as free service to come up with shorter 8 character URL...
But then again, once setup, once and done - so far better than having to worry about port forwarding!

Thanks Joe!

Glenn

Posted on
Sat Jul 30, 2022 2:57 am
FlyingDiver offline
User avatar
Posts: 7210
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Beacon replacement plugin

GlennNZ wrote:
Only minor issue is the URL is loooongg... hard to type into iPhone etc.
But can use tinyurl.com as free service to come up with shorter 8 character URL...


Email it to yourself or put it in a Note, then copy and paste...

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Sat Jul 30, 2022 5:16 am
GlennNZ offline
User avatar
Posts: 1562
Joined: Dec 07, 2014
Location: Central Coast, Australia

Re: Beacon replacement plugin

Yep - that’s what I did.
But for other devices - not my account - slightly more difficult - but again SMS to them and copy and paste. Doable - and as said the removal of port forwarding a huge benefit, as that is far harder for some to setup!

All going well!


Sent from my iPad using Tapatalk

Posted on
Sat Jul 30, 2022 10:58 am
jltnol offline
Posts: 994
Joined: Oct 15, 2013

Re: Beacon replacement plugin

Ok
So I still can't get this to work with either Locative or Geofency.

I'm 99.9% sure I've got the reflector set up correctly as I am able to access my Indigo Server with the Touch app thru the cell network when not at home.

I've checked "Enable OAuth and API Key authentication" in the server startup page.

I've installed the new plugin, and have re-started the Indigo Server, gone to the plugin configure page, have entered the API key and have enabled debugging. Obviously, both Enable Locative and Enable Geofency are checked.

In the Locative app, under settings, I have entered my reflector URL and clicked "Send Test-Request", but all I get is a "Note" in the app saying a Test Request has been sent, but nothing happens in the Indigo log.

In the Geofency app, in one of my locations, I've gone to the Webhook settings, entered the new Reflector URL and have clicked "Enter" and I get a long string of HTML code in the app in a popup window with this text at the top: "FAILED", and this text at the bottom: "You are not authorized to access that resource", but nothing in the Indigo Log.

So I'm sure I'm just doing something wrong, but can't figure out what it is.

I've gone as far as creating a new API key, tried using just HTTP without the "s". I've copied and pasted the Reflector URL as well, so no typing errors. Since the Touch app can access the server without any changes to my router, I'm assuming I don't need to do anything to get Beacon to work in that regard... but still can't get the apps on my phone to access the plugin on the server. :(

Posted on
Sat Jul 30, 2022 11:49 am
FlyingDiver offline
User avatar
Posts: 7210
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Beacon replacement plugin

PM me a screenshot from the Locative app showing the URL, and also the log when restarting the plugin with debug enabled.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Sat Jul 30, 2022 8:17 pm
GlennNZ offline
User avatar
Posts: 1562
Joined: Dec 07, 2014
Location: Central Coast, Australia

Re: Beacon replacement plugin

Can I add what happens if copy and paste in a Safari window on the Indigo Mac?

Posted on
Sat Jul 30, 2022 8:18 pm
GlennNZ offline
User avatar
Posts: 1562
Joined: Dec 07, 2014
Location: Central Coast, Australia

Re: Beacon replacement plugin

Can I add what happens if copy and paste the URL in a Safari window on the Indigo Mac?

Posted on
Sat Jul 30, 2022 8:19 pm
FlyingDiver offline
User avatar
Posts: 7210
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Beacon replacement plugin

GlennNZ wrote:
Can I add what happens if copy and paste in a Safari window on the Indigo Mac?


Huh?

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Who is online

Users browsing this forum: No registered users and 2 guests