[DEPRECATED] [RELEASE] Blue Iris Fusion - Integrate SmartThings and Blue Iris!

smartapp_security
project_cameras
smartapp_cameras

#1

Note, BI Fusion v3.0 is out and offers major upgrades, warranting a new thread. A lot of the info in this thread is still good, but I recommend visiting the new one:

Hello all,

Do it all in one app! Blue Iris Fusion combines profile integration with camera triggering so you SmartThings Modes and sensors can update Blue Iris’ profile and trigger it’s cameras to record. You can connect SmartThings to Blue Iris via local IP connection (LAN) or over the normal external cloud connection (WAN).

Simply install the parent app (which has the login info so you don’t have to do it multiple times), setup the Blue Iris Profiles, and then add triggers (it calls the child app) for each camera. As noted, be careful when entering your camera name (it’s the short name in Blue Iris, and is case sensitive), and your URL. If you’re using HTTPS, this works great, but you’ll need a SSL certificate from a Certificate Authority, as self-signed certificates won’t work with SmartThings.

Hope this helps!

Parent App:
https://github.com/flyjmz/jmzSmartThings/tree/master/smartapps/flyjmz/blue-iris-fusion.src

Child App:
https://github.com/flyjmz/jmzSmartThings/tree/master/smartapps/flyjmz/blue-iris-fusion-trigger.src

Plus Now There is a Device Type for Blue Iris!

FAQ:

How do I install it?
In the SmartThings API, Create a new Smartapp, and either do it by code and copy the code from the links above, or add my Github repository to your Github Integration settings:
Owner: flyjmz
Name: jmzSmartThings
Branch: master

You need to add both the parent and the child app to your SmartThings API SmartApps, but I recommend only publishing the Parent App (publishing will put it in the list of “My Apps” when you’re on your phone, only the parent app needs to be ‘installed’ on the phone).

One you’ve added them to the API, open the SmartThings app on your phone, add an automation, and you’ll find the “Blue Iris Fusion” app under the “My Apps” category. Only install the “Blue Iris Fusion” app, do not install the “Blue Iris Fusion - Trigger” app.

Then follow the directions on screen.

What settings are important in Blue Iris?
Go to Blue Iris Options, the Web server tab, under Advanced, make sure Secure only is unchecked and Authentication must be at the least set to Non-LAN only. This enables the login to work, but also uses a less secure method of login. If you are using it LAN only and do not port-forward or otherwise expose your Blue Iris server to the Internet, then there is no need to worry. If you do have it set up for external logins (i.e. to log into the BI server when you’re away), then please make sure you have secured that connection in another way. I recommend two different approaches:

  1. VPN. You can set up a VPN server on your computer, a network device like a Synology server, or on your router using DD-WRT firmware (which is a relatively simple and doesn’t cost anything if you have a good router already). The VPN will take care of all the security, it’s as if you don’t expose it to the internet but you can still reach the server! I have a how-to, PM me if you want to know more.
  2. HTTPS. Blue Iris has stunnel integration. it’s not to difficult to set this up either. You port forward the BI server but secure the connection so you login and viewing are all encrypted. I have a extensive how-to at the bottom of this post for reference.

