HomeKit / Homebridge Example
Posted: Mon Sep 02, 2019 4:54 pm
I thought that since I have been using Homekit/Homebridge with BI successfully for over six months I would provide my Homebridge configuration which covers BI profile control, notifications, and video. My reason for choosing Homekit is complicated and beyond the scope of this discussion. However with that said I have successfully integrated over 30 devices into the Homekit ecosystem via HomeBridge including everything from an EVR air handling system to BI. Should you decided to go down this route here is an example Homebridge config.json file (a subset of mine) that includes the basics for controlling BI via Homekit. The benefit of this configuration includes Siri control, scenes, location services and everything else Homekit brings to the table.
My configuration consists of a Raspberry Pi running Raspbian Jessie Lite, and the following software/plugins
Node.js - Foundation software
Homebridge - Interface to Homekit
homebridge-smtpsensor - Homebridge plugin used to provide motion notifications via BI smtp alerts
homebridge-http-switch - Homebridge plugin provides status as well as profile control based on either Homekit scenes or location services
homebridge-camera-ffmpeg - Homebridge plugin provides BI video to homekit
You could potentially run all of this on the BI Windows PC but I have seen Node.js reliability problems on Windows that I simply do not see on Raspbian.
As promised here is an example of my config.json file. This example only covers a subset of items relevant to BI and does not represent all of the platofrms or accessories being controlled via Homebridge.
{
"bridge": {
"name": "HomeBridge-BI",
"username": "XX:XX:XX:XX:XX:XX",
"port": 51826,
"pin": "XXX-XX-XXX"
},
"platforms": [
{
"platform": "SmtpSensor",
"port": "2525",
"sensors": [
{
"name": "UB-FLEX Motion",
"keyword": "UB-FLEX"
}
,
{
"name": "AC-PTZ Motion",
"keyword": "AC-PTZ"
}
]
},
{
"platform": "Camera-ffmpeg",
"cameras": [
{
"name": "GBR AC-PTZ",
"videoConfig": {
"source": "-re -i http://homebridge:password!@192.168.X.X:8080/h264/ac-ptz/temp.h264",
"stillImageSource": "-i http://homebridge:password!@192.168.X.X:8080/image/ac-ptz?q=50&s=80",
"maxStreams": 2,
"maxWidth": 1280,
"maxHeight": 1024,
"maxFPS": 15
}
},
{
"name": "GBR UB-Flex",
"videoConfig": {
"source": "-re -i http://homebridge:password!@192.168.X.X:8080/h264/ub-flex/temp.h264",
"stillImageSource": "-i http://homebridge:password!@192.168.X.X:8080/image/ub-flex?q=50&s=80",
"maxStreams": 2,
"maxWidth": 1280,
"maxHeight": 1024,
"maxFPS": 15
}
}
]
}]
,
"accessories": [
{
"debug" : false,
"accessory": "HTTP-SWITCH",
"service": "Light",
"switchHandling": "realtime",
"name": "BlueIris Arm",
"auth": {
"username": "homebridge",
"password": "xxxxx",
"sendimmediately": "true"
},
"http_method": "GET",
"switchType": "stateful",
"onUrl": "http://192.168.X.X:8080/admin?profile=1,lock=1",
"offUrl": "http://192.168.X.X:8080/admin?profile=2,lock=1",
"statusUrl": "http://192.168.X.X:8080/admin?status",
"statusPattern": "signal=green\nprofile=1\nlock=1"
},
{
"debug": false,
"accessory": "Http-SecuritySystem",
"name": "BlueIris",
"username": "homebridge",
"password": "password",
"sendimmediately": "true",
"polling": true,
"pollInterval": 10000,
"http_method": "GET",
"urls": {
"stay": {
"url": "http://192.168.X.X:8080/admin?profile=2&lock=1",
"body": "stay"
},
"away": {
"url": "http://192.168.X.X:8080/admin?profile=1&lock=1",
"body": "away"
},
"night": {
"url": "http://192.168.X.X:8080/admin?profile=3&lock=1",
"body": "night"
},
"disarm": {
"url": "http://192.168.X.X:8080/admin?profile=0&lock=1",
"body": "disarm"
},
"readCurrentState": {
"url": "http://192.168.X.X:8080/admin?status",
"body": ""
},
"readTargetState": {
"url": "http://192.168.X.X:8080/admin?status",
"body": ""
}
},
"mappers": [{
"type": "xpath",
"parameters": {
"xpath": "//partition[3]/text()"
}
},
{
"type": "regex",
"parameters": {
"regexp": "profile=(0|1|2|3|4|5|6|7)",
"capture": "1"
}
},
{
"type": "static",
"parameters": {
"mapping": {
"0" : "3",
"1" : "1",
"2" : "0",
"3" : "2",
"4" : "3",
"5" : "3",
"6" : "3",
"7" : "3"
}
}
}
]
}
]
}
My configuration consists of a Raspberry Pi running Raspbian Jessie Lite, and the following software/plugins
Node.js - Foundation software
Homebridge - Interface to Homekit
homebridge-smtpsensor - Homebridge plugin used to provide motion notifications via BI smtp alerts
homebridge-http-switch - Homebridge plugin provides status as well as profile control based on either Homekit scenes or location services
homebridge-camera-ffmpeg - Homebridge plugin provides BI video to homekit
You could potentially run all of this on the BI Windows PC but I have seen Node.js reliability problems on Windows that I simply do not see on Raspbian.
As promised here is an example of my config.json file. This example only covers a subset of items relevant to BI and does not represent all of the platofrms or accessories being controlled via Homebridge.
{
"bridge": {
"name": "HomeBridge-BI",
"username": "XX:XX:XX:XX:XX:XX",
"port": 51826,
"pin": "XXX-XX-XXX"
},
"platforms": [
{
"platform": "SmtpSensor",
"port": "2525",
"sensors": [
{
"name": "UB-FLEX Motion",
"keyword": "UB-FLEX"
}
,
{
"name": "AC-PTZ Motion",
"keyword": "AC-PTZ"
}
]
},
{
"platform": "Camera-ffmpeg",
"cameras": [
{
"name": "GBR AC-PTZ",
"videoConfig": {
"source": "-re -i http://homebridge:password!@192.168.X.X:8080/h264/ac-ptz/temp.h264",
"stillImageSource": "-i http://homebridge:password!@192.168.X.X:8080/image/ac-ptz?q=50&s=80",
"maxStreams": 2,
"maxWidth": 1280,
"maxHeight": 1024,
"maxFPS": 15
}
},
{
"name": "GBR UB-Flex",
"videoConfig": {
"source": "-re -i http://homebridge:password!@192.168.X.X:8080/h264/ub-flex/temp.h264",
"stillImageSource": "-i http://homebridge:password!@192.168.X.X:8080/image/ub-flex?q=50&s=80",
"maxStreams": 2,
"maxWidth": 1280,
"maxHeight": 1024,
"maxFPS": 15
}
}
]
}]
,
"accessories": [
{
"debug" : false,
"accessory": "HTTP-SWITCH",
"service": "Light",
"switchHandling": "realtime",
"name": "BlueIris Arm",
"auth": {
"username": "homebridge",
"password": "xxxxx",
"sendimmediately": "true"
},
"http_method": "GET",
"switchType": "stateful",
"onUrl": "http://192.168.X.X:8080/admin?profile=1,lock=1",
"offUrl": "http://192.168.X.X:8080/admin?profile=2,lock=1",
"statusUrl": "http://192.168.X.X:8080/admin?status",
"statusPattern": "signal=green\nprofile=1\nlock=1"
},
{
"debug": false,
"accessory": "Http-SecuritySystem",
"name": "BlueIris",
"username": "homebridge",
"password": "password",
"sendimmediately": "true",
"polling": true,
"pollInterval": 10000,
"http_method": "GET",
"urls": {
"stay": {
"url": "http://192.168.X.X:8080/admin?profile=2&lock=1",
"body": "stay"
},
"away": {
"url": "http://192.168.X.X:8080/admin?profile=1&lock=1",
"body": "away"
},
"night": {
"url": "http://192.168.X.X:8080/admin?profile=3&lock=1",
"body": "night"
},
"disarm": {
"url": "http://192.168.X.X:8080/admin?profile=0&lock=1",
"body": "disarm"
},
"readCurrentState": {
"url": "http://192.168.X.X:8080/admin?status",
"body": ""
},
"readTargetState": {
"url": "http://192.168.X.X:8080/admin?status",
"body": ""
}
},
"mappers": [{
"type": "xpath",
"parameters": {
"xpath": "//partition[3]/text()"
}
},
{
"type": "regex",
"parameters": {
"regexp": "profile=(0|1|2|3|4|5|6|7)",
"capture": "1"
}
},
{
"type": "static",
"parameters": {
"mapping": {
"0" : "3",
"1" : "1",
"2" : "0",
"3" : "2",
"4" : "3",
"5" : "3",
"6" : "3",
"7" : "3"
}
}
}
]
}
]
}