Custom component - BlueIris

Custom Component: Blue Iris integration

Description

Integration with Blue Iris Video Security Software. Creates the following components:

  • Camera - per-camera defined.
  • MQTT Binary Sensors (MOTION, AUDIO, WATCHDOG) - per-camera defined.
  • Switch (Arm / Unarmed) - only when profiles and admin username and password are provided.
  • Support HLS Streams instead of H264.
  • Support SSL with self-signed certificate.

Changelog

How to

Requirements

  • BlueIris Server available with a user
  • To control profiles, user must have ā€˜adminā€™ level permissions
  • MQTT Integration is optional - it will allow to listen to BlueIris event
  • Read the BlueIris manual for this component

Installations via HACS

Look for ā€œBlue Iris NVRā€ and install

Integration settings

Basic configuration (Configuration -> Integrations -> Add BlueIris)
Fields name Type Required Default Description
Host Texbox + None Hostname or IP address of the BlueIris server
Port Textbox + 0 HTTP Port to access BlueIris server
SSL Check-box + Unchecked Is SSL supported?
Username Textbox - Username of admin user for BlueIris server
Password Textbox - Password of admin user for BlueIris server
Integration options (Configuration -> Integrations -> BlueIris Integration -> Options)
Fields name Type Required Default Description
Host Texbox + ast stored hostname Hostname or IP address of the BlueIris server
Port Textbox + 0ast stored port HTTP Port to access BlueIris server
SSL Check-box + Last stored SSL flag Is SSL supported?
Username Textbox - Last stored username Username of admin user for BlueIris server
Password Textbox - Last stored password Password of admin user for BlueIris server
Clear credentials Check-box + Unchecked Workaround to clear the username & password since there is not support for optional fields (Not being stored under options)
Generate configurations Check-box + Unchecked Will take generate store and configuration for HA, more details below (Not being stored under options)
Log level Drop-down + Default Changes componentā€™s log level (more details below)
Reset components settings to default Check-box + Unchecked Will reset drown-downs of componetā€™s creation to their default (Not being stored under options)
Camera components Drop-down - All camera Will create camera for each of the chosen camera
Motion sensors Drop-down - All non-system camera Will create binary sensor for each of the chosen camera
Connectivity sensors Drop-down - All non-system camera Will create connectivity binary sensor for each of the chosen camera
Audio sensors Drop-down - All audio supported non-system camera Will create audio binary sensor for each of the chosen camera
Profile switches Drop-down - All profiles Will create switch for each of the chosen profiles
Stream type Drop-down - H264 Defines the stream type H264 / MJPG

Integrationā€™s title
Title will be extracted from BlueIris serverā€™s configuration, it will be set upon adding the server, and after every Optionā€™s change

Note that in case there are 2 integrations with the same integrationā€™s title, components will be overwritten by both integrations.

Log Levelā€™s drop-down
New feature to set the log level for the component without need to set log_level in customization: and restart or call manually logger.set_level and loose it after restart.

Upon startup or integrationā€™s option update, based on the value chosen, the component will make a service call to logger.set_level for that component with the desired value,

In case Default option is chosen, flow will skip calling the service, after changing from any other option to Default, it will not take place automatically, only after restart

Control componentā€™s creation
New feature to control which of the components will be created:

  • Sensors drop-down will be available only when MQTT component is defined
  • Audio sensors drop-down will include only audio support non-system camera
  • Connectivity and Motion sensors will be created only for non-system camera
  • In case none of the Audio, Connectivity and Motion binary sensors are being created, main binary sensor of Alerts will not be created as well
  • Profileā€™s drop-down will be available only when admin userā€™s credentials set to the integration
  • Once configuration manually changed, new camera that will be added will require manually setting configuration
  • To restore defaults which allows automatically adding new camera, check the check-box of Reset components settings to default

Componentā€™s drop-downs NONE option - work-around
As workaround for UI not allowing submitting the form without all fields with values,
First option in each drop-down is NONE,
as long as this option is checked,
it will not allow checking other items

Auto-generating configurations files:

Will create YAML with all the configurations in the config directory under blueiris.advanced_configurations.yaml:

  • Input select (drop-downs)
  • Script to cast based on the selection
  • UI of all the components created by BlueIris based on the description above

Example of configuration output

Configuration validations

Upon submitting the form of creating an integration or updating options,

