Hello,
hence, I installed Home Assistant on a fresh Intel NUC last week. I am a total newbie to Home Assistant. Although I was very impressed that most of my smart home toys, like a bunch of Shellys for my shutters and an Ikea DIRIGERA, have been detected automatically and worked right out of the box. There were even some unplanned integrations, like for my FRITZ!Box or my electric car by Dacia, or even a CalDav with my NextCloud which worked out of the Box, too. At this point, my thanks go out to the developers who made such a smooth experience possible!
Unfortunately, I was unable to find an integration for my PV with Solax, so I had to define my own REST sensor consuming the Solax REST API. Even this worked very smoothly!
But now I am trying to integrate my alarm system by Blaupunkt into HA, so I created a package. I am currently able to perform the most basic tasks.
- Authenticate and gather a JWT for further API calls (REST sensor)
- Update device state¹ after authentication (automation, which triggers a second REST sensor)
- Read “armed” state (template sensor)
- Read the “burglar” state as a binary sensor
- Update armed state via REST command
- Utilize the armed state REST command via an “Alarm control panel” template and use a “Alarm panel card”
¹ In order to not piss off Blaupunkt the update Interval is 2:30 minutes, which is fine for me.
But when reading the device state, I get a JSON array containing all sensors (Window/Door, Smoke detector, Moisture, PIR, etc.), including their state, which I would like to use in further automations.
Currently I would have to define each sensor manually “like an animal” in my binary_sensors.yaml:
binary_sensor:
- platform: template
sensors:
…
blau_punkt_home_security_door_rf38a90610:
device_class: door
friendly_name: "Attic door"
value_template: >-
{% set device_id = 'RF:xxxx1' %}
{% set device_status_list = state_attr('sensor.blaupunkt_home_security_status', 'data')['device_status'] %}
{% set device_status = device_status_list | selectattr('device_id', 'equalto', device_id) | list | first %}
{{ device_status and 'device_status.dc_close' not in device_status['status_open'] }}
blau_punkt_home_security_door_rf38a90610_battery:
device_class: battery
friendly_name: "Attic door Battery"
value_template: >-
{% set device_id = 'RF:xxxx1' %}
{% set device_status_list = state_attr('sensor.blaupunkt_home_security_status', 'data')['device_status'] %}
{% set device_status = device_status_list | selectattr('device_id', 'equalto', device_id) | list | first %}
{{ device_status and 'device_status.low_battery' in device_status['status_fault'] }}
blau_punkt_home_security_door_rfbfae0610:
device_class: door
friendly_name: "Cellar door"
value_template: >-
{% set device_id = 'RF:rfxxxx3' %}
{% set device_status_list = state_attr('sensor.blaupunkt_home_security_status', 'data')['device_status'] %}
{% set device_status = device_status_list | selectattr('device_id', 'equalto', device_id) | list | first %}
{{ device_status and 'device_status.dc_close' not in device_status['status_open'] }}
blau_punkt_home_security_door_rfbfae0610_battery:
device_class: battery
friendly_name: "Cellar door Battery"
value_template: >-
{% set device_id = 'RF:rfxxxx3' %}
{% set device_status_list = state_attr('sensor.blaupunkt_home_security_status', 'data')['device_status'] %}
{% set device_status = device_status_list | selectattr('device_id', 'equalto', device_id) | list | first %}
{{ device_status and 'device_status.low_battery' in device_status['status_fault'] }}
…
This is a part of the state JSON I get from my Alarm System.
[
"…",
{
"xdl_no": "11111",
"area": "1",
"no": "1",
"rf": "",
"address": "RF:xxxx1",
"type": "device_type.door_contact",
"attr": "device_attribute.entry_zone",
"latch": "0",
"name": "Attic door",
"status1": "device_status.dc_close",
"status2": "",
"status_switch": "",
"status_power": "",
"status_total_energy": "",
"status_temp": "",
"status_humi": "0",
"status_dim_level": "",
"status_lux": "",
"status_hue": "",
"status_saturation": "",
"status_pm2_5_aqi": "0",
"tag": "",
"bind_device_tag": "",
"status_pm2_5_ug_m3": "0",
"status_co2": "0",
"rssi": "2",
"mac": "00:ha:15:c0:01:01",
"scene_trigger": "0",
"scene_restore": "0",
"pss_group": "",
"device_id2": "",
"sresp_button_1": "",
"sresp_button_2": "",
"sresp_button_3": "",
"sresp_button_4": "",
"ipcam_trigger_by_zone1": "",
"ipcam_trigger_by_zone2": "",
"ipcam_trigger_by_zone3": "",
"ipcam_trigger_by_zone4": "",
"minigw_protocol": "",
"minigw_lock_status": "",
"minigw_number_of_credentials_supported": "",
"minigw_syncing": "",
"minigw_configuration_data": "",
"minigw_product_data": "",
"extension": "",
"ver": "",
"cap": "00",
"area_name": "",
"thermo_mode": "",
"thermo_setpoint": "",
"thermo_c_setpoint": "",
"thermo_setpoint_away": "",
"thermo_c_setpoint_away": "",
"thermo_setpoint_energy": "",
"thermo_setpoint_furnace": "",
"thermo_setpoint_dry": "",
"thermo_setpoint_change": "",
"thermo_fan_mode": "",
"thermo_schd_setting": "",
"thermo_remote": "",
"thermo_offset": "",
"saanet_device": "",
"saanet_status": "",
"group_id": "",
"group_name": "",
"room_id": "",
"room_name": "",
"xml_version": "2",
"device_id": "RF:xxxx1",
"status_temp_format": "C",
"trigger_by_zone": [],
"device_entry_delay": false,
"ir_configuration_func": {
"customer": "",
"optex": "0",
"climax": "0"
},
"bypass": "0",
"always_on": "0",
"normal_open": "0",
"reserved_bit0": "0",
"reserved_bit3": "0",
"reserved_bit4": "0",
"reserved_bit7": "1",
"reserved_bit8": "0",
"tamper_bypass": "0",
"su_bypass": "0",
"type_no": "4",
"device_group": "000",
"status_fault": [],
"status_open": [
"device_status.dc_close"
],
"status_co2_level": "1",
"status_pm2_5_ug_m3_level": "1",
"status_aqs_country_code": "TW",
"device_category": "All",
"status_motion": "",
"dahua": {},
"hikvision": {},
"is_cloud_registered": "0"
},
{
"xdl_no": "22222",
"area": "1",
"no": "2",
"rf": "",
"address": "RF:xxxx2",
"type": "device_type.keypad",
"attr": "device_attribute.null",
"latch": "1",
"name": "",
"status1": "",
"status2": "",
"status_switch": "",
"status_power": "",
"status_total_energy": "",
"status_temp": "",
"status_humi": "0",
"status_dim_level": "",
"status_lux": "",
"status_hue": "",
"status_saturation": "",
"status_pm2_5_aqi": "0",
"tag": "",
"bind_device_tag": "",
"status_pm2_5_ug_m3": "0",
"status_co2": "0",
"rssi": "7",
"mac": "00:ha:15:c0:01:02",
"scene_trigger": "0",
"scene_restore": "0",
"pss_group": "",
"device_id2": "",
"sresp_button_1": "",
"sresp_button_2": "",
"sresp_button_3": "",
"sresp_button_4": "",
"ipcam_trigger_by_zone1": "",
"ipcam_trigger_by_zone2": "",
"ipcam_trigger_by_zone3": "",
"ipcam_trigger_by_zone4": "",
"minigw_protocol": "",
"minigw_lock_status": "",
"minigw_number_of_credentials_supported": "",
"minigw_syncing": "",
"minigw_configuration_data": "",
"minigw_product_data": "",
"extension": "",
"ver": "",
"cap": "00",
"area_name": "",
"thermo_mode": "",
"thermo_setpoint": "",
"thermo_c_setpoint": "",
"thermo_setpoint_away": "",
"thermo_c_setpoint_away": "",
"thermo_setpoint_energy": "",
"thermo_setpoint_furnace": "",
"thermo_setpoint_dry": "",
"thermo_setpoint_change": "",
"thermo_fan_mode": "",
"thermo_schd_setting": "",
"thermo_remote": "",
"thermo_offset": "",
"saanet_device": "",
"saanet_status": "",
"group_id": "",
"group_name": "",
"room_id": "",
"room_name": "",
"xml_version": "2",
"device_id": "RF:xxxx2",
"status_temp_format": "C",
"trigger_by_zone": [],
"device_entry_delay": false,
"ir_configuration_func": {
"customer": "",
"optex": "0",
"climax": "0"
},
"bypass": "0",
"always_on": "0",
"normal_open": "0",
"reserved_bit0": "0",
"reserved_bit3": "0",
"reserved_bit4": "0",
"reserved_bit7": "0",
"reserved_bit8": "0",
"tamper_bypass": "0",
"su_bypass": "0",
"type_no": "15",
"device_group": "000",
"status_fault": [],
"status_open": [],
"status_co2_level": "1",
"status_pm2_5_ug_m3_level": "1",
"status_aqs_country_code": "TW",
"device_category": "All",
"status_motion": "",
"dahua": {},
"hikvision": {},
"is_cloud_registered": "0"
},
{
"xdl_no": "66636",
"area": "1",
"no": "12",
"rf": "",
"address": "RF:rfxxxx3",
"type": "device_type.door_contact",
"attr": "device_attribute.entry_zone",
"latch": "0",
"name": "Cellar door",
"status1": "device_status.dc_close,device_status.low_battery",
"status2": "",
"status_switch": "",
"status_power": "",
"status_total_energy": "",
"status_temp": "",
"status_humi": "0",
"status_dim_level": "",
"status_lux": "",
"status_hue": "",
"status_saturation": "",
"status_pm2_5_aqi": "0",
"tag": "",
"bind_device_tag": "",
"status_pm2_5_ug_m3": "0",
"status_co2": "0",
"rssi": "3",
"mac": "00:ha:15:c0:01:02",
"scene_trigger": "0",
"scene_restore": "0",
"pss_group": "",
"device_id2": "",
"sresp_button_1": "",
"sresp_button_2": "",
"sresp_button_3": "",
"sresp_button_4": "",
"ipcam_trigger_by_zone1": "",
"ipcam_trigger_by_zone2": "",
"ipcam_trigger_by_zone3": "",
"ipcam_trigger_by_zone4": "",
"minigw_protocol": "",
"minigw_lock_status": "",
"minigw_number_of_credentials_supported": "",
"minigw_syncing": "",
"minigw_configuration_data": "",
"minigw_product_data": "",
"extension": "",
"ver": "",
"cap": "00",
"area_name": "",
"thermo_mode": "",
"thermo_setpoint": "",
"thermo_c_setpoint": "",
"thermo_setpoint_away": "",
"thermo_c_setpoint_away": "",
"thermo_setpoint_energy": "",
"thermo_setpoint_furnace": "",
"thermo_setpoint_dry": "",
"thermo_setpoint_change": "",
"thermo_fan_mode": "",
"thermo_schd_setting": "",
"thermo_remote": "",
"thermo_offset": "",
"saanet_device": "",
"saanet_status": "",
"group_id": "",
"group_name": "",
"room_id": "",
"room_name": "",
"xml_version": "2",
"device_id": "RF:rfxxxx3",
"status_temp_format": "C",
"trigger_by_zone": [],
"device_entry_delay": false,
"ir_configuration_func": {
"customer": "",
"optex": "0",
"climax": "0"
},
"bypass": "0",
"always_on": "0",
"normal_open": "0",
"reserved_bit0": "0",
"reserved_bit3": "0",
"reserved_bit4": "0",
"reserved_bit7": "0",
"reserved_bit8": "0",
"tamper_bypass": "0",
"su_bypass": "0",
"type_no": "4",
"device_group": "000",
"status_fault": [
"device_status.low_battery"
],
"status_open": [
"device_status.dc_close"
],
"status_co2_level": "1",
"status_pm2_5_ug_m3_level": "1",
"status_aqs_country_code": "TW",
"device_category": "All",
"status_motion": "",
"dahua": {},
"hikvision": {},
"is_cloud_registered": "0"
},
"…",
]
This is a part of the state JSON I get from my Alarm System.
My first question is: is there a way to automatically add those sensors to my HA? Or is it at least possible to template the name and the device class, too?
My second question is: what’s the appropriate way to share packages with others? Is there a GH template or something else?