Edgebridge

I’m creating a new, dedicated topic for my Edgebridge application, which was originally discussed in this topic:

Edgebridge is an application you run on an always-on computer on your LAN that provides two useful functions:

  1. Gives you the ability to send HTTP(s) messages to endpoints outside your LAN (similar to a Proxy)

    • Normally, Edge drivers can only communicate with endpoints on your LAN
    • Initiate these requests from either my webrequestor (github | topic) driver or from a custom Edge driver
    • Use cases: need to retrieve info from any internet endpoint that provides a RESTful API, e.g. SmartThings API, weather data, etc.
  2. Provides a simple mechanism for LAN-based applications and devices to integrate with Edge drivers.

    • Use cases: motion notification from external sources such as Blue Iris, device monitors such as phone presence trackers or pingers, generic triggers from applications or devices
    • Edge device drivers are available for easy integration for motion, presence, and basic triggers

Edgebridge supports both http and https request forwarding.

Please see my readme file on github for complete details.


Today I’m announcing an update to edgebridge with the following new features:

  • standardized logging output with control of console vs file logging
  • configurable timeout for forwarded requests
  • forwarding of request body data now supported in POST and GET requests
  • Optional SmartThings Edge device to monitor edgebridge online/offline status

If you are a current user of edgebridge, you can download the new files from the github repository when you are ready. Be sure to update your edgebridge.cfg file, as it can contain new options.

Please note that the updated edgebridge application is required to use the optional SmartThings edgebridge online/offline monitoring device.

I have also added instructions to the readme file for setting up autoloading at boot time on a Raspberry Pi.

10 Likes

@brbeaird is creating something similar for his MyQ integration. It looks like his will be purpose built, but there may be some overlap. I saw it in this thread [RELEASE] MyQ Lite Door and Lamp Control (for Liftmaster/Chamberlain) - #2720 by brbeaird

2 Likes

Is a version that could run on an Android phone or tablet possible? Many of us Android devices that are aways running and could serve as a bridge.

I’m sure it’s possible, but outside my know-zone right now.

2 Likes

Pydroid 3?

They have Python library on Android? That would interesting. I have iOS so can’t experiment.

2 Likes

Yeah I saw this early on and considered it, but I really don’t want users to have to enter in IP address, so I ended up using SSDP for discovery, which then auto handles the IP.

I definitely share the sentiment of feeling like there should be a way to consolidate this since there is going to be a ton of overlap in LAN drivers that are all basically doing the same thing, but I’m just not sure things are set up well to really do that cleanly.

3 Likes

I’ve heard that the ST team is planning to release SSDP in the driver SDK at some point, but you can’t really wait on it. May allow some cleanup down the road.

works great and it starts when my pi reboots ,the edgebridge monitor works well
thanks very much for all the hard work ,
much apreciated
martin

1 Like

FYI, my UPnP driver and library provides full UPnP specification support on Lua (including SSDP) for anyone wanting to write a driver that uses it. It certainly is an option for developers, but not a solution for end-users.

Edgebridge provides a much simpler solution for anyone that can send an http request to integrate with SmartThings. There are lots of applications that provide this option (Blue Iris, for example), so this fits the need of non-programmers.

Another alternative, of course is MQTT, which I have available as well.

3 Likes

Due to a bug in the most recent edgebridge app, I’ve uploaded fresh files for edgebridge.py, edgebridge.exe and edgebridge4pi.

The issue this fixes is seen when you are sending a GET request from a device application to a hub driver, through edgebridge. In certain cases this may cause an error to be logged by edgebridge and the Edge driver not receiving the message.

To update your edgebridge server app, simply download the applicable file from the github repository, replacing the one on your computer, and stop and restart the edgebridge server app.

Thank you to @Puzzling for identifying this problem.

4 Likes

Nice driver! Can this be used to dynamically populate a message that contains device information (switch state, temperature reading, etc…)? I’m trying to migrate from WebCore, another fantastic app, and send data to Google Sheets from WebCore and am looking for a replacement. On a side note, I can’t paste into the Web Request fields on my Android phone, am I the only one?

Edgebridge can’t help you with that.

