All ioBroker Tutorials
All ioBroker FAQs
Home Assistant 2022.8.6 Configuration for your WQHD INSTAR MQTTv5 Broker
- Installation with Docker
- Basic Setup
- Turn your MQTT Topics into Switches
- Add your Switches as UI Elements
Installation with Docker
docker pull homeassistant/home-assistant:latest
mkdir -p /opt/homeassistant/{config}
chmod -R 775 /opt/homeassistant
docker run -d --rm --privileged --net=host --name='home-assistant' -e 'TZ=Europe/Berlin' -v /opt/homeassistant/config:/config homeassistant/home-assistant:latest
Basic Setup
Open your browser on http://localhost:8123/onboarding.html
and create a user account to log in:
Along the way we can directly install the MQTT Addon:
And connect it to our camera's MQTTv5 Broker:
Turn your MQTT Topics into Switches
If you followed the installation path described above you will now be able to find the main configuration file in /opt/homeassistant/config/configuration.yaml
. Here we can add an import for Switch items that we want to use to toggle our camera state through the MQTT API:
# MQTT
# switch: !include mqtt/switches.yaml /deprecated
mqtt: !include mqtt/switches.yaml
Now create the mqtt
folder next to the configuration file and create the file switches.yaml
inside:
mkdir mqtt
nano mqtt/switches.yaml
Here we can create, for example, 4 switches that can toggle the privacy masks in our camera. If your set your camera to use the prefix
cameras and the mqtt ID
115:
You can use the following configuration file - feel free to replace the used used MQTT topics with any topic from our MQTTv5 API:
sensor:
- device:
identifiers: in8415_office
manufacturer: INSTAR Deutschland GmbH
model: INSTAR 2k+ IN-8415 WLAN
name: IN-8415 2k+ Office
configuration_url: "http://192.168.2.201:80"
availability:
topic: cameras/201/status/connection
payload_available: '{"val":"online"}'
payload_not_available: '{"val":"offline"}'
object_id: in8415_office_testament
unique_id: in8415_office_testament
name: IN-8415 LWT
state_topic: cameras/201/status/connection
value_template: '{{ value_json.val }}'
- unique_id: office_alarmserver
name: Office Alarmserver
state_topic: cameras/201/status/alarm/triggered
device_class: current
value_template: '{{ value_json.val }}'
switch:
- unique_id: office_red_alarm_area
name: Office Red Alarm Area
state_topic: cameras/201/status/alarm/areas/red/enable
command_topic: cameras/201/alarm/areas/red/enable
qos: 1
payload_on: '{"val":"1"}'
payload_off: '{"val":"0"}'
optimistic: false
retain: false
- unique_id: office_blue_alarm_are
name: Office Blue Alarm Area
state_topic: cameras/201/status/alarm/areas/blue/enable
command_topic: cameras/201/alarm/areas/blue/enable
qos: 1
payload_on: '{"val":"1"}'
payload_off: '{"val":"0"}'
optimistic: false
retain: false
- unique_id: office_green_alarm_are
name: Office Green Alarm Area
state_topic: cameras/201/status/alarm/areas/green/enable
command_topic: cameras/201/alarm/areas/green/enable
qos: 1
payload_on: '{"val":"1"}'
payload_off: '{"val":"0"}'
optimistic: false
retain: false
- unique_id: office_yellow_alarm_area
name: Office Yellow Alarm Area
state_topic: cameras/201/status/alarm/areas/yellow/enable
command_topic: cameras/201/alarm/areas/yellow/enable
qos: 1
payload_on: '{"val":"1"}'
payload_off: '{"val":"0"}'
optimistic: false
retain: false
- unique_id: office_privacy_mask_1
name: Office Privacy Mask 1
state_topic: cameras/201/status/multimedia/privacy/region1/enable
command_topic: cameras/201/multimedia/privacy/region1/enable
qos: 1
payload_on: '{"val":"1"}'
payload_off: '{"val":"0"}'
optimistic: false
retain: false
- unique_id: office_privacy_mask_2
name: Office Privacy Mask 2
state_topic: cameras/201/status/multimedia/privacy/region2/enable
command_topic: cameras/201/multimedia/privacy/region2/enable
qos: 1
payload_on: '{"val":"1"}'
payload_off: '{"val":"0"}'
optimistic: false
retain: false
- unique_id: office_privacy_mask_3
name: Office Privacy Mask 3
state_topic: cameras/201/status/multimedia/privacy/region3/enable
command_topic: cameras/201/multimedia/privacy/region3/enable
qos: 1
payload_on: '{"val":"1"}'
payload_off: '{"val":"0"}'
optimistic: false
retain: false
- unique_id: office_privacy_mask_4
name: Office Privacy Mask 4
state_topic: cameras/201/status/multimedia/privacy/region4/enable
command_topic: cameras/201/multimedia/privacy/region4/enable
qos: 1
payload_on: '{"val":"1"}'
payload_off: '{"val":"0"}'
optimistic: false
retain: false
- unique_id: office_auto_gamma
name: Office Auto Gamma
state_topic: cameras/201/status/multimedia/image/gamma/auto
command_topic: cameras/201/multimedia/image/gamma/auto
qos: 1
payload_on: '{"val":"1"}'
payload_off: '{"val":"0"}'
optimistic: false
retain: false
- unique_id: office_auto_denoise
name: Office Auto Denoise
state_topic: cameras/201/status/multimedia/image/denoise/auto
command_topic: cameras/201/multimedia/image/denoise/auto
qos: 1
payload_on: '{"val":"1"}'
payload_off: '{"val":"0"}'
optimistic: false
retain: false
- unique_id: office_flip
name: Office Flip
state_topic: cameras/201/status/multimedia/image/transform/flip
command_topic: cameras/201/multimedia/image/transform/flip
qos: 1
payload_on: '{"val":"1"}'
payload_off: '{"val":"0"}'
optimistic: false
retain: false
- unique_id: office_mirror
name: Office Mirror
state_topic: cameras/201/status/multimedia/image/transform/mirror
command_topic: cameras/201/multimedia/image/transform/mirror
qos: 1
payload_on: '{"val":"1"}'
payload_off: '{"val":"0"}'
optimistic: false
retain: false
button:
- unique_id: office_alarm_trigger
- name: Office Alarm Trigger
command_topic: cameras/201/alarm/pushalarm
payload_press: '{"val":"1"}'
icon: mdi:alarm-light
qos: 2
retain: false
- unique_id: office_reboot
name: Office Reboot
command_topic: system/reboot/now
payload_press: '{"val":"1"}'
icon: mdi:cog-refresh-outline
qos: 2
retain: false
number:
- unique_id: office_brightness
name: Office Brightness
object_id: in9408_brightness
icon: mdi:brightness-6
state_topic: cameras/201/status/multimedia/image/brightness
command_topic: cameras/201/multimedia/image/brightness
value_template: '{{ value_json.val }}'
command_template: '{"val":"{{ value }}"}'
min: 1
max: 100
step: 1
unit_of_measurement: '%'
qos: 1
optimistic: false
- unique_id: office_contrast
name: Office Contrast
object_id: in9408_contrast
icon: mdi:contrast-box
state_topic: cameras/201/status/multimedia/image/contrast
command_topic: cameras/201/multimedia/image/contrast
value_template: '{{ value_json.val }}'
command_template: '{"val":"{{ value }}"}'
min: 1
max: 100
step: 1
unit_of_measurement: '%'
qos: 1
optimistic: false
- unique_id: office_saturation
name: Office Saturation
object_id: in9408_saturation
icon: mdi:palette-outline
state_topic: cameras/201/status/multimedia/image/saturation
command_topic: cameras/201/multimedia/image/saturation
value_template: '{{ value_json.val }}'
command_template: '{"val":"{{ value }}"}'
min: 1
max: 100
step: 1
unit_of_measurement: '%'
qos: 1
optimistic: false
- unique_id: office_hue
name: Office Hue
object_id: in9408_hue
icon: mdi:palette-outline
state_topic: cameras/201/status/multimedia/image/hue
command_topic: cameras/201/multimedia/image/hue
value_template: '{{ value_json.val }}'
command_template: '{"val":"{{ value }}"}'
min: 0
max: 360
step: 1
qos: 1
optimistic: false
- unique_id: office_sharpness
name: Office Sharpness
object_id: in9408_sharpness
icon: mdi:shark-fin-outline
state_topic: cameras/201/status/multimedia/image/sharpness
command_topic: cameras/201/multimedia/image/sharpness
value_template: '{{ value_json.val }}'
command_template: '{"val":"{{ value }}"}'
min: 1
max: 100
step: 1
unit_of_measurement: '%'
qos: 1
optimistic: false
- unique_id: office_vibrancy
name: Office Vibrancy
object_id: in9408_vibrancy
icon: mdi:palette-outline
state_topic: cameras/201/status/multimedia/image/vibrancy/value
command_topic: cameras/201/multimedia/image/vibrancy/value
value_template: '{{ value_json.val }}'
command_template: '{"val":"{{ value }}"}'
min: 1
max: 255
step: 1
qos: 1
optimistic: false
- unique_id: office_gamma
name: Office Gamma
object_id: in9408_gamma
icon: mdi:gamma
state_topic: cameras/201/status/multimedia/image/gamma/preset
command_topic: cameras/201/multimedia/image/gamma/preset
value_template: '{{ value_json.val }}'
command_template: '{"val":"{{ value }}"}'
min: 1
max: 18
step: 1
qos: 1
optimistic: false
- unique_id: office_denoise
name: Office Denoise
object_id: in9408_denoise
icon: mdi:contrast-box
state_topic: cameras/201/status/multimedia/image/denoise/preset
command_topic: cameras/201/multimedia/image/denoise/preset
value_template: '{{ value_json.val }}'
command_template: '{"val":"{{ value }}"}'
min: 0
max: 15
step: 1
qos: 1
optimistic: false
- unique_id: office_max_iso
name: Office Max ISO
object_id: in9408_isomax
icon: mdi:brightness-6
state_topic: cameras/201/status/multimedia/image/isomax
command_topic: cameras/201/multimedia/image/isomax
value_template: '{{ value_json.val }}'
command_template: '{"val":"{{ value }}"}'
min: 1
max: 32
step: 1
qos: 1
optimistic: false
- unique_id: office_auto_ir
name: Office Auto IR LEDs
object_id: in9408_autoled
icon: mdi:lightbulb-night-outline
state_topic: cameras/201/status/features/nightvision/autoled
command_topic: cameras/201/features/nightvision/autoled
value_template: '{{ value_json.val }}'
command_template: '{"val":"{{ value }}"}'
min: 0
max: 2
step: 1
qos: 1
optimistic: false
- unique_id: office_auto_ircut
name: Office Auto IRcut
object_id: in9408_autoircut
icon: mdi:lightbulb-night-outline
state_topic: cameras/201/status/features/nightvision/autoircut
command_topic: cameras/201/features/nightvision/autoircut
value_template: '{{ value_json.val }}'
command_template: '{"val":"{{ value }}"}'
min: 0
max: 2
step: 1
qos: 1
optimistic: false
- unique_id: office_red_alarm_area_sensitivity
name: Office Red Alarm Area Sensitivity
object_id: in9408_red_area_sense
icon: mdi:cctv-off
state_topic: cameras/201/status/alarm/areas/red/sensitivity
command_topic: cameras/201/alarm/areas/red/sensitivity
value_template: '{{ value_json.val }}'
command_template: '{"val":"{{ value }}"}'
min: 0
max: 100
step: 1
qos: 1
optimistic: false
- unique_id: office_blue_alarm_area_sensitivity
name: Office Blue Alarm Area Sensitivity
object_id: in9408_blue_area_sense
icon: 'mdi:cctv-off'
state_topic: cameras/201/status/alarm/areas/blue/sensitivity
command_topic: cameras/201/alarm/areas/blue/sensitivity
value_template: '{{ value_json.val }}'
command_template: '{"val":"{{ value }}"}'
min: 0
max: 100
step: 1
qos: 1
optimistic: false
- unique_id: office_green_alarm_area_sensitivity
name: Office Green Alarm Area Sensitivity
object_id: in9408_blue_area_green
icon: mdi:cctv-off
state_topic: cameras/201/status/alarm/areas/green/sensitivity
command_topic: cameras/201/alarm/areas/green/sensitivity
value_template: '{{ value_json.val }}'
command_template: '{"val":"{{ value }}"}'
min: 0
max: 100
step: 1
qos: 1
optimistic: false
- unique_id: office_yellow_alarm_area_sensitivity
name: Office Yellow Alarm Area Sensitivity
object_id: in9408_blue_area_yellow
icon: mdi:cctv-off
state_topic: cameras/201/status/alarm/areas/yellow/sensitivity
command_topic: cameras/201/alarm/areas/yellow/sensitivity
value_template: '{{ value_json.val }}'
command_template: '{"val":"{{ value }}"}'
min: 0
max: 100
step: 1
qos: 1
optimistic: false
Note that you need to add both the Command and State Topic. By setting the optimistic
parameter to false each switch will update the command topic when toggled but will only actually switch after your camera returns the state update - signifying that the command was received and executed.
Add your Switches as UI Elements
Now that we have our switches defined we need to add them to our dashboard. Start by enabling the Edit mode:
Create a new dashboard tab:
And click on Add Card to add a new element:
Here you need to select Entities:
And add all switches:
type: entities
entities:
- entity: switch.privacy_mask_1
- entity: switch.privacy_mask_2
- entity: switch.privacy_mask_3
- entity: switch.privacy_mask_4
title: Privacy Mode
state_color: true
Save your dashboard and try it out: