Getting BI and HomeSeer Talking To Each Other

DanDenver

Getting comfortable
Joined
May 3, 2021
Messages
488
Reaction score
782
Location
Denver Colorado
Wanted to share how I get BI and HomeSeer (HS) to update each other so that the two applications remain in sync.
This can apply for just about anything needed to share between the two, but in my example it is for the BI profile. I must keep the two applications in sync so that they each behave properly based on the profile that has been set in BI.
Note that with two way communication between the two (shown below), I can set the profile in BI or in HS and they both stay in sync.

For BI --> HS I use JSON and from HS --> BI I just use HTTP. There is a plugin for HS that works with BI, but I found it easier to not use it.

Here is the JSON for BI --> HS:
192.168.1.41/JSON?request=controldevicebyvalue&ref=387&value=%P

Here is where you would place that string:
Untitled2.png

For HS --> BI I place these lines into a VB script.
The script is run any time I make a change to the virtual device I built that mirror the 7 profiles I use in BI:
/ Set up an Object that will hold the profile value currently in HS
Dim BI As Object
/ Get the current profile I just set in HS (387 is the number of my Virtual Device)
BI = hs.CAPIGetStatus(387)
/ Set the profile variable into a String
UrlString = "" & BI.Value & "&user=admin&pw=My%20pass%20word"
/ Call the URL with the profile variable already set into it - meaning call BI with the latest profile value
hs.URLAction(UrlString , "GET", "", "")

I specifically don't use any queues/topics (like RabbitMQ/MQTT/etc) simply because in the 14 months I have had this setup there has not been a single failed call. Plus I don't need military grade fail over architecture. Plus it is just one more layer to install, maintain, debug, etc.
 

looney2ns

IPCT Contributor
Joined
Sep 25, 2016
Messages
15,521
Reaction score
22,657
Location
Evansville, In. USA
Wanted to share how I get BI and HomeSeer (HS) to update each other so that the two applications remain in sync.
This can apply for just about anything needed to share between the two, but in my example it is for the BI profile. I must keep the two applications in sync so that they each behave properly based on the profile that has been set in BI.
Note that with two way communication between the two (shown below), I can set the profile in BI or in HS and they both stay in sync.

For BI --> HS I use JSON and from HS --> BI I just use HTTP. There is a plugin for HS that works with BI, but I found it easier to not use it.

Here is the JSON for BI --> HS:
192.168.1.41/JSON?request=controldevicebyvalue&ref=387&value=%P

Here is where you would place that string:
View attachment 120984

For HS --> BI I place these lines into a VB script.
The script is run any time I make a change to the virtual device I built that mirror the 7 profiles I use in BI:
/ Set up an Object that will hold the profile value currently in HS
Dim BI As Object
/ Get the current profile I just set in HS (387 is the number of my Virtual Device)
BI = hs.CAPIGetStatus(387)
/ Set the profile variable into a String
UrlString = "" & BI.Value & "&user=admin&pw=My%20pass%20word"
/ Call the URL with the profile variable already set into it - meaning call BI with the latest profile value
hs.URLAction(UrlString , "GET", "", "")

I specifically don't use any queues/topics (like RabbitMQ/MQTT/etc) simply because in the 14 months I have had this setup there has not been a single failed call. Plus I don't need military grade fail over architecture. Plus it is just one more layer to install, maintain, debug, etc.
I've just started with Homeseer & Zwave, and would like to be able to turn on a porch light by an external trigger from a 5442 cams AI tripwire through BI.
Where do I obtain the values that would need to be entered into this string that you shared above?
192.168.1.41/JSON?request=controldevicebyvalue&ref=387&value=%P
 

DanDenver

Getting comfortable
Joined
May 3, 2021
Messages
488
Reaction score
782
Location
Denver Colorado
Where do I obtain the values that would need to be entered into this string that you shared above?
So the example I posted originally was for how to programmatically modify the current profile of BI. And at the same time allow HomeSeer to know what profile BI is in. And my code snippets demonstrate how to get the two applications to keep up to date with each other. This allows HomeSeer to make decisions based on the profile in BI. It also allows HomeSeer to be able to change the profile in BI.
For example, I can use the HomeSeer app to set the profile in BI. I find the HomeSeer app to load much more quickly. Also, I need to know the state of my smart home far more frequently than knowing what BI is doing. So this way I can use only one app for most of my concerns. I mean, BI sends me an alert when there is an event and has proven to be very reliable in that area, so I only log into BI should I receive an alert from it.