There is very little capability in standard SmartThings that would allow you to build a dynamically populated message like that. You may need to look at something like Action Tiles or Node Red. Otherwise you would need a SmartApp and a place to run it.

1 Like

@TAustin, is there some peculiar reason why I can not have your EdgeBridge running on the same machine as the “LAN Device Address” defined in the LAN Motion Settings?

I ask because I can change the LAN Device Address to any valid IP that is NOT the IP of the EdgeBridge:

Thu Oct 13 17:20:12 2022  **********************************************************************************
Thu Oct 13 17:20:12 2022  DELETE request received from: ('192.168.2.199', 57312)
Thu Oct 13 17:20:12 2022  Endpoint: /api/register?devaddr=192.168.2.185&edgeid=xxxxxxxx-32e4-4882-8d38-45a96ead543d&hubaddr=192.168.2.199:56221
Thu Oct 13 17:20:12 2022  Request to remove registration ('192.168.2.185', None)
Thu Oct 13 17:20:12 2022  Registration 0 DELETED
Thu Oct 13 17:20:12 2022  Response sent
Thu Oct 13 17:20:12 2022  Updated registrations: []
Thu Oct 13 17:20:12 2022  **********************************************************************************
Thu Oct 13 17:20:12 2022  POST request received from: ('192.168.2.199', 57314)
Thu Oct 13 17:20:12 2022  Endpoint: /api/register?devaddr=192.168.2.186&edgeid=xxxxxxxx-32e4-4882-8d38-45a96ead543d&hubaddr=192.168.2.199:56221
Thu Oct 13 17:20:12 2022  Request to register device at ('192.168.2.186', None)
Thu Oct 13 17:20:12 2022  Registration record ADDED
Thu Oct 13 17:20:12 2022  Response sent
Thu Oct 13 17:20:12 2022  Updated registrations: [{'devaddr': ('192.168.2.186', None), 'edgeid': 'xxxxxxxx-32e4-4882-8d38-45a96ead543d', 'hubaddr': ('192.168.2.199', 56221)}]
Thu Oct 13 17:20:26 2022  **********************************************************************************
Thu Oct 13 17:20:26 2022  DELETE request received from: ('192.168.2.199', 57318)
Thu Oct 13 17:20:26 2022  Endpoint: /api/register?devaddr=192.168.2.186&edgeid=xxxxxxxx-32e4-4882-8d38-45a96ead543d&hubaddr=192.168.2.199:56221
Thu Oct 13 17:20:26 2022  Request to remove registration ('192.168.2.186', None)
Thu Oct 13 17:20:26 2022  Registration 0 DELETED
Thu Oct 13 17:20:26 2022  Response sent
Thu Oct 13 17:20:26 2022  Updated registrations: []

That last update (the empty ) had the IP Address as 192.168.2.182, which is the same IP as the EdgeBridge and BI.

Am I missing something?

Thank you for your help and these awesome services/drivers!

p.s.
I am using LAN Motion Version 2022-08-24T01:24:40.024036401 and the EdgeBridge.exe from GitHub posted 5 days ago.

p.p.s
This also results in the .registrations file being 0 bytes.

There’s no problem configuring a device IP address to be the same address as the bridge server, so that’s not the problem. You can certainly have a device application running on the same machine.

Not sure why your registration was deleted, created, then deleted again. I would suggest starting fresh and creating another LAN Motion device (use the button at the bottom of the Controls screen, probably with an ‘Untitled’ label), then delete your old one, then configure the new one. Configure the bridge address LAST. Watch the edgebridge log to ensure the registration was successfully made as soon as you save the bridge address.

Also please note:

  • port number is optional for the the device address
  • port number is mandatory for the bridge server address

Since you mentioned it, what is the ‘Untitled’ control?

Sorry for the label issues. That button is used to create additional devices.

Is the fact that it shows ‘Untitled’ something that we have to wait for SmartThings to fix?

There is a “workaround” we’ve been given, so I can fix it. I just have so many to fix I haven’t gotten through them all yet. But I will!

1 Like

So instead of fixing it, they’re asking everyone making an Edge driver to implement a workaround? How annoying.