Component will try to login to the BlueIris server to verify new settings, following errors can appear:

  • BlueIris integration ({host}) already configured
  • Invalid administrator credentials - credentials are invalid or user is not an admin
  • Invalid server details - Cannot reach the server
Password protection

Password is being saved in integration settings to .storage encrypted,

In the past password saved in clear text, to use the encryption, please remove the integration, restart HA and re-add integration,

As long as the password will remain in clear text saved in integration setting, the following warning log message will appear during restart:

BlueIris password is not encrypted, please remove integration and reintegrate

Components

Binary Sensor - Alerts

Represents whether there is an active alert or not

Attributes
Active alerts #
System name
Version
License
Support expiration
Logged in User
Latitude
Longitude
Binary Sensor - Connectivity - Non-system-camera

Represents whether the camera is online or not (based on MQTT message)

Binary Sensor - Audio - Non-system-camera and camera supports audio

Represents whether the camera is triggered for noise or not (based on MQTT message)

Binary Sensor - Motion - Non-system-camera

Represents whether the camera is triggered for motion or not (based on MQTT message)

Binary Sensor - DIO - Non-system-camera

Represents whether the camera is triggered for digital I/O event or not (based on MQTT message)

Binary Sensor - External - Non-system-camera

Represents whether the camera is triggered for external / ONVIF event or not (based on MQTT message)

Camera

State: Idle

Attributes
FPS
Audio support
Width
Height
Is Online
Is Recording
Issue (Camera is yellow)
Alerts #
Triggers #
Clips #
No Signal #
Error
Switch - Profile (Per profile)

Allows to set the active profile, only one of the profile switches can be turned on at a time

If you are turning off one of the switch it will work according to the following order:
Profile #1 turned off, will turn on Profile #0
All the other profiles upon turning off, will turn on Profile #1

Lovelace UI Configuration

Example of UI layout

Casting

Currently the Stream Component is a bit ragged to use to cast Blue Iris video streams, which donā€™t need proxying.

Lovelace UI for casting

# Example ui-lovelace.yaml view entry
  - type: entities
    title: Cast Camera to Screen
    show_header_toggle: false
    entities:
      - entity: input_select.camera_dropdown
      - entity: input_select.cast_to_screen_dropdown
      - entity: script.execute_cast_dropdown

Example of configuration output

Contributors

@darkgrue

7 Likes

Hi Bar
I have blue iris running with 6 cams, and can help you test.
I have mqtt running in BI and use the HAā€™s embedded mosquitto for talking to a bunch of ESPs I have around the house.
I checked that BI and HA could talk though mqtt (donā€™t remember which direction I tested though), but am not actively using BI mqtt.

Thanks for doing this.

Randy

Hi @bar

I am using BI as well and use it to send motion sensing to HA using MQTT, I also use google cast to see the cameras on my TV.

I would love to help you test.

Thank you @randytsuch and @cameron,
I will create a git for it and will share it with you (by end of the week)

1 Like

Hi,

I created a git repo with the files, it includes sample configuration with documentation,
Link to git (develop branch):
https://bitbucket.org/bar-ha/ha-components-blueiris

Thanks

2 Likes

Hi, I am willing and capiable to do some testing for you. I have a running Blueiris setup on one of my servers. Currently with 9 cameras( a couple of old Dlink DCS-5010 PZT, a few Dlink DCS-932L, one Foscam PZT, and 2 FDT FD7901 PZT ). They are all IP cameras. My setup has been running for at least 4 years. I also have a couple Xioami DaFang 1080p IP Cameras and 1 Wyze Cam 1080p IP Camera too. They are the Motion Tracking ones (Very Cool!!!). Please note that I am still in the process of integrating them into BlueIris. I would love to help out the community that has already helped me so much.

FYI the MQTT option is configurable but looks like this:
BlueIris_2018-09-20_20-55-45

And then you create the corresponding MQTT entities:

binary_sensor:
  - platform: mqtt
    name: "FDC Motion"
    state_topic: blue_iris/binary_sensor/fdc_motion/state
    payload_on: "ON"
    payload_off: "OFF"
    device_class: motion

You can also create a shell_command to change the profile, e.g. night and day:

shell_command:
  blueiris_profile_day:
   curl "https://username:[email protected]:port/admin?profile=1"

Itā€™s not as clean as an actual component but it gets the job done.

Looks like I need sourcetree to read this?

I downloaded and started setting up sourcetree, should get it working tonight.

Randy

