Blue Iris - profile trigger

Core i7. With 500 go ssd and only 8gb ram.

Hmm, there are varying powers of i7, but I’m curious whether it’s that or the RAM. There are also a lot of settings in Bi that can lower usage, but mine never gets above 40, with the same # of cams

Yeah it’s not good that it’s up to high. I’ll get the exact model tonight. What settings can you change to lower cpu usage ?

edit: searched cam it and found quite a few suggestions. will report back if it fixes my profile issues! :slight_smile:

I modified @luma Blue Iris camera trigger code to change Blue Iris Profile whenever ST Mode changes. I only tested this with local LAN setup but should work with WAN as well.

I only use 3 profiles so this code only has profiles 1-3.

This code is very crude but should be easy to modify to add more profiles if needed. I have no idea what I’m doing but somehow I got this to work. :sunglasses:

 *	Blue Iris Profiles based on Modes
 *	Change Blue Iris Profiles in response to SmartThings Mode change
 *	Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 *	in compliance with the License. You may obtain a copy of the License at:
 *	Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
 *	on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
 *	for the specific language governing permissions and limitations under the License.

	name: "Blue Iris Profiles based on Modes",
	namespace: "jpark40",
	author: "jpark40",
	description: "Change Blue Iris Profiles in response to SmartThings Mode change",
	category: "My Apps",
	iconUrl: "",
	iconX2Url: ""

