Jablotron component for Home Assistant
Home Assistant component to arm and disarm the alarm system and read sensor states.
Currently supports:
To use this component, copy all scripts to "
jablotron_system:
port: /dev/hidraw0
code: 1234
Both options 'port' and 'code' are required. Optional arguments are:
code_arm_required: True
code_disarm_required: True
state_topic: "backend/alarm_control_panel/jablotron/state"
command_topic: "backend/alarm_control_panel/jablotron/set"
Note: Because my serial cable presents as a HID device there format is /dev/hidraw[x], others that present as serial may be at /dev/ttyUSB0 or similar. Use the following command line to identify the appropriate device:
$ dmesg | grep usb
$ dmesg | grep hid
Alarm_control_panel
If the mqtt: component has been properly configured on the local host (directly connected to the Jablotron system), the alarm_control_panel will publish states and listen for changed alarm states automatically. You could specify which topics should be used.
state_topic
will be used for announcing new states (MQTT messages will be retained)command_topic
will be used for receiving incoming states from a remote alarm_control_panel.On both hosts (local and remote) you need to setup an MQTT broker first of course.
On the local host you need specify topics. For example:
jablotron_system:
port: /dev/hidraw0
code_arm_required: True
code_disarm_required: True
code: !secret jablotron_code
state_topic: "backend/alarm_control_panel/jablotron/state"
command_topic: "backend/alarm_control_panel/jablotron/set"
On the remote host you need to setup a MQTT alarm control panel. For example:
alarm_control_panel:
- platform: mqtt
name: 'Jablotron Alarm'
state_topic: "backend/alarm_control_panel/jablotron/state"
command_topic: "backend/alarm_control_panel/jablotron/set"
code_arm_required: True
code_disarm_required: True
code: !secret jablotron_code
Binary_sensor
In order to publish the states of binary sensors, you could make an automation on the local host like this:
automation:
# if state changes then also update mqtt state
- alias: 'send to MQTT state'
initial_state: 'true'
trigger:
- platform: state
entity_id:
- binary_sensor.jablotron_3
- binary_sensor.jablotron_4
- binary_sensor.jablotron_5
action:
- service: mqtt.publish
data_template:
topic: >
backend/{{ trigger.entity_id.split('.')[0] }}/{{ trigger.entity_id.split('.')[1] }}/state
payload: >
{{ trigger.to_state.state | upper }}
retain: true
On the remote host you need to make MQTT based binary sensors like this:
binary_sensor:
- platform: mqtt
name: "jablotron_3"
state_topic: "backend/binary_sensor/jablotron_3/state"
payload_on: "ON"
payload_off: "OFF"
qos: 0
First you start triggering several sensors. They'll add up as soon as they are triggered:
Each sensor gets it own entity_id with a unique number. This number represents the ID or position in J/F/O-link, the Jablotron software to configure your alarm system. If you're not able to open up J/F/O-link but you are able to access your alarm system over the internet, you could use the Jablotron app on your phone and go to Devices to get a list of devices. The order there is the same as the numbers of the entity_id's here.
Discovered sensors are automatically stored in your config/jablotron_devices.yaml file. You could trigger all sensors, but you could also manually change this file and restart HA in order to see them all.
After all sensors have been added, you could give them more friendly names in the Customization section:
At the end, you should be able to see all kind of sensors like here:
Here you'll see a Jablotron PIR sensor working as a binary_sensor, detecting motion:
Opened up 2 browsers. Left = local host, right = remote host based on MQTT:
As you may have noticed, the MQTT alarm control panel doesn't support an 'arming' state, so I used a 'pending' state.
MQTT support for binary sensors was already supported in HA by using automations. Opened up 2 browsers. Up = local host, down = remote host based on MQTT:
Big thanks to mattsaxon and Marcel1!
Work in progress. Any help would be great!