YET another take on an alarm system

@gazoscalvertos thanks i get the following error when added !

2017-12-04 14:04:43 ERROR (MainThread) [homeassistant.config] Invalid config for [automation]: invalid template (TemplateSyntaxError: unexpected char ‘!’ at 6) for dictionary value @ data[‘action’][0][‘data_template’][‘data’]. Got None invalid template (TemplateSyntaxError: unexpected char ‘!’ at 6) for dictionary value @ data[‘action’][0][‘service_template’]. Got None. (See /home/homeassistant/.homeassistant/configuration.yaml, line 27). Please check the docs at https://home-assistant.io/components/automation/

Hi, I didn’t realize that syntax wouldn’t work in Jinja2

try {% if is_state(‘alarm_control_panel.house’, ‘disarmed’) == false %}

You can test this in the templates section of HA before editing your code https://[HA URL]/dev-template

I have just tried this as a test and it works

{% if is_state('alarm_control_panel.house', 'disarmed') == false %}
  set
{% else %}
  not set
{% endif %}

Thanks again for your help.

What it seems to not like the disarm code, i get the following error

2017-12-04 15:31:00 ERROR (MainThread) [homeassistant.core] Invalid service data for alarm_control_panel.alarm_disarm: extra keys not allowed @ data[‘data’]. Got ‘code: 9999’

hi,
is it possible to trigger a z-wave/zigbee siren with this setup (using aqara gateway)? Speaker in the gateway is way too silent.

yes. I have mine setup to fire off a z-wave siren as well as set all of my Yeelight wifi bulbs on and to the ‘Police’ mode (flashing red and blue). It works really well.

1 Like

I have re-organised your code and tested with the snippet below which works. You were using both data and data_template, only one should be used see here https://home-assistant.io/docs/automation/templating/. If using data_template you need to pass a variable whereas your if statement doesn’t always pass one. The if statement isn’t actually required as the module will take the code even on alarming, it will just ignore it.

Also you might want to change your alarm code or delete your post with the error in as it shows your code.

action:
- service_template: >
    {% if is_state('alarm_control_panel.house', 'disarmed') == false %}
      alarm_control_panel.alarm_disarm
    {% else %}
      alarm_control_panel.alarm_arm_away
    {% endif %}
  entity_id: alarm_control_panel.house
  data:
      code: 9999

I’ve been try to set this up for a couple of days now and I get a blank screen when I click the alarm panel…

image

Anything I can look for that may be causing this?

Do you see anything in either the error log or you web console?

Within your panel_custom.yaml does your alarmid match the name in your alarm.yaml

[panel_alarm.yaml extract]
alarmid: alarm_control_panel.house 

[alarm.yaml extract]
name: house

Ahhhh maybe, I have House in alarm.yaml and house in panel_alarm.yaml, reloading to see if that was it :slight_smile:

the case shouldn’t matter to be honest.

I take it your clearing browser cache too? Do you get any errors anywhere?

Oh, :frowning: Cleared cache loads and no errors in log :frowning: Grafana works in the panel as does my router (sort of- it won’t let you log in but it appears), also floorplan and my remotes)

hmm are you able to post your yaml files?

I take it your on the latest github release?

I’m getting an Uncaught Type Error on my frontend now in alarm-somelong number.html at line 490

I’ll post the yaml’s ina sec

alarm.yaml

platform: bwalarm
name: house
code: !secret alarm_code
pending_time: 25 #Grace time in seconds to allow for exit and entry using Away mode
trigger_time: 600
alarm: automation.alarm_triggered
warning: automation.alarm_warning

clock: True  #Optional - True enables a clock in the center of the status bar
perimeter_mode: True #Optional - True enables perimeter mode, this could be known as 'Day Mode' i.e. only arm the doors whilst there is someone using all floors
weather: True #Optional - Allows a weather summary to be displayed on the status bar. Dark Sky weather component must be enabled with the name sensor.dark_sky_summary

#### COLOURS ###########  Use any HTML format
warning_colour: 'orange'
pending_colour: 'orange'
disarmed_colour: '#03A9F4'
armed_home_colour: 'black'
armed_away_colour: 'black'
triggered_colour: 'red'


