YET another take on an alarm system

Hmm…
I cannot get the latest version to work correctly…
It just won’t accept my code. Panic code works, but not the normal disarm code.

Both are encapsulated in quotes and are in the secrets.yaml (like in the example).
Is anyone else struggling with this?

secrets.yaml

alarm_code: ‘1111’
panic_code: ‘9111’

alarm.yaml

#Code, should consist of one or more digits ie ‘6482’ ensure your passcode is encapsulated by quotes
code: !secret alarm_code
#[OPTIONAL] Panic Code should consist of one or more digits ie ‘9876’ ensure your passcode is encapsulated by quotes, it needs to be different to your standard alarm code. This enables a special panic mode. This can be used under duress to deactivate the alarm which would appear to the unseeing eye as deactivated however a special attribute [panic_mode] listed under the alarm_control_panel.[identifier] will change to ACTIVE. This status could be used in your automations to send a notification to someone else police/spouse/sibling/neighbour that you are under duress. To deactive this mode arm then disarm your alarm in the usual manner.
panic_code: !secret panic_code

Edit: While arming from the MQTT Alarm panel app works fine, disarming also fails there. In the HA log I find the following error:

2018-01-21 19:42:50 ERROR (MainThread) [homeassistant.core] Error doing job: Exception in callback <function async_subscribe..async_mqtt_topic_subscriber at 0x7347f6a8>
Traceback (most recent call last):
File “uvloop/cbhandles.pyx”, line 49, in uvloop.loop.Handle._run
File “/usr/lib/python3.6/site-packages/homeassistant/components/mqtt/init.py”, line 244, in async_mqtt_topic_subscriber
hass.async_run_job(msg_callback, dp_topic, payload, dp_qos)
File “/usr/lib/python3.6/site-packages/homeassistant/core.py”, line 253, in async_run_job
target(*args)
File “/config/custom_components/alarm_control_panel/bwalarm.py”, line 540, in message_received
self.alarm_disarm(self._code)
File “/config/custom_components/alarm_control_panel/bwalarm.py”, line 381, in alarm_disarm
if not self._validate_code(code, STATE_ALARM_DISARMED):
File “/config/custom_components/alarm_control_panel/bwalarm.py”, line 487, in _validate_code
self.check_open_sensors()
File “/config/custom_components/alarm_control_panel/bwalarm.py”, line 364, in check_open_sensors
if self._hass.states.get(sensor).state in self._supported_statuses_on:
AttributeError: ‘NoneType’ object has no attribute ‘state’

Do I need to have valid entities? I want to test in an empty, dedicated HA instance until everything works before I move it to my main installation (to avoid unneccessary restarts).

EDIT2: Yes, apparently having invalid entities in the alarm.yaml breaks disarming because for some reason the code validation method calls “self.check_open_sensors()” first which probably crashes in this situation.
What is the reason for this check? Disarming is not dependant on the sensors’ values, is it?

Is it on purpose that entity sections cannot be left blank?

I’m getting errors in the log:

Entity IDs can not be None for dictionary value @ data['override']. Got None
Entity IDs can not be None for dictionary value @ data['perimeter']. Got None. (See ?, line ?). Please check the docs at https://home-assistant.io/components/alarm_control_panel.bwalarm/Entity IDs can not be None for dictionary value @ data['override']. Got None
Entity IDs can not be None for dictionary value @ data['perimeter']. Got None. (See ?, line ?). Please check the docs at https://home-assistant.io/components/alarm_control_panel.bwalarm/

@jo-me
look at the top left quote, it looks different, id delete all quotes and retype.

please share your code it looks nice

If I put my code in secret.yaml with or without quote ’ for the code. I can only use panic code to disarm. This happen before the latest upgrade. So I have to put the alarm_code and panic_code inside it own file with quote ’ .

Good catch with the quote character. That must’ve come from copy/pasting, though. The original is fine.

The codes now both work fine ever since I removed the invalid entity IDs from the alarm.yaml. For testing purposes you can comment out all entity related sections from alarm.yaml and then try to disarm.
The reason is as I stated above: the script checks all entity states before validating the disarm code.

3 Likes

I just want to say a big thank you to @gazoscalvertos for all his hard work.
I am still in testing phase with my HA setup, and have not received and setup all my sensors yet, but so far it’s working great with what I have!

A few things:

  1. It would be great if the hide_sidebar option could be enabled/disabled depending on the alarm mode. In home mode it would be great if I could still access the rest of HA.
  2. Maybe this is the wrong place to ask, but what is everyone using for indoor/outdoor sirens? Sorry if this should be asked elsewhere, if so, please direct me.