But your question is a good one, it was this:
"How to turn on a porch light by a cam trigger in Blue Iris"

Here are the steps to produce this functionality.
This is all done in HS4 by the way. HS3 is similar, but I no longer run that so cannot provide screen shots of HS3.

Step One: Turn on event ID display in HomeSeer

The first step is to determine how to 'address' the porch light in HomeSeer programmatically.
The act of programmatically turning on or off a light (or anything else in HomeSeer) is done by using its 'event' number.
As always there are multiple ways to accomplish getting this number.
The method I have chosen is the path of least resistance. Meaning that once you have made this change, the event ID's are always available to you on the 'devices' page. This comes in handy if you continue to leverage HomeSeer for more advanced projects.

Turn on the event ID display on the device page by doing this:
1682266528718.png


Step Two: Determine the event ID of the porch light

Now you can go to the devices page and then find your porch light in the list. In my case I am turning on my dining room light as my porch lights are on all night (my dining room overlooks the front porch with a huge window). Anyway, I use a 'Zooz' zwave switch that I installed to control the dining room light. Zooz handles three-way circuits so I went with that brand. Two years later still working great as a 3-way switch.
1682267277948.png

This is what the Zooz light switch looks like in my dining room.
My wife said I could replace light switches with smart switches so long as they look just like the switch being replaced.
So Zooz to the rescue:
1682267437792.png

Anyway! The number we want is 217 as shown in the image above (see red arrow). It will be a different number for you, but the same process to obtain the number.

Step Three: Make BI call HS when an alert is issued

NOTE: You will have additional work to do if you run BI and HS on different subnets. You will have to implement a Queue. I do not cover using a queue in this post.

Look at image directly below and go into Blue Iris and enter this command:
192.168.1.41/JSON?request=controldevicebyvalue&ref=217&value=99

Breakdown of the above call:
(Obviously the IP and numbers will be different for you, but here is the breakdown of the command)
192.168.1.41/ JSON? = This portion of the command indicates that you are making a HTTP call to HS using 'JSON'
request=controldevicebyvalue = The command you are issuing is a 'request' and that command is 'controldevicebyvalue'
ref=217 = The device you wish to control is number '217' (or whatever you came up with from the above steps)
value=99 = This is what you want to set the device to. In this case (for my Zooz) 99 means "turn on all the way"

1682269815397.png

If you look carefully at the "Action set" in the image above, you can see that when my front porch camera detects a 'person' it immediately:
1)
Sends me an alert via the app (it can also send me an email but that is currently disabled).
2) Then I wait 9 seconds (look for 9000msec in the image above)
(I want there to be a delay here! If a light comes on instantly we all know it was turned on by a motion sensor. Duh! Hardly a deterrent. Nobody gets out of bed, heads to the front door and turns on a light in less than a second. Instantly turning on a light gives away that a human did not perform that action.)
3) Then I turn on the dining room light. (4th event in the image above - has arrow pointing to it)
4) Then I wait three minutes. Obviously you can set this to whatever you prefer (5th event in the image above)
5) Then I turn the light off. (6th or last event in the "Action set" above)

From these "Action set" steps above, the remaining steps are spelled out for us

Step Four: Wait three minutes then turn the light off

Configure BI to wait three minutes:
1682269960077.png

Now turn the light back off:
Create another item in the "Action set" (for me the 6th item in the "Action set" shown in the second image above)
For that "action" enter the command again, but with the change shown below in bold:
(In the case of Zooz '0' means 'turn the light completely off'. Zooz is a dimmer, so I can choose any value in between, but in this case I want 'off')
192.168.1.41/JSON?request=controldevicebyvalue&ref=217&value=0

Obviously you can mix and match these "Action set" commands in any fashion you prefer.

My overall goal with this approach is so that if, at night, someone steps onto my porch the above events are put into action.
Meaning a few moments pass then the light comes on. then after a few minutes the lights turn off. If I am out of town I will obviously be alerted, but the lights will behave as if a human is in the house. Being a hard target is step number one to deterrence.

I hope this helps. Let me know if you have any questions!
 
Last edited:
As an Amazon Associate IPCamTalk earns from qualifying purchases.

danweber1

n3wb
Joined
Feb 19, 2023
Messages
11
Reaction score
14
Location
MN
I use an almost identical setup with BI & Homeseer but use mqtt instead of http json, which in my case mqtt seemed to be a hair faster.
 
Top