Can this work the other way? Can I use it to trigger SmartThings actions when the camera detects motion (e.g. to trigger a light to turn on)?
No, it only transmits to BI, it doesn’t receive. You have some good options though:

  • I use a virtual motion sensor DTH and create a device for each camera in SmartThings
  • Then in IFTTT I use the maker channel for Blue Iris Alerts to send a GET command (Alerts tab for each camera’s settings):
    BI Web Alert
  • Enter the IFTTT Maker address in the first box (don’t include the http:// or https:// since it’s in the dropbox)
  • Ignore the POST text field, and check the “Request again when trigger is reset” for the “motion off” commands. This is an additional maker channel. For example, you could have kitchenMotionOn and kitchenMotionOff for the virtual motion sensor’s “active”/'not active" status updates.
  • Finally I have two applets in IFTTT for each camera, one that has the maker channel receiving the camera motion alert turn on the virtual motion SmartThings device I created for the camera, and the other that turns off the virtual motion.
  • Those virtual motion sensors then can be used as normal sensors in any other SmartThings automation.

Or: Use a purpose-built smart app that “listens” for BI motion alerts:

I ultimately used the IFTTT option because every time you open the settings on one of those smartapps the web address regenerates, forcing you to retype it into Blue Iris. I think if you did it via webcore it’d be a lot simpler, especially because you can just copy and paste from the browser to Blue Iris, and because you may be able to modify the webcore piston without it changing the address.

What is the difference between WAN and LAN?
LAN = Local area network, WAN = Wide area network. For BI Fusion setup, LAN specifically means all traffic will stay on your home network, nothing out to the cloud (the SmartThings hub sends commands directly to the computer running Blue Iris). The WAN setup differs by having the SmartThings cloud send the commands to your Blue Iris computer.

The only functional differences are that the WAN option provides feedback if Blue Iris didn’t actually receive the command (no way to make this happen within this app alone when using LAN), and the WAN setup requires opening a port so the cloud can reach your Blue Iris computer.

I can think of few situations that WAN would be a better fit, primarily if you have your SmartThings hub on a different network than your Blue Iris computer. I would imagine most people would use LAN.

Updates:

  • Version 2.6 (2.5 for trigger) uploaded to Github. Added contact closing and switch turning off to trigger options.

  • Version 2.6 (2.4 for trigger) uploaded to Github. Corrected Null error for profile naming within notificaitons when using in LAN (local) mode. Thanks @Zaxxon!

  • Version 2.5 (2.4 for trigger) uploaded to Github. Slight tweak to notifications to give more control to what kind of notifications show.

  • Version 2.4 (2.3 for trigger) updated in GitHub, long awaited notifications support for triggers added!! You can now set up separate notifications for each trigger app and the profile changer. Be sure to update your app and open up preferences to set what you want!

  • Version 2.3 added to Github. Added a setting in preferences to turn debug logging on or off (defaults off). Good idea to have it off once it’s working because it logs your password in the debug log while it’s on (which is secured by your Smartthings login but might as well stay safe!)

  • Version 2.2 adds a note in setup to ensure your Blue Iris Webserver setting for “Secure Only” is unchecked if you want to run it locally.

  • MAJOR RELEASE! Version 2.1 combines Blue Iris Profile integration and camera triggering in this one app, and now it also can work via a local connection instead of just external. Also added time-based conditions for triggering cameras as well (e.g. trigger camera only during a certain time period and/or days of the week). Name changed.

  • Version 1.2 for child app, added alarm device type trigger. Added new link for integration app, now points to my mod’d version. Fixed the link for the child app.

HTTPS/SSL/STUNNEL How-To

stunnel:

  • Download and install stunnel
  • Once installed, follow the SSL Certificate Generation Steps to complete setup.

SSL Certificate Generation

  1. Setup your host on no-ip.com. (Or other services)
    a) Create an account, and sign up for the “No-IP Plus” service level (enhanced might work), no need for registering a domain name unless you want your own, just use one of their included domains (e.g. mydomain.ddns.net).
    b) Set up your hostname: Host Type - “DNS Host (A)”, IP address will auto populate, Assign Group – No Group, Enable Wildcard off.
  2. Go to: zerossl.com > click on Online Tools > Click on Start for the Free SSL Certificate Wizard
  3. Enter Email Address, check DNS Verification box, check both terms of service boxes to agree
  4. For New setups:
    a) In “Domains…”, type in your domain name (e.g. mydomain.com or mydomain.ddns.net).
    b) Leave the “Paste your Let’s Encrypt Key…” and “Paste your CSR…” fields blank.
    c) It’ll ask if you want to include the www version (if yes, you’ll get it for www.mydomain.ddns.net as well). Click next.
    d) It’ll generate the domain-csr.txt file, then generate the Key (account-key.txt). Be sure to save both files and put in a secure location.
    e) Then it’ll take to you the verification step, use the DNS verification (not http, which has you put specific stuff on your server, which you can’t do in blue iris).
    f) Log into your No-ip.com account > manage domains > Modify > Advanced Records > TXT, and copy the TXT record into it and click update
    g) Wait 15-30 minutes (per directions), and click verify. When it’s good, it’ll take you to your last step.
    h) Download the domain-crt.txt and domain-key.txt files, and save your account ID. Keep all the files in a safe place!
    i) Delete the TXT records from your hostnames on your no-IP.com account.
  5. For Renewals:
    a) Leave “Domains…” blank
    b) In “Paste your Let’s Encrypt Key…”, copy the “account-key.txt” file contents so you can skip verification.
    c) In “Paste your CSR…”, copy in your “domain-csr.txt” file contents you created the first time you set it up.
    d) Click Next.
    e) As long as it wasn’t expired (so create a reminder somewhere to renew this before it expires each time), it’ll take you straight to a new certificate (domain-crt.txt). Download, save a copy in a safe place.
  6. Configure Stunnel, first stop the stunnel service and make sure the GUI is closed.
  7. For new setups:
    a) Edit the stunnel.conf file to read:
    [Blue-Iris]
    accept = xxx.xxx.xxx.xxx:xxxx
    connect = xxx.xxx.xxx.xxx:xxxx
    cert = blueiris.pem
    TIMEOUTclose = 0
    b) Save stunnel.conf and close it. Save a backup copy to a safe place.
    c) Create a new .txt file and call it “blueiris.pem” this is your new certificate file to replace the default stunnel.pem.
    d) Open the blueiris.pem file you just created and paste the contents of domain-key.txt into it. After the domain-key.txt contents, paste the contents of domain-crt.txt and save the file. Save a backup copy to a safe place.
  8. For Renewals:
    a) Open the blueiris.pem file and delete the old certificate (so everything after “-----END PRIVATE KEY-----“)
    b) Paste the new certificate to the end (all of the new domain-crt.txt you just downloaded)
    c) Save the file and close it. Save a backup copy to a safe place.
  9. Start the Stunnel service, then open the Stunnel GUI and reload configuration. Test it out!
    a) There are several stunnel links in start menu, if you choose to run as a service it’ll just open a service and not have a GUI or anything running. You can go to Windows Processes and find the stunnel service and make it auto-start on computer boot so that even after restarts you don’t ever have to start stunnel again.