Thanks again.

1 Like
  1. The sidebar canbe enable/disable. in alarm.yaml
    hide_sidebar: True #[OPTIONAL] - False by default.
  2. the siren is in automation. Alarm Triggered, Alarm Disarmed automation. you can change the entity_id of your siren. also in

Thanks for the reply.
Maybe I wasn’t clear enough though.

  1. I want to hide the sidebar when in away mode, but still have it accessible in home or perimeter mode.
  2. In regards to the siren, I was talking about a physical/hardware device. What are people using?

Thanks.

my alarm doesn’t have siren as well. however the physical alarm hub is able with SOS mode which activate the nosie and message to my phone. The SOS come from the keyfob, I put in HA which actually I use only for emergency for elderly, I didn’t put siren in the automation but put the notify to my phone with camera feed.

You can adjust the service in automation as suitable to your needs and hardware you have example flash light or tts to media player or notify to your phone.

Sorry for my broken english language

Currently work fine when put pass_code and panic_code in secret.yaml (without quote)
Also work fine when you put pass_code and panic_code directly in alarm.yaml (with quote)

I’ve also realised, even with hide_sidebar set to True and the Alarm Armed, if i refresh the webpage, or hit the refresh button in the ios app, I gain access to the sidebar again.

So anyone can access the sidebar even when the alarm is on, and the sidebar is set to hidden.

Is there a solution for this?

I have a lot of xiaomi aqara sensors so use the xiaomi gateway for the siren. Regarding hiding the sidebar, I think it is still a work in progress, @gazoscalvertos has mentioned that the way HA works it isn’t a straight forward thing to do so it may not function 100% correctly until a work around is discovered.

Hi all, I installed and successfully configured the panel
thank you so much for your great work!

I would love the ability, when alarm is DISARMED, to see if anyone in my family is at home.

I used to do this with a group, wher I listed my tracked devices, but I have no idea on how to integrate this in the panel as I’m not confident with coding/programming.

You could maybe add a template sensor that counts the people that are home and then add that to the sensors of the alarm panel, but as ignored.

One more questions please. :slightly_smiling_face:
Is there a simple way to changed the clock to 12 hour?
Thanks.

if a thief comes in the house and says Ok Google DIsarm house, he wil disarm the alarm … ?

I am glad you liked it @lovejoy777
There you go:
To remove the “all sensors” section:
Alarm.html (go to line 183 to 199)
original file:

					<template is='dom-if' if='[[isdisarmed(alarm)]]'>
						<template is='dom-if' if='[[!alarm.attributes.hide_all_sensors]]'>
							<div class='box-outer' style='max-width: 100%;' >
								<div class='title'>All Sensors</div>
								<div class='box-inner'>

									<template is='dom-repeat' items='[[opensensors(alarm, allsensors)]]' as='entity'>
										<state-card-display state-obj="[[entity]]" hass='[[hass]]'></state-card-display>

									</template>
									<template is='dom-repeat' items='[[closedsensors(alarm, allsensors)]]' as='entity'>
										<state-card-display state-obj="[[entity]]" hass='[[hass]]'></state-card-display>
									</template>			
								</div>
							</div>
						</template>
					</template>

Delete all the lines and keep only this:

									<template is='dom-repeat' items='[[opensensors(alarm, allsensors)]]' as='entity'>
									</template>

To edit the panel buttons:
alarm.css:
Size of the buttons are on lines 188 and 189
The background image for the buttons is on line 191
this is the original file:

div.digits paper-button{
   width: calc(25%);
   height: 77px;
   margin-top: 4px;
   background: var(--primary-color);
   color: var(--primary-background-color);
   opacity: 0.9;
}

And this is mine:

div.digits paper-button{
   width: 160px;
   height: 160px;
   margin-top: 4px;
   background-image : url("/local/alarm_skins/keyb/btnraised.png");
   color: var(--primary-background-color);
   opacity: 0.9;
}

The file “btnraised.png” must be located in the home assistant directory.
For example in my case it is:
homeassistant\www\alarm_skins\keyb\btnrased.png
as you can see the “local” is translated into “www”

Make sure the picture is the same size as the size of the button in the css file.
In my case I set the css to be 160x160 pixels and I made the png file the exact same size.

My problem now is to find out how to make the numbers larger.

edit: Here is my png file in case you like it
btnraised

3 Likes

anyone put the script on a hadashboard? Worls great but I have to find a way to type in the disarm code in the hadashboard

1 Like

can you show me how you integrate this component in hadashboard?