Simple Blue Iris I/O using Shelly1 Wi-Fi Devices

TonyR

IPCT Contributor
Joined
Jul 15, 2014
Messages
16,451
Reaction score
38,163
Location
Alabama
Simple Blue Iris I/O using Shelly1 Wi-Fi Devices

I spent hours assembling the info and the images but could not post, not sure why, maybe it was too lengthy. Anyway, I still wanted to share so below you find a PDF attached of the process to use Shelly Wi-Fi switches to send input to BI and to act on output from BI.

Enjoy!

shelly1.jpg
 

Attachments

Last edited:

Sphinxicus

Getting comfortable
Joined
Aug 30, 2017
Messages
174
Reaction score
341
Location
Ireland
I also seemed to miss this when you posted it and came to this via another thread and wanted to say thanks for taking the time to write this up and share it! :clap:
 

Bob Ebaugh

n3wb
Joined
Jan 16, 2019
Messages
5
Reaction score
2
Location
St. Petersburg, FL
Thanks for posting this! It's exactly what I was looking for. I already have the parts, been using the dusk to dawn timer in a Shelly to turn 3 sets of floods on/off at dusk/dawn. But to be more energy efficient, figure I can use the camera motion alerts in Blue Iris to act like a motion detector.
 

djborden

Getting the hang of it
Joined
Jul 19, 2017
Messages
50
Reaction score
25
Older thread, but I wanted to drop in and thank @TonyR for taking the time to write this up. I purchased one of the Shelly1 devices to test using Tonys instructions for a Blue Iris /Alarm project I am working on and I needed some sort of script controlled relay triggered out of Blue Iris and this has worked perfectly so far and it is super easy to setup.

Thank you again Tony!

David
 
Last edited:

TonyR

IPCT Contributor
Joined
Jul 15, 2014
Messages
16,451
Reaction score
38,163
Location
Alabama
Older thread, but I wanted to drop in and thank @TonyR for taking the time to write this up. I purchased one of the Shelly1 devices to test using Tonys instructions for a Blue Iris /Alarm project I am working on and I needed some sort of script controlled relay triggered out of Blue Iris and this has worked perfectly so far and it is super easy to setup and so far has worked perfectly.

Thank you again Tony!

David
That's great news! I'm glad it's working for you and thanks for the positive feedback! :cool:
 

Bob Ebaugh

n3wb
Joined
Jan 16, 2019
Messages
5
Reaction score
2
Location
St. Petersburg, FL
For anyone else looking at this, it took me a couple days to figure out how to make this integration work.

My requirements were this:

1) If it's after dark;
2) and there is a motion trigger
3) from any one of multiple cameras
4) then turn on the lights connected to the Shelly device for X period
5) but only if they aren't already on (could be a previous trigger OR the wall switch wired to the Shelly is already ON)

I think this cost me about 4 hours effort per line of code. But it's been a few years and the syntax here is new and unforgiving. What happened to BASIC or COBOL?

Anyway...hope this helps someone. There are likely many more applications possible to integrate Shelly and Blue Iris. Shelly is like a Swiss Army knife for power automation.

Best Bob

-----------------

Code Snips:

Security system invokes this script if motion is sensed. Basically if the light was already On, the request gets dropped in the big bucket, otherwise it turns the light on for 300 seconds.

--- Blue Iris in camera config Alert/On Alert/Actions for each camera (only for BI night time profile):

172.22.21.79/rpc/Script.Start?id=10
172.22.21.79/rpc/Script.Stop?id=10

The IP address is the one assigned to the Shelly MAC address by my router. You could also hard assign one in the Shelly config. This is a HTTP:/ action.

--- Script 10 in Shelly Device (the Print statements only needed for debugging):

Shelly.call("Switch.GetStatus", {'id': 0}, function (chk) {
if (chk.output === false) {
print("Light was Off")
Shelly.call("Switch.set", {'id': 0, 'on': true, 'toggle_after':300})
print("Light is now On");
}
});

There probably is a more elegant way of coding this in the Shelly so that you don't need both the start and stop script commands. But this worked and I celebrated success.
 

djborden

Getting the hang of it
Joined
Jul 19, 2017
Messages
50
Reaction score
25
One thing I am looking to do is to change profiles when my our Honeywell Alarm system is armed. They have a dry contact relay system that can be used to either close or open a relay.

I would like to have the shelly device take this signal and when the relay is triggered from arming our security system to send a command to Blue Iris to change a profile.

Any chance @TonyR or @Bob Ebaugh can provide some tips on how to do this?

David
 

Bob Ebaugh

n3wb
Joined
Jan 16, 2019
Messages
5
Reaction score
2
Location
St. Petersburg, FL
Hmmm...I looked at both sides enough to determine what you want to do looks possible. You probably already know that. But the details are the reverse of what I did. What I posted above is an example of BI controlling a Shelly device. Your application requires a Shelly device to send BI a setting change. It's a different rabbit hole.

Both BI and Shelly have HTTP and MQTT interfaces. While in my rabbit hole I looked at trying to use MQTT. It's a much more robust interface. Also more complicated since you need a MQTT server. I'd only suggest that if you want to build a complete Home Automation system that uses it. So I'm thinking the HTTP interface is probably the easier solution.

If the BI computer and the Honeywell alarm are anywhere near each other and you can pull copper wire between them, there could be other options not requiring a network interface of any kind.

I think the best Shelly device for this is likely a Uni, see:


It's designed to work with voltages and signal levels likely available in your alarm panel.

Wish I had more details. Maybe one of the BI experts could post an example HTTP command to set an active profile. That would save lots of time.
 

TonyR