Blue Iris HTTPS Setup

  • In the Web Server tab within Blue Iris Options, enable HTTPS and fill out the other settings based on your Stunnel.conf settings above and how you would like it to operate. The Blue Iris help files are pretty good for this topic.

Blue Iris camera trigger from smart things
POE IP Cameras
Blue Iris - profile trigger
Need recommendations for a outdoor security cam
CES 2017 (general discussion thread)
Any integration with Blue Iris, ZoneMinder or even just IP Cameras in general?
Total newbie help required (UK)
Blue Iris - profile trigger
[RELEASE] Blue Iris Device Handler
[RELEASE] BI Fusion v3.0 - Adds: Blue Iris Device Type Handler, Blue Iris Camera DTH, Motion Sensing
Yi Home Camera Integration?
[RELEASE] BI Fusion v3.0 - Adds: Blue Iris Device Type Handler, Blue Iris Camera DTH, Motion Sensing
What are the most "recommended" cameras that work with SmartThings currently (2017)?
Pairing Onvif cameras
FAQ - Integrating Blue Iris CCTV Web Server with ST and webCoRE
Recommendation for indoor camera
[RELEASE] Amcrest IPM-721 & IP2M-841 LIVE Video/PTZ/Night Vision/Motion/Video Record/+More IP Camera DTH
(Brian S. Lowrance) #2

Good idea… Allows me to start recording prior to a camera detecting it’s own motion (ie: a door opens just out of view, etc) Thanks. It’s working for me.

I’ve added a trigger for alarms (siren, strobe or both) and [sent a pull request on GitHub] (https://github.com/rayzurbock/jmzSmartThings/pull/1) for you to review.


#3

Nice! It’s updated in Github. I’m new to Github, it seemed like I didn’t have rights to merge the pull request (it had a message saying “Only those with write access to this repository can merge pull requests.” Which is weird because it should be merging it into my repository…), but I just manually added your changes.


(Brian S. Lowrance) #4

I haven’t done many merge/pulls so I’m not too familiar with the process. Thanks for adding the code.


(Matt) #5

It looks like your “Child” app is missing from Github.


#6

Good catch! Sorry about that. I changed the name so it’d be a little more clear which is the child/parent, but forgot to update the link here. Links are updated in the original post!


#7

I Two questions

  1. Are you wanting the remote or internal IP? And does it need dns to work?

  2. Is there a way to test (ping) the server and this the cameras to test it is working.

It isn’t working for me but those might clarify it some.


#8

It needs the remote IP. I have a new version that should work internally, based on code others have used for the same purpose, but I can’t get it to work myself, so I haven’t updated it yet. You don’t need DNS, you’d just have to make sure you update your external IP in the app whenever it changes (so I’d recommend it).

Easiest way to test once you set it up is to create a trigger for one of the cameras with a switch or contact sensor near your computer (or log into Blue Iris on your phone/whatever and bring to the the triggering device). Then turn on the switch or open the contact sensor and watch Blue Iris start recording.


#9

Actually, I decided to play with it again and I got local connecting to work! Both parent and child apps are updated (some other minor tweaks made for clarity in the settings pages mostly), and you can now decide whether you want use LAN or WAN connections.


#10

Is there a way to have ST automatically pull from github?


#11

Yup! Github integration in the Smartthings API.

http://docs.smartthings.com/en/latest/tools-and-ide/github-integration.html?highlight=github


(Tony) #12

I have the parent application installed and configured. But I am unsure how to use it to set the profile on BlueIris. I am not really worried about camera triggering recording, I just want to set a specific profile when I leave and a different one when I arrive home.

Thanks


#13

@JMZ, I’m not getting the part to change the profile (locally as opposed to externally) based on mode working at all. It sends nothing to the BI server. If I add a Camera Trigger and trigger it, it will send the GET command locally for that:
debug sending GET to URL xxx.xxx.xxx.xxx:81//admin?camera=FamilyRm&trigger&user=xxxnamexxx&pw=xxxpasswordxxx

Since I don’t have a static external IP, I can’t make a legit cert that Smartthings will accept, so for obvious reasons, I need it to run locally.


#15

I tired that. I have the option, port and Un and PW correct but the child camera are not getting triggered. I did use the short name too. .

Did you code the app to show most characters in the password then the actual password? Thst is the only thing I see happening. When I add my BI pw it switches to more characters.


(Scott) #16

Got it hooked up to github but pulling in the trigger gets me an error: The profile one worked fine.

Error
500: Internal Server Error
URI
/ide/app/doRepoUpdates
Reference Id
085c7988-ddd2-41ad-8ef0-2320eb0c73bd
Date
Tue Dec 27 17:02:16 UTC 2016


(Theredmoose) #17

Great work ! thanks.

I am not quite sure what the MAKE HOLD feature does. When enabled I assume it tells BI to make a permanent change to the profile. If disabled it will only change the profile for the duration set within BI. Is that correct?

Also, should one disable the Schedule in BlueIris so this doesn’t conflict ? or is there a better way to set it just in case ST stops communication?


#18

@theredmoose, do you have it working locally or do you have it connect via the WAN?


(Theredmoose) #19

I am trying to have it connected on the LAN but no success so far.


#23

You can read about setting profiles in the BI help file. Essentially, It has profile numbers 1-7 and ‘~’ and you can set them up with whatever name you want. Then set up each camera’s triggers, recording, etc for each profile. E.g. I have “Away,” “Home,” “Guest,” and “Night” for my profiles 1-4, the rest are just default and unused.


#24

Is that error when trying to add the trigger app to your account in the API, or when trying to use the app? If it’s loading the app into the API, I’d just suggest restarting the browser/computer, and if that doesn’t work then resetup the Github integration with my account. I’ve never had a problem with it, and it’d be beyond me.

If you’re talking getting the trigger to work, if the profile switching is working then the most likely issue is the camera name within the trigger is wrong. It’s case sensitive and has to match the ‘short name’ exactly.