############# SENSOR GROUPS ########################
# Sensors in this group tigger the alarm immediately
immediate:
  - binary_sensor.motion_sensor_158d000125a67b
  - binary_sensor.door_window_sensor_158d0001d62fb6
  - binary_sensor.door_window_sensor_158d0001d68370
  - binary_sensor.motion_sensor_158d00015e8e04
  - binary_sensor.motion_sensor_158d000125a67b
  - binary_sensor.door_window_sensor_158d00016c7797
  - binary_sensor.door_window_sensor_158d00016c7804
  - binary_sensor.door_window_sensor_158d0001a810a7
  - binary_sensor.motion_sensor_158d00015e8e04
  
# Sensors in this group start the clock (pending_time) when tripped before the alarm is activated in 'Away' mode
delayed:
  - binary_sensor.motion_sensor_158d000125a67b

# Same as notathome but hopefully the title is more self explanatory. Can still use notathome for backwards compatibility
# Note sensors can exist in more than one group notice top_floor appears in two groups
homemodeignore:
  - binary_sensor.motion_sensor_158d000125a67b

# Use this group to automatically override the warning message on open sensors when setting 'away' mode. (I use this as I have a motion sensor at the front door)
override:
  - binary_sensor.motion_sensor_158d000125a67b

panel_custom.yaml

- name: alarm
  sidebar_title: Alarm
  sidebar_icon: mdi:security-home
  config:
    alarmid: alarm_control_panel.house ## USE THE SAME ID AS USED IN YOUR ALARM.YAML

The automations are in my automation.yaml file and I’ve checked all the actions, they all seem to be fine.

bwalarm.py is in custom_components/alarm_control_panel

I think I know what’s up, last weekend I commented out the load alarm.yaml after a frustrating day trying to get it to work, so my apologies. Hopefully now it will spring into life :smiley:

Thanks I will try that tomorrow your a star …

hahahah im stupid :slight_smile: i will remove it and change it lol

I have just noticed an issue that was probably there the entire time but since I was using my phone (small screen) rather than a computer (full screen) I hadnt noticed until now. In ‘armed away mode’ I have two sensors that are showing as ‘inactive’ when one of them should be part of the immediate trigger and one part of the delayed. What is going on here??

alarm.yaml

platform: bwalarm
name: House
code: !secret alarm_code
pending_time: 25 #Grace time in seconds to allow for exit and entry using Away mode
trigger_time: 600
alarm: automation.alarm_triggered
warning: automation.alarm_warning
clock: True

#### COLOURS ###########  Use any HTML format
warning_colour: 'orange'
pending_colour: 'orange'
disarmed_colour: '#03A9F4'
armed_home_colour: 'black'
armed_away_colour: 'black'
triggered_colour: 'red'

############# SENSOR GROUPS ########################
# Sensors in this group tigger the alarm immediately
immediate:
  - binary_sensor.kitchen_multi_sensor_sensor
  - binary_sensor.lounge_multisensor_sensor
  - binary_sensor.master_bedroom_multisensor_sensor

# Sensors in this group start the clock (pending_time) when tripped before the alarm is activated in 'Away' mode
delayed:
  - binary_sensor.passage_multi_sensor_sensor


# Same as notathome but hopefully the title is more self explanatory. Can still use notathome for backwards compatibility
# Note sensors can exist in more than one group notice top_floor appears in two groups
homemodeignore:
  - binary_sensor.passage_multi_sensor_sensor
  - binary_sensor.master_bedroom_multisensor_sensor
#  - binary_sensor.kitchen_multi_sensor_sensor


# Use this group to automatically override the warning message on open sensors when setting 'away' mode. (I use this as I have a motion sensor at the front door)
#override:
  - binary_sensor.passage_multi_sensor_sensor

and here is a screenshot showing the sensors in the wrong groups…

I’m confused. Its as if the sensors in ‘home mode ignore’ are being ignored in away mode…(for the record, home mode has the sensors in the correct groups)

@gazoscalvertos it Works :slight_smile: :slight_smile: :slight_smile:

Now have key fobs controlling the alarm :slight_smile:

Thanks so much for the help.

1 Like

Haha its easy done

That is odd.

What does it show under ‘immediate’ within your alarm_control_panel attributes? https://[YOUR HA URL]/dev-state

Could you move master_bedroom to the first in the immediate list to see if there is any impact elsewhere

This is what I have in dev-state prior to any changes:

and after moving the master_bedroom sensor to the first position in that list… it seems to work! but why???