IPCT Contributor
Joined
Jul 15, 2014
Messages
16,451
Reaction score
38,163
Location
Alabama
One thing I am looking to do is to change profiles when my our Honeywell Alarm system is armed. They have a dry contact relay system that can be used to either close or open a relay.

I would like to have the shelly device take this signal and when the relay is triggered from arming our security system to send a command to Blue Iris to change a profile.

Any chance @TonyR or @Bob Ebaugh can provide some tips on how to do this?

David
The dry contact from the alarm can be an input to the Shelly so that it will issue the HTTP command to Blue Iris, as found in the PDF document I attached in post #1. The action is VERY fast.

Try this:

From BI's built-in "Help" under "Administration" => "HTTP Interface" => "Admin commands":

/admin?profile=x&lock=y. Set the active profile to x. Use x=-1 to toggle the lock status, or set the lock=y, 0=run, 1=temp, 2=hold​

An example with no authentication in URL:


An example with authentication in URL (Under BI "Settings" => "Web server" => "Advanced", insure that "Use secure session keys and login page" is NOT checked:

EDIT @ 0718 CT 5/20/23: although the Shelly Uni is a great device, IMO the Shelly1 is more suitable in this instance: it has a built-in terminal block for all connections, will operate in the voltage range of those in your alarm panel and is ready-to-mount in that it's encased in its own plastic shell.
 
Last edited:

djborden

Getting the hang of it
Joined
Jul 19, 2017
Messages
50
Reaction score
25
@TonyR, @Bob Ebaugh I really appreciate you taking the time to respond and provide some ideas on how to accomplish my goal. Once my other Shelly1 comes in, I will start the testing. I spoke to my alarm guy today and he can provide a dry contact relay either NC or NO. The alarm and BI system are close enough I can run copper between them if needed. These little devices are very flexible and inexpensive.
 

CanCuba

Known around here
Joined
Dec 9, 2020
Messages
1,114
Reaction score
3,325
Location
Havana, Cuba
@TonyR, @Bob Ebaugh I really appreciate you taking the time to respond and provide some ideas on how to accomplish my goal. Once my other Shelly1 comes in, I will start the testing. I spoke to my alarm guy today and he can provide a dry contact relay either NC or NO. The alarm and BI system are close enough I can run copper between them if needed. These little devices are very flexible and inexpensive.
I bought these recently. Dirt cheap (for Amazon, AliExpress is always cheaper) and work great. Adjustable for low (0 - 4v) and high (4.5v - 12v) triggers and can handle more than enough amperage for most applications.

 

TonyR

IPCT Contributor
Joined
Jul 15, 2014
Messages
16,451
Reaction score
38,163
Location
Alabama
I bought these recently. Dirt cheap (for Amazon, AliExpress is always cheaper) and work great. Adjustable for low (0 - 4v) and high (4.5v - 12v) triggers and can handle more than enough amperage for most applications.

Those are good, I've used these similarly to allow camera and NVR outputs to switch loads of higher voltages and current.

But when I've needed something to send or receive and process HTTP or MQTT commands AND switch loads, I've gone with the Shelly1-UL. I'm thinking in the near future I'll be using the Shelly1 Pro that has Ethernet AND Bluetooth!
 
Last edited:
As an Amazon Associate IPCamTalk earns from qualifying purchases.

djborden

Getting the hang of it
Joined
Jul 19, 2017
Messages
50
Reaction score
25
@TonyR, I am wondering if I should go with the Shelly1 Pro for Ethernet for the added reliability of ethernet? Have you or anyone else had a shelly1 device go offline for any reason? It's only passing a very small amount of data when called, so assume they are reliable assuming the wifi signal is robust.

Ethernet does add cost and time due to pulling cables and a more expensive device, but I would do that if the wifi version is not super reliable.

Also, do you know the benefit of the UL version of the wifi units? Is it just UL certified so can be used in situations that require the certification, or is the device different?
 

djborden

Getting the hang of it
Joined
Jul 19, 2017
Messages
50
Reaction score
25
@CanCuba, thanks for the link.

I used a similar relay device to interface with the "Alarm Out" of the Dahua cams for my project, so I would not have to go through Blue Iris for the trigger, and just use the Dahua AI for person and vehicle detection..

The problem I ran into, was I did not see a way to enable and disable the alarm out based on a signal from our alarm system. If it is possible, I would re-explore and test that option as well.
 

TonyR

IPCT Contributor
Joined
Jul 15, 2014
Messages
16,451
Reaction score
38,163
Location
Alabama
@TonyR, I am wondering if I should go with the Shelly1 Pro for Ethernet for the added reliability of ethernet? Have you or anyone else had a shelly1 device go offline for any reason? It's only passing a very small amount of data when called, so assume they are reliable assuming the wifi signal is robust.
The Shellys-1's I have on Wi-Fi have been very reliable but then they're not used in mission-critical applications.
Also, do you know the benefit of the UL version of the wifi units? Is it just UL certified so can be used in situations that require the certification, or is the device different?
IMO, the UL-listing is worth it because I have confidence it is current-limited, made with non-flame supporting plastics and tested so it's MUCH less likely to catch on fire and burn down the house. And trust me...homeowner's insurance companies will look for any reason to NOT pay a claim and I've come to understand that if a non-UL listed/certified dveice is found to be the fire's origin, they'll deny the claim and you'd be in for a fight.

Last year (or maybe 2021) I accidentally hooked up a 24VDC 2 amp wall wart to a Shelly1 that was pinned for 12VDC and let the magic smoke out....that's all it did. The plastic was slightly melted, it smoked a tiny bit, was discolored and it stunk but no flames.
 
Top