Well I couldnā€™t figure out how to use sourcetree to open the project, and really have no idea what to do?

If there are instructions, I donā€™t know where they are or how to get at them, so Iā€™m stuck.

Randy

Steps:

  1. clone the git to your PC using the following command (Iā€™m using GitKraken), with SourceTree there is a button to do that when you click on clone in bitbucket:
    git clone https://[email protected]/bar-ha/ha-components-blueiris.git

  2. copy the folder custom_components to your config folder of HA

  3. Add the configuration of the component / camera / binary sensor / switch and restart the HA

Thanks, making progress
I dragged the entire directory over to sourcetree, and I can see three files and their contents. But there is no directory I see in sourcetree, and I donā€™t know how to copy it out of sourcetree.

Iā€™ve played a very little bit with github, but know very little of this type of program, so thatā€™s why Iā€™m asking these basic questions.

EDIT: I installed gitkraken, and opened it there also. But basically same thing, I can see the files (only two of them here), but no directory and donā€™t know how to copy, unless I do a manual cut and paste.

Hi @randytsuch, sorry but it seems I forgot to merge it back to master branch, please try again

Thanks

OK, making progress. I was able to clone the directory into my HA/config directory.
Now I need to edit my .yaml files to add the cam stuff, and see how it goes.

Randy

This is awesome news guys! Been running BlueIris for 4 years and monitoring around 14 cameras and 13 clones. Right now Iā€™m using it with Hassio to turn on outside lights when the cameras detect motion.

I get this error
Invalid config for [blueiris]: string value is None for dictionary value @ data[ā€˜blueirisā€™][ā€˜cameraā€™][0][ā€˜roomā€™]. Got None. (See /config/configuration.yaml, line 120). Please check the docs at https://home-assistant.io/components/blueiris/

note the blueiris: is at line 119, so line 120 is the #Required line
config.yaml
blueiris:
#Required - Host / IP of BlueIris Web Server
host: 192.168.xxx.xxx
#Required - Port of BlueIris Web Server
port: xx
#Optional - Creates switch which will allow arm and unarm the BlueIris profile

profile:

#Required - Profile Id of armed state (Switch is On)

armed: !secret blueiris_armed_profile

#Required - Profile Id of unarmed state (Switch is Off)

unarmed: !secret blueiris_unarmed_profile

#Optional - Username of BlueIris Web Server (Required when profile was set, will not without it)

username: !secret blueiris_username

#Optional - Password of BlueIris Web Server (Required when profile was set, will not without it)

password: !secret blueiris_password

#Optional - Creates MQTT Binary Sensor per camera
mqtt:
#For both topics - Placeholder ā€˜[camera_id]ā€™ will be replaced per camera with BI short name
#Required - Topic of Watchdog message
watchdog: BlueIris/[camera_id]/Connectivity
#Required - Topic of Motion message
motion: BlueIris/[camera_id]/Motion
#Optional - By default camera will be created for BI All and All (Cycle) camera,

you can prevent creating them by stating them below in the array - Supports only ā€˜Allā€™ / ā€˜Cycleā€™

exclude:
- All
- Cycle
#Required - List of camera from BlueIris
camera:
#Optional - Name of the camera, default BI Camera Id
- name: dahua cam
#Required - BI Short name
id: camid
#Optional - Room of the camera

room: !secret blueiris_cam1_room_name

Can you upload the configuration.yaml part of the blueiris and send me the link?
could be indiention issue

thanks

Even though it looks strange here (donā€™t know whatā€™s up with the formatting), it looks fine in the yaml. I copied the section from your yaml so I donā€™t see how it could be a formatting/indentation problem. I know I need to be careful with formatting and yaml.

I did comment out all of the optional stuff, and thought maybe thatā€™s why it was complaining.

I did that last post in the morning and I was rushing, will try again tonight to post that part of my yaml so it looks better hopefully.

Iā€™ll see if I can post a file somewhere and then post the link.

Randy

Think I figured it out. Seems somethings are not really optional

As far as I can tell, you have to assign each cam a room and a name in addition to the id

I was able to add a snapshot from a cam to a lovelace cam page I have so can talk to the cams like I should

Reproduced it in my HA, there was a bug caused by wrong default which is set as None and should be empty string, pushed the fix to master branch, you can get it and it should work.

thanks!

I ended up having to manually copy the stuff in the custom_components directory from a temp folder over to my config folder.

I guess I copy that over again, since that and the yaml is all I have.

Randy