Beacon: a Geohopper/Beecon plugin

Plugins that users have built. NOTE: plugins that were developed for Indigo versions older than 2022.1 will have to be updated to work with Indigo 2022.1 (Python 3 - see this blog post for details). If the plugin listed here is not in the Plugin Store (which will show updated plugins) then you will need to ask on the appropriate thread below if it has been updated and where you get get the update.
User avatar
DaveL17
Posts: 7323
Joined: Tue Aug 20, 2013 11:02 am
Location: Chicago, IL, USA
Contact:

Re: Beacon: a Geohopper/Beecon plugin

Post by DaveL17 »

Yes, it was through Geohopper Mac.

As I recall, other forms of notification required turning off digest authentication (which I'm not willing to do.)
I came here to drink milk and kick ass....and I've just finished my milk.

My Plugins and Scripts
User avatar
Grognard
Posts: 84
Joined: Tue May 17, 2011 8:28 pm
Location: Seabrook, TX
Contact:

Re: Beacon: a Geohopper/Beecon plugin

Post by Grognard »

I'm having good success with using Geohopper with the webhook approach, though you do have to open a port to your server. That said, with three beacons from the two canoes (Geohopper) guys, I'm making some real strides toward the holy grail of presence detection (especially with our two teens who ALWAYS have their phones with them.

Haven't played with the Geohopper Mac app yet, admittedly.
User avatar
jay (support)
Site Admin
Posts: 19232
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

Re: Beacon: a Geohopper/Beecon plugin

Post by jay (support) »

Hi Tim, welcome to Indigo. There appears to be an intermittent bug in Mac OS X (that's been getting progressively worse with every release) that causes an odd AppleScript failure (-600 Application not running even though it is) that sometimes causes AppleScripts trying to target our server to fail - that's what people are referring to.
Jay (Indigo Support)
Twitter | Facebook | LinkedIn
User avatar
tperfitt
Posts: 8
Joined: Sat Feb 21, 2015 3:21 pm
Location: Naperville, IL
Contact:

Re: Beacon: a Geohopper/Beecon plugin

Post by tperfitt »

I got my starter indigo starter kit, and it is way cool. I am starting small to understand the requirements for reliable beacons performance. I started by triggering a light to turn on when I entered my home office into range of one of our beacons and it works reliably. I didn't use Geohopper for Mac, since I wanted to verify that the web hooks worked with the Beecon plugin. Set up was a breeze.

I did have to adjust my power settings a bit on the beacon and am having some issues with the fact that my kitchen is under my office, and if I set the power to cover my whole office, the light will go on when I am in the kitchen. I also see an issue where it takes a few seconds to turn on the light, and that can be annoying. I don't think the issue is really a beacon issue, but rather how radio waves travel through walls and how it can take a few seconds for iOS to detect the beacon, wake up the app, ping a web server, and then notify the indigo server. I suspect that if I add in the ability to do local web hooks (instead of going through our server), this may resolve some time delays and make it a bit more responsive.

As for the beacon signal traveling through walls, I have a couple of ideas:

1. Have a "negative" beacon. So if geohopper is in range of a beacon as well as another beacon, don't do the web hook. I could then put a beacon in the kitchen at low power, and set up a rule to not turn on my office light if in range of both beacons. I suspect that the rules could get pretty complicated pretty quickly.
2. Set a minimum power / signal strength power requirement. Geohopper could do a scan and see if it minimum threshold is reached and only call the web hook if that is the case. I worry that this will cause further delays since scanning can take a bit longer (a few seconds...).

I am also looking at adding in some variables for web hooks so that it can pass the UUID/Major/Minor and user defined key/values to do some better logic on the server side.

Pretty cool stuff. Let me know if anyone has any suggestions on the above (or requests for features for geohopper). I'm going to look in to the applescript issue of Mac geohopper next. You can call python scripts from Mac Geohopper, and I see the Indigo has python script interface, and I have it turned my light on with some basic python commands. I'll get that hooked up and hopefully post some steps on what I did.

tim perfitt
developer of geohopper
twocanoes.com
User avatar
jay (support)
Site Admin
Posts: 19232
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

Re: Beacon: a Geohopper/Beecon plugin

Post by jay (support) »

Nice, thanks for the update. Now if I could only find the time to experiment myself...
Jay (Indigo Support)
Twitter | Facebook | LinkedIn
User avatar
mabrown
Posts: 39
Joined: Sat Dec 08, 2012 10:51 pm

Re: Beacon: a Geohopper/Beecon plugin

Post by mabrown »

Nice work! Got Geohopper and the plugin setup in under 5 minutes.

I want to do something more then my location on a map though, I see the hardware beacons available, is it possible to use a Mac with bluetooth LE as a beacon? I'm going for something like I walk in my office and my lights come on to start with and since I have a new iMac that's always here and on that would be the natural fit. Just curious if anyone else has done this without the external usb hardware beacons.
hdfreak
Posts: 19
Joined: Thu Jan 01, 2015 10:26 am

Re: Beacon: a Geohopper/Beecon plugin

Post by hdfreak »

So, I followed the instructions for installing GeoHopper and was having no luck getting the event viewer to show any activity or for the plugin to auto generate the device using the "test" button on the iOS app. I even sent a tech support email off to GeoHopper folks. Then when I left for work this morning, BAM! Fired off the event and created the device. So, have they changed something with the app so that tests don't actually send the POST command to the IP/port indicated and only sends it to their own Mac companion app (as I could see all of my tests on their app)?

I'll have to see if my Indigo triggers work properly when I get home today, but it looks promising.

Thanks for developing the plugin!

Brian

---

PS Just got a reply back from GeoHopper. They confirmed that the test button on a location does not send out a POST, but a test on a beacon would.
gskarp
Posts: 156
Joined: Thu Apr 19, 2012 4:50 pm

Re: Beacon: a Geohopper/Beecon plugin

Post by gskarp »

This works great! Nice job.
User avatar
tornado
Posts: 109
Joined: Mon Jun 30, 2014 5:56 pm

Re: Beacon: a Geohopper/Beecon plugin

Post by tornado »

mabrown wrote:Nice work! Got Geohopper and the plugin setup in under 5 minutes.

I want to do something more then my location on a map though, I see the hardware beacons available, is it possible to use a Mac with bluetooth LE as a beacon? I'm going for something like I walk in my office and my lights come on to start with and since I have a new iMac that's always here and on that would be the natural fit. Just curious if anyone else has done this without the external usb hardware beacons.
Have you checked this out yet?

https://github.com/mlwelles/BeaconScanner

and

https://github.com/mttrb/BeaconOSX
However BeaconOSX looks like it requires < 10.10 to run.

and

https://github.com/lgaches/BeaconEmitter
User avatar
mabrown
Posts: 39
Joined: Sat Dec 08, 2012 10:51 pm

Re: Beacon: a Geohopper/Beecon plugin

Post by mabrown »

Thanks I'll check those out and see what I can do..


Sent from my iPhone using Tapatalk
midd
Posts: 374
Joined: Sun Apr 18, 2010 3:00 pm

Re: Beacon: a Geohopper/Beecon plugin

Post by midd »

I've been trying to get this to work. I believe I have it setup correctly on the iOS App side. I used the check IP link and used that for the URL in the Web service menu. I typed http://that number:6192

I made sure to forward the 6192 from a public TCP port to the the private TCP port to the private ip address(10.0.1.11) in which indigo is installed on.

I think my problem is on the indigo side. When I first configured the plugin, I wasn't getting a new device created even though I had it checked off to do so. I would have to manually create a device.

But even after manually creating a device, when I try and test it it on the app side, nothing happens in my event log.

This is what i do see in the event log after reloading the plugin:

Code: Select all

May 7, 2015, 1:35:30 PM
  Beacon Debug                    validating Prefs called
  Beacon                          Preferences were updated.
  Beacon Debug                    loadpluginPrefs called
  Beacon Debug                    Created device of type ""
  SQL Logger                      creating table device_history_1060382799 for "new device"
  Beacon Debug                    new device: Starting device

May 7, 2015, 1:36:53 PM
  Indigo Cocoa client disconnected
  Indigo Cocoa client connected

May 7, 2015, 1:44:27 PM
  Trigger                         Zone 1

May 7, 2015, 1:45:00 PM
  Schedule                        solar power

May 7, 2015, 1:46:26 PM
  Reloading plugin "Beacon 1.2.0"
  Stopping plugin "Beacon 1.2.0" (pid 4593)
  Beacon Debug                    My iPhone: Stopping device
  Beacon Debug                    Shutdown called
  Stopped plugin "Beacon 1.2.0"
  Starting plugin "Beacon 1.2.0" (pid 6851)
  Started plugin "Beacon 1.2.0"
  Beacon Debug                    Startup called
  Beacon Debug                    My iPhone: Starting device
  Beacon Debug                    Starting HTTP listener thread
  Beacon                          Listening on TCP port 6192
M4 Mac mini.
flic
Posts: 128
Joined: Thu Nov 30, 2006 1:35 pm
Location: Lidingö, Sweden

Re: Beacon: a Geohopper/Beecon plugin

Post by flic »

midd wrote:I've been trying to get this to work. I believe I have it setup correctly on the iOS App side. I used the check IP link and used that for the URL in the Web service menu. I typed http://that number:6192

I made sure to forward the 6192 from a public TCP port to the the private TCP port to the private ip address(10.0.1.11) in which indigo is installed on.

I think my problem is on the indigo side. When I first configured the plugin, I wasn't getting a new device created even though I had it checked off to do so. I would have to manually create a device.

But even after manually creating a device, when I try and test it it on the app side, nothing happens in my event log.
Looks like you're not getting any connections to Beacon. What app are you using on your iPhone?

This is a very simple Python script to test your setup, try running it on a computer on the inside and the outside of your firewall and check the results.

Code: Select all

#! /usr/bin/env python
# -*- coding: utf-8 -*-

import urllib, urllib2,json

url = 'http://your-server-ip:6192'
values = {"sender":"sender-name","location":"your-location","event":"LocationEnter","time":"2014-04-28 17:56:06 +0000"}

data = json.dumps(values)
req = urllib2.Request(url, data)
req.add_header('Content-Type', 'application/json')
response = urllib2.urlopen(req)
print response.geturl()
print response.info()
the_page = response.read()
print the_page
midd
Posts: 374
Joined: Sun Apr 18, 2010 3:00 pm

Re: Beacon: a Geohopper/Beecon plugin

Post by midd »

I'm using Geohopper.


I don't know if I'm doing the script right.I know nothing about Python. I tried using EditRocket. And I got this:

Code: Select all

Traceback (most recent call last):
  File "url.py", line 12, in <module>
    response = urllib2.urlopen(req)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 127, in urlopen
    return _opener.open(url, data, timeout)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 404, in open
    response = self._open(req, data)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 422, in _open
    '_open', req)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 382, in _call_chain
    result = func(*args)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1214, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1184, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error [Errno 8] nodename nor servname provided, or not known>
M4 Mac mini.
midd
Posts: 374
Joined: Sun Apr 18, 2010 3:00 pm

Re: Beacon: a Geohopper/Beecon plugin

Post by midd »

well I came home today to find that my Beacon device was created today. After tearing my eyes and hair out reading this thread a billion times, I see that I erred in thinking that the beacon plugin would create the device right after configuring the plug in. Apparently you have to leave it clicked on automatically create the device. But since test wouldn't work for me, I would suggest actually creating a geofence for your home and leave the area and the device should be created once there's a change in location for your mobile device.

The only issue I'm having now is now that I'm home and Geohopper has notified me that I am home, my device state is still showing absent. I'll have to re-read to see about that.


Can I use more than one device for this? Ever since I added my wife's phone, mine isn't recognized anymore. It was always showing absent even while in my geofence. I deleted my phone as a device and now indigo will not see it again to re-create it as a new device.
M4 Mac mini.
midd
Posts: 374
Joined: Sun Apr 18, 2010 3:00 pm

Re: Beacon: a Geohopper/Beecon plugin

Post by midd »

Can I use more than one device for this? Ever since I added my wife's phone, mine isn't recognized anymore. It was always showing absent even while in my geofence. I deleted my phone as a device and now indigo will not see it again to re-create it as a new device. My wife's phone appears to be working just fine with this plugin
M4 Mac mini.
Post Reply

Return to “User Plugins”