preferences {
	section("Blue Iris server details"){
		input "biServer", "text", title: "Server", description: "Blue Iris web server IP", required: true
		input "biPort", "number", title: "Port", description: "Blue Iris web server port", required: true
		input "biUser", "text", title: "User name", description: "Blue Iris user name", required: true
		input "biPass", "password", title: "Password", description: "Blue Iris password", required: true
	section("Select Modes for each Blue Iris Profile"){
		input "biProfile1", "mode", title: "Profile 1 Mode(s)", required: false, multiple: true
		input "biProfile2", "mode", title: "Profile 2 Mode(s)", required: false, multiple: true
		input "biProfile3", "mode", title: "Profile 3 Mode(s)", required: false, multiple: true        

def installed() {
	log.debug "Installed with settings: ${settings}"
	subscribe(location, "mode", modeChangeHandler)

def updated() {
	log.debug "Updated with settings: ${settings}"
	subscribe(location, "mode", modeChangeHandler)

def modeChangeHandler(evt) {
	log.debug "Mode changed to ${evt.value}"
	log.debug "biProfile1 ${settings.biProfile1}"
	log.debug "biProfile2 ${settings.biProfile2}"
	log.debug "biProfile3 ${settings.biProfile3}"
	if (biProfile1 != null && evt.value in biProfile1) {
    	def setProfile = "1"
        else if (biProfile2 != null && evt.value in biProfile2) {
    	def setProfile = "2"
        else if (biProfile3 != null && evt.value in biProfile3) {
    	def setProfile = "3"

def biChangeProfile(num) {
    log.debug "Changing Blue Iris Profile to ${num}"
	def biHost = "${settings.biServer}:${settings.biPort}"
	def biRawCommand = "/admin?profile=${num}&user=${settings.biUser}&pw=${settings.biPass}"
    log.debug "sending GET to URL http://$biHost/$biRawCommand"
	def httpMethod = "GET"
	def httpRequest = [
		method:		httpMethod,
		path: 		biRawCommand,
		headers:	[
       				HOST:		biHost,
					Accept: 	"*/*",
	def hubAction = new physicalgraph.device.HubAction(httpRequest)

If the JSON call you are using in this code works, then I could use it in mine. Currently mine involves 5 or 6 json calls (login, auth, change profile, verify, etc).

All, I mod’d the original app quite a bit (so it still only works via WAN, not LAN, but it’s been super stable even with my https setup). I added the option for it to make either a hold or temp change to the profile (hold changes will remain through system restarts which is nice) and added push/sms notifications on errors.

My code:

I also have a triggers app that may interest someone if you don’t already have one. It’s a parent/child version of the one out there, with some other tweaks:

Lastly, I use an edited version of SmartPing called SmartPing Plus to monitor it’s health and receive notifications if my BI system is down.
Parent app:

Child app:

Just thought I’d share my setup here, this is about the most complete BI thread out there.

1 Like

since getting my cpu down to < 50% my modes have changed nicely.

For some reason one profile will not change when the Mode changes. Home Day doesn’t seem to trigger the profile change in blue iris but the others all do

I have created a brand new profile to test and it changes that. I can’t delete home day or i have to change everything that references it.
Is anyone else having trouble with one mode not changing a profile at all recently?

Edit : I setup a new mode (home day 1) and it works when I manually run routine (changes bi profile ) . But via routine director it is only Changing to away profile. Home profiles are ignored. Perhaps it’s an issue with routine director

spent hours trying to get this going and still no luck.

blue iris app in smartthigns is detecting away day but not my home day routine.

10:36:24 AM: debug BI_modeChange detected. heat
10:36:07 AM: debug BI_Found profile 4
10:36:07 AM: debug BI_modeChange matched to Away Day
10:36:07 AM: debug BI_modeChange detected. Away Day

i ran home day routine after this which changes mode to home day and is setup in blue iris smartapp - but it never detects the change. it’s like the home day mode is buggy… .

it is doing this weird thing where when changing to home day - it says the below:

10:38:24 AM: debug BI_modeChange detected. heat
10:38:20 AM: debug BI_modeChange detected. heat
10:36:24 AM: debug BI_modeChange detected. heat

no idea what heat is… i have no mode called heat.

heat looks like its subscribed to some sort of ac unit instead of your ST
modes. To be honest, I havent messed with the app in some time. I want to
one day redo it to take advantage of ST newer coding commands.

I recently moved and am having some problems getting my security cameras to
be reliable in BI, and the BI android app is pretty buggy lately, but after
that, I’ll make a new smartapp.

yeh I do have an ac unit.

I am now redoing all my modes and applying them. there is no mode called heat but i did use thermostat mode director so that could have caused it…

what trouble you having with BI specifically? i’m sure you know the system well

any idea how I might be able to remove it’s subscription to heat for home day? I created a whole new mode today called Home DayTime and it’s still calling it “heat” and catches it multiple times.

4:08:15 PM: debug BI_modeChange detected. heat
4:08:14 PM: debug BI_modeChange detected. heat
4:05:06 PM: debug BI_modeChange detected. heat
4:04:53 PM: debug BI_Found profile 4
4:04:53 PM: debug BI_modeChange matched to Away Day
4:04:53 PM: debug BI_modeChange detected. Away Day

was going to email smartthings support to see if they can tell what “heat” is. but not sure if they’ll be helpful as it’s a custom app. i have deleted the app, reset smartthings and re set it up. but no dice

EDIT: I have tried using a completely different name for that home day profile as when i created a new one i called it “Home DayTime” - still had home in the name so maybe that is causing the re subscribe to the weird heat mode. I entered Present DayTime as the name instead…

it seemed to work with one routine manually run test in changing the mode to Present DayTime.

but i’ve just done it again and it hasn’t picked up by blue iris profile trigger. It’s not showing anything at all in the logs. so weird.

JPARK40, did you say yours works on the LAN?


It’s been working perfectly without a single failure so far.

jpark40, I’m trying to get your app set up and it doesn’t work for me. Couple questions to see if my setup is correct:

  1. what do you have in Blue Iris’ Websever setting for authentication? I have “Non-Lan only”.
  2. should I type in ‘http://’ in the server when setting up your app in smartthings, or just the IP address by itself?

Thanks for your help. I’d really like to get this to work locally!

I have authentication as always so I have my login info entered in the settings.

You don’t need http, only the IP address.

Shoot, that’s what I have and still doesn’t work. When I look at the BI log, it shows the server connected to the IP for my hub, so it’s receiving the connection, it just won’t change the profile. When I type the whole path out in chrome (http://ip:port//admin?profile=2…) it takes me to the log in page but I still have to log in. Once I do, it just goes to admin?profile=2 in the address bar and nothing loads and nothing changes in BI. I’m not smart at all on GET or other HTTP stuff other than some simple hacks on smartthings code, so I’m probably saying some of this wrong.

Two more thoughts for you:

  1. are you using stunnel for https? (I am, but it’s running only for non-lan connections, and I’m using the normal lan IP and Port. Also, I turned it all off and tried it but still didn’t work)

  2. Are you using the default BI webserver files or bp2008’s UI2 version of them? I changed mine to the latter, so maybe that is the issue.

Just to run this to ground, I’m using BI version I appreciate the help, I’d really like to get this function running locally so I can do some other network config changes.

  1. No stunnel for https, LAN only.
  2. Yes, default web UI.

The http command should include user/pass in the command.


Where biUser and biPass are your username/passowrd. If that doesn’t work then it’s probably related to UI2.

I’m getting closer! I reinstalled BI to get the default web UI back, and now when I type in the whole command line in a browser it’ll actually change the profile, but I have to sign in first, then when I sign it it actually changes it. I know it isn’t the same in a browser, but it didn’t do that before.

Yup, the http command has the user/pass in it, I just got tired of typing so I put in the ‘…’ :slight_smile:

The app still isn’t working though. I recopied the code into the api to make sure I didn’t mess up anything, and I ensured the IP, port, username, and password are all correct in the app. I have the same settings as you (the ones I asked about anyway). So I know I’m close here, when I change modes from my phone and watch the computer, I actually get the mouse to go to the spinning blue circle for an instant when BI is receiving the command. The BI status window logs a server connection to my smartthings hub IP address too. But it doesn’t log a login or a logout, like it does when I login from the website or BI iOS app. Any thoughts?

Do you have “Secure only” disabled in Blue Iris Web Server setting?

I did not, and looking at the original trigger app from Luma I see that app required it deselected as well. I tried it out, and still no luck. I’m just going to let it rest at this point. Almost a month of going back and forth with it is enough. I really appreciate your help though, thank you for sticking with me. My mod’d version of Tony’s app works great, so I’ll just roll with that despite it being stuck over WAN (the only thing I wanted to do was get the hub to send local commands so I could push my whole BI setup to connect via VPN, to make it more secure out on the web when I access it remotely. I don’t think there is a way for the smartthings cloud to connect to the BI server if I put it behind a VPN, so I was trying to get it to send local commands instead).