-
Notifications
You must be signed in to change notification settings - Fork 26
HASS Example
NOTE: These HomeAssistant details may be out-of-date; consult https://home-assistant.io for the latest
Once you have the nx584_server set up, you may wish to configure Home Assistant. There are three parts to this:
- NX584 Alarm Control Panel - This is used to display the current status of the panel (armed/disarmed) as well as arming and disarming the panel.
For information on how to enable this in Home Assistant, go here: https://home-assistant.io/components/alarm_control_panel.nx584/
TL;DR: Add this to your configuration.yaml:
alarm_control_panel:
- platform: nx584
host: 192.168.1.100
port: 5007
- Binary Sensor Status - This is used to present the status of each zone, sensor to Home Assistant for the purposes of automating certain events such as turning a light on when motion is detected for example. For information on how to enable this in Home Assistant, go here: https://home-assistant.io/components/binary_sensor.nx584/ TL;DR: Add this to your configuration.yaml (adapt to your specific needs):
binary_sensor:
- platform: nx584
host: 192.168.1.100
port: 5007
exclude_zones:
- 9
- 10
- 11
- 12
zone_types:
1: motion
2: motion
3: motion
4: motion
5: motion
6: opening
7: motion
8: opening
- Automating based on binary_sensor status - Adding an automation that uses the binary_sensors. This example turns on a light when motion is detected after sunset. You can add this as an automation.yaml entry for HASS.IO:
- id: ACTION-001
alias: Action - Turn off lamp in bedroom after 10min of no movement detected
trigger:
- entity_id: binary_sensor.bedroom
platform: state
to: 'off'
for:
minutes: 10
condition:
- condition: sun
after: sunset
action:
- alias: Turn off the Bedroom Lamp
data:
entity_id: light.bedroom_lamp
service: light.turn_off
- Setting up auotmations using the iOS Push notifications options. This part will show you how to get HASS to request the alarm to be armed when you leave the house, and then seek your confirmation. It will then ask you to disable the alarm when you arrive home and request you to enter the pin code all within an iOS push notification.
a) in configuration.yaml, add the following push notification settings. This creates two push notifications, the first is an actionable one to confirm arming, the second is an actionable one that will request the disarm pin code.
ios:
push:
categories:
- name: Arm House Alarm
identifier: 'arm_alarm'
actions:
- identifier: 'CONFIRM_ARM'
title: 'Activate Alarm'
activationMode: 'background'
authenticationRequired: yes
destructive: yes
behavior: 'default'
- identifier: 'IGNORE_ARM'
title: 'Ignore Alarm Activation'
activationMode: 'background'
authenticationRequired: no
destructive: no
behavior: 'default'
- name: Disarm House Alarm
identifier: 'disarm_alarm'
actions:
- identifier: 'CONFIRM_DISARM'
title: 'Disarm Alarm'
activationMode: 'background'
authenticationRequired: yes
destructive: yes
behavior: 'textInput'
textInputButtonTitle: 'CONFIRM CODE'
textInputPlaceholder: ''
- identifier: 'IGNORE_DISARM'
title: 'Leave Alarm On'
activationMode: 'background'
authenticationRequired: no
destructive: no
behavior: 'default'
b) Next we need to create some automations to trigger the push notifications and in turn the arming/disarming of the system.
- id: ACTIONABLE_REQ-001
alias: Actionable Request - Request alarm to be armed when nobody home.
trigger:
- entity_id: binary_sensor.people_home
platform: state
to: 'off'
for:
minutes: 5
action:
- alias: Ask if alarm should be enabled
service: notify.ios_iphone
data:
message: Nobody is home. Would you like to turn on the alarm?
data:
push:
category: arm_alarm
- id: ACTIONABLE_REQ-002
alias: Actionable Request - Request alarm to be disarmed when arriving home for
Ian.
trigger:
- entity_id: device_tracker.iphone
event: enter
platform: zone
zone: zone.home
action:
- alias: Ask if alarm should be disarmed.
data:
data:
push:
category: disarm_alarm
message: The alarm is on. Would you like to turn it off?
service: notify.ios_iphone
condition:
- condition: state
entity_id: alarm_control_panel.nx584
state: armed
- id: ACTIONABLE_RESP-001
alias: Actionable Response - Receive the arm request and arm accordingly
trigger:
- platform: event
event_type: ios.notification_action_fired
event_data:
actionName: CONFIRM_ARM
action:
- alias: Turn on Alarm
data:
entity_id: alarm_control_panel.nx584
service: alarm_control_panel.alarm_arm_home
- id: ACTIONABLE_RESP-002
alias: Actionable Response - Receive disarm request with pin and disarm accordingly
trigger:
- platform: event
event_type: ios.notification_action_fired
event_data:
actionName: CONFIRM_DISARM
action:
- alias: Turn off Alarm
data_template:
code: '{{ trigger.event.data["textInput"] }}'
entity_id: alarm_control_panel.nx584
service: alarm_control_panel.alarm_disarm
c) Lastly, you may like to be notified when the alarm is disarmed. You can do so with this automation entry:
- id: ALERT-001
alias: Alert - Notify that alarm has been disarmed
trigger:
- entity_id: alarm_control_panel.nx584
platform: state
to: 'disarmed'
action:
- alias: Alert alarm has been disabled.
data:
message: The house alarm has been disarmed.
service: notify.notify