[ST Edge] Breaking boundaries: supporting Blue Iris motion alerts and Shelly wifi Motion Sensors

Thank you! That explanation definitely helps. After restart of the ST hub, I was getting new errors.

Every couple seconds or so, I would get spammed with the message below:

Thu Jan  6 01:24:15 2022  POST command received from: ('192.168.xx.xx', 52484)
Endpoint:  /api/register?devaddr=192.168.xx.xx&edgeid=e8a1a0b7-32e4-4882-8d38-xx&hubaddr=192.168.xx.xx:60009
Port=60009
Request to register device at ('192.168.xx.xx', None)
Existing registration was REPLACED
192.168.xx.xx - - [06/Jan/2022 01:24:15] "POST /api/register?devaddr=192.168.xx.xx&edgeid=e8a1a0b7-32e4-4882-8d38-xx&hubaddr=192.168.xx.xx:60009 HTTP/1.1" 200 -
Updated registrations: [{'devaddr': ['192.168.xx.xx', None], 'edgeid': 'e8a1a0b7-32e4-4882-8d38-xx', 'hubaddr': ['192.168.xx.xx', 44331]}, {'devaddr': ('192.168.xx.xx', None), 'edgeid': 'e8a1a0b7-32e4-4882-8d38-xx'hubaddr': ('192.168.xx.xx', 60009)}]

The driver crashed so I rebooted again. Then I edited the settings causing the device to re-register with the bridge. That seems to have fixed things. I think I caused this by editing the driver while the IP for the hub was incorrect (between when I changed it and rebooted).

In continuing to review, I noticed there are usually 1 or 2 failed requests to my hub on different ports (2 failed requests but the 3rd is successful). See below –

Thu Jan  6 01:36:47 2022  GET command received from: ('192.168.xx.xx', 51722)
Endpoint:  /Cam1/motion/active

>>>>> Forwarding to SmartThings hub
Sending POST: http://192.168.xx.xx:44331/192.168.xx.xx/GET/Cam1/motion/active to 192.168.xx.xx:44331
FAILED sending message to Edge hub ['192.168.xx.xx', 44331]

>>>>> Forwarding to SmartThings hub
Sending POST: http://192.168.xx.xx:60009/192.168.xx.xx/GET/Cam1/motion/active to 192.168.xx.xx:60009
FAILED sending message to Edge hub ['192.168.xx.xx', 60009]

>>>>> Forwarding to SmartThings hub
Sending POST: http://192.168.xx.xx:50819/192.168.xx.xx/GET/Cam1/motion/active to 192.168.xx.xx:50819
Message forwarded to Edge ID e8a1a0b7-32e4-4882-8d38-xxx
192.168.xx.xx - - [06/Jan/2022 01:36:52] "GET /Cam1/motion/active HTTP/1.1" 200 -

I just wanted to pass this along as I wasn’t sure if this is expected behavior. Again, I think I’m good with the 400 errors as your explanation greatly helps me understand root cause.

Thanks again and I will do my best not to break anything again for a while.

I can offer some addition insight on what you were seeing:

The ‘spam’ messages you were seeing, which included:

Existing registration was REPLACED

Was because the driver during re-installation was caught in a infinite loop of restarting. This is a terrible bug in the Edge platform and is the issue I was referring to in my earlier posts about problems updating drivers. Although SmartThings is aware of the issues, unfortunately this being a beta platform, they have been in no hurry to issue a fix. It’s a big problem though for any LAN-type drivers. So you were correct that the driver had ‘crashed’, and luckily the reboot cleared it. (sometimes it won’t and that’s when you have to delete and reinstall the driver).

The 1 or 2 failed requests that you saw should soon disappear. This is the result of ‘old’ IP/port numbers (44331 & 60009) being still registered with the bridge server, but are no longer alive (because you rebooted the hub and they changed). These get automatically cleared out after 3 failures, so these messages should fairly soon go away.

Anyway, I’m glad you are back up and running and I appreciate the info you provided. It will help me make the driver more robust.

2 Likes

If the manufacturers will include it… The other is SmartThings’ minimalis approach to any integration. (You know the fit a circle shaped object into a square shaped hole approach.)

An MQTT client would make sense to implement as an Edge driver and use it with a local MQTT server. But running a client for each device is a bit of overkill…

We discussed this with Paul Osborne before in the Edge announcement topic.

1 Like

You are probably right on being tied to your test channel.

I am enrolled in your distribution channel and have the motion driver installed from there. I no longer see it in your test channel you messaged me, so can’t uninstall from there. If I add anything, it is still the 12-17 version. Sounds like I may need to uninstall the devices and driver, maybe wait some time, reboot, reinstall, and redo the devices?

I’m also happy to get the CLI going if there is some directions on how to do so. Thanks!

Thanks again for the explanation. Everything has been rock solid.

If you do spend any further time adding features, the ability to send a web request within the device would be the only suggestion I have to offer.

My DTH type devices always say “checking” in the dashboard presentation so absolutely love that I can see motion at a glance. I also appreciate that they all still worked even though I lost internet for about 15 minutes (I use them to trigger outdoor floods).

Thanks again and please let me know if there is anything else I can test.

1 Like

Let’s get you set up with the CLI. Then you can use that to install the updated driver. I don’t know why it wouldn’t be automatically happening as long as you explicitly selected that driver to install from my regular channel. I want to try and avoid disrupting your setup and having to recreate everything!

I’m going to assume you have a Windows machine for the instructions below, but Mac and Linux is also supported.

  • Go to this link to download the Windows zip file.
  • With Windows File Explorer, navigate to your Windows downloads folder and unzip the file (highlight the downloaded zip file and select Extract / Extract all from the menus at the top of the window). Here you can also chose where to extract the file, so I would chose C:\Users\<yourid>
  • Open a command prompt window (search for ‘command prompt’ to find the app)
  • Normally you are sitting in the C:\Users\<yourid> folder and hopefully this is where you extracted the smartthings.exe file to. If you extracted it to a different location, you’ll have to navigate to that folder first.
  • To make sure it is working type

smartthings -v

You should get the version info

  • Now try an actual CLI command and type

smartthings devices

Because you are running a command for the first time, it will open up a browser window and ask you to sign in to your SmartThings account and authorize access. Do that and then when it says you can close the browser, do so and return to your command prompt window. You should shortly see a complete list of all your Smartthings Devices (not just Edge!).

  • You’re all set. Reference this document for a list of all the commands you can use.

Please note that you CANNOT just double-click on the smartthings.exe file from the Windows File Explorer. It must be run from a command prompt window.


Some key commands you’ll probably want to use are below. Note that these are the ‘quick’ versions of these commands, which will then prompt you for any additional input needed like, selecting which hub, which driver, which channel, etc. As you get proficient, you can provide those inputs as parameters on the command line. Just reference the document above.

List installed Edge drivers:

smartthings edge:drivers:installed

Start logging:

smartthings edge:drivers:logcat

Install (or update) an Edge driver:

smartthings edge:drivers:install

Uninstall an Edge driver (you’ll need to delete all devices first):

smartthings edge:drivers:uninstall


EDIT: Some additional info as you try to update your driver…

I’d recommend opening a second command prompt window and starting logging for the driver in question there. That way you’ll be able to see what’s going on as you issue commands from the first command prompt window.

Once you’ve started logging, confirm which driver is installed by checking the version info back in your first window. Then you can try to install the newer driver. Just be sure to select my shared projects channel (ID=e6e29aeb-2793-4ebf-b8f6-e37b69e32c61), and the LAN Motion driver (ID=e8a1a0b7-32e4-4882-8d38-45a96ead543d) when prompted.

Keep an eye on the log output to make sure the install doesn’t get hung up on repeating cosock errors or just hangs. If that happens, you could try rebooting your hub. You’ll have to stop and restart logging if you do this, as it won’t automatically resume when the hub is back up. So Ctrl-c out of logging, reboot your hub, wait a couple minutes to let your hub restart, then start logging again. You’ll be able to see if the driver is quiet (that’s good) or if it is still in an endless re-install loop. If none of that is successful, then at that point I’d say you will have to delete your devices, uninstall the driver, and install it again. Wait a minute between uninstalling and installing.

4 Likes

That all worked perfectly. Driver updated and devices still properly working. Thank you again for all the work and assistance!

2 Likes

Couple of questions. Is this method going to work even when the IDE is deprecated? Currently I only use BI Fusion for motion alerts as I don’t do much with profiles at the current time (continuos recording in BI).

Second, for us that are a little green at this depth of SmartThings, any chance of a step by step walkthrough (complete with screenshots for the slower among us) for getting this up and running on our hubs? They were a tremendous help in BI Fusion and I think it would appeal to a broader group. If I had the chops to understand it all thoroughly I would make them myself and share, but alas it’s Greek to me for the most part.

Hi there. Yes, this approach is all centered around the new Edge platform (still in beta) and has no dependencies on the legacy stuff (IDE/ Groovy).

I can definitely look at beefing up the instructions. Have you read the ones here?

Admittedly, the full how-to is split between the bridge server app and the LAN Motion driver since they are two independent things, but when used together, provide a solution for local BI motion alerts. Probably between @netcsk and I, we can put a complete how-to together in short order.

2 Likes

I wrote a little something here:
[RELEASE] BI Fusion v3.0 - Adds: Blue Iris Device Type Handler, Blue Iris Camera DTH, Motion Sensing - #500 by netcsk?
It also links to another post with some BI specific commands, which probably just solidifies that it would be helpful to make a guide.

1 Like

Yes your post is how I stumbled on this haha. I haven’t tried running this method yet, mainly because from reading the install I am not exactly sure what I will be doing (again, that’s a me issue, not a dev issue). BI fusion was fairly straight forward with the guide. I remember a couple hiccups but didn’t struggle too much with them. Still plan on giving it a go, but like all kids pictures (screenshots) help me a ton lol

@TAustin it appears yesterday’s firmware update broke my motion sensors with all of them showing offline. A hub reboot did not help. Is there an easier way you know of to get them back other than deleting the devices, driver, and setting them back up?

Is is possible that the IP address of your hub changed?

Here’s what I would try:

Go in to the device settings for your SmartThings motion device(s) and temporarily change the bridge address to something else (wrong) and press OK. Wait a couple seconds, then change it back to what it should be. That will force a re-registration with the bridge server, which might be needed if the hub rebooted. Watch the bridge server log output for any errors.

If the above doesn’t work, I would restart the bridge server, then perform the steps above again.

Let me know if that gets things going again.

That worked perfectly. No hub IP changes (static IP and I confirmed the lease). Thanks!

1 Like

@TAustin, I really love this solution and I was wondering if you thought about expanding the functionality at all? I’m not sure how Shelly (or other brands) might benefit, but it would be amazing if this driver could handle an outgoing web request too.

There is a use case where I have an non-camera motion detector that I want to trigger my BI cameras. From user perspective, its easy to have a device state trigger your motion detectors but nothing makes it back to BI. Currently, I use the web requestor to do this but it would be fantastic if it was built in.

I also understand the LAN devices have had some changes in architecture so maybe we wait until we are out of beta.

Thanks again for all the fantastic work you do to support the community!

Just a thought, but is MQTT an option you’d consider? I’m working on some new solutions in this area at the moment, and since you want two-way messaging with your Blue Iris server, this might be a better overall fit for what you want to do.

What exactly are you thinking here? From your description it sounds like these would be two separate motion devices in SmartThings - one triggered BY your camera (what you have today), and the other that would send a trigger TO BI (new). So I’m assuming you’re looking for one driver that would support both scenarios? It’s certainly possible, assuming BI supports an API for incoming triggers like that. You’d have to point me to some documentation.

Tod, I do appreciate your willingness to ask for more details. To be honest, mqtt sounds amazing but I don’t know that I have capacity to learn a new language and hardware.

As far as BI http documentation, it’s fairly thorough, page 225.

Below is the url for triggering active and inactivr of a camera:
http://192.168.50.111:1234/admin?camera=CAM7&trigger=-1
http://192.168.50.111:1234/admin?camera=CAM7&trigger=0

For some reason my web requestor driver doesn’t have a menu any more so I can’t access my settings to give more examples. Let me know you need more and I’ll reinstall.

Thanks again for what you do for this community!

It may be simpler than what you are thinking. If you know how to install packages onto your BI server, I’m sure you could manage. The MQTT is kind of a load and forget kind of service. But I do appreciate the fact that it’s one more thing to deal with!

Can you elaborate? You mean you literally don’t have the three vertical-dot menu in the upper right of the device Controls screen?

We’ll figure out how to get you back up and running. Those two http requests should be super simple to get working if that’s all you really need.

So I should have taken a screen shot but it’s fixed now. So I had no status info or menu dots. I hade a couple hug resets last night that may have done it. If it was you, thanks yet again :grin:

Please let me know if/when you need me test.

Can you now add those two http requests in available slots in web requestor device Settings?

e.g…

Web Request #3
GET:http://192.168.50.111:1234/admin?camera=CAM7&trigger=1

Web Request #4
GET:http://192.168.50.111:1234/admin?camera=CAM7&trigger=0