YET another take on an alarm system

Hello,
First of all, great code!
I’m having difficulty to deactivate the perimeter mode. In the file “alarm.yaml” I put “perimeter_mode: False”, however this option in the frontend continues to appear. Is there anything else I need to do to disable this mode?

Thanks in advance.
Carlos

Hi Carlos,

It appears it’s a bug and I have missed the check code. If you replace the code in your alam.html file at line 305 with the following template if statement:

<div class='box arm zone-card'>
  <template is='dom-if' if='[[alarm.attributes.perimeter_mode]]'>
    <paper-button id='arm-perimeter' on-tap='callService' data-call='alarm_arm_night' raised><iron-icon icon='mdi:lock-outline'></iron-icon>&nbsp;Perimeter Mode</paper-button>
 </template>
 <paper-button id='arm-home' on-tap='callService' data-call='alarm_arm_home' raised><iron-icon icon='mdi:lock-outline'></iron-icon>&nbsp;Home Mode</paper-button>
 <paper-button id='arm-away' on-tap='callService' data-call='alarm_arm_away' raised><iron-icon icon='mdi:lock'></iron-icon>&nbsp;Away Mode</paper-button>
</div>

I’ll push a change to the github once my code is in order as I’m in the process of making several changes

I’ll need to try and simulate these locks on my setup. At the moment locks are not supported but I can’t see any reason why they can’t be :slight_smile:
Just out of interest what are they?

Hi,

Once the alarm is activated, does it turn “on” the Sensors (binary)? I have one Fibaro multisensor and 4 Aetoec Multisensor.

Fibaro triggers alarm even if it’s off but not the other ones.

Any help will be appreciated.

Thanks in advance.

RT

Hi,

The alarm ‘listens’ for the binary sensors to switch to an ‘On’ state. If the sensor is part of one of the groups for example immediate and the alarm is active it will then change the alarm status to ‘triggered’ or ‘warning’ depending on the condition.

Your automatons should take care of the rest for example monitoring alarm status to the trigger a siren.

The majority of my sensors are the Fibaro Multisensors and they work great.

Hope this makes sense.

@gazoscalvertos They are Schlage Connect locks tied to my Wink hub. I have three of then and they all show up fine under immediate alarms but just never trigger it. For the meantime I have created an automation for each door when using Home Mode (night) so we are alerted if any of then are opened. Useful since all motion sensors are disabled but at least we get piece of mind of doors and windows.

- alias: '[Alarm] Triggered at Night (front unlocked)'
  trigger:
  - platform: state
    entity_id: lock.front_door
    from: 'locked'
    to: 'unlocked'
  condition:
    condition: state
    entity_id: alarm_control_panel.house
    state: 'armed_home'
  action:
  - service: wink.enable_siren
    entity_id: wink.siren__strobe
    data:
      enabled: True
  - service: notify.ios_iphone
    data:
      message: 'ALARM TRIGGERED!!! - Front Door!'
  - service: light.turn_on
    entity_id: light.bedroom
    data:
      brightness: 255
      color_name: white

Again, thank you for your hard work.

Thank you for this, it’s a nice alarm setup. I’m having a couple of issues though that I’m hoping I can sort out ;

Perimeter mode and away mode work as expected and if I don’t touch home mode then all works well, as soon as I activate home mode then from then on away mode seems to take on the same settings as home mode.

I have a motion sensor that returns “true” or “false” rather than “on” and “off”, this sensor won’t trigger the alarm.

I want to ignore an open sensor when arming the alarm, I have specified this sensor to be ignored in the config but when activating the alarm it still asks me to override.

If I can fix these issues then it would be perfect!

could you post your alarm.yaml?

At the moment the addon only supports sensors that return on/off. you could setup a template sensor to change the value from true to on

@junior466 / @Cain I have implemented a function to detect unlocked/locked - true/false - detected/undetected statuses

Please note there are some significant changes in the code and it hasn’t been tidied up so use with caution.

If you could test and reply that would be great.

Should be live on github now

Tested the new true/flase code and seems to be working correctly, thanks.

Here is my alarm.yaml

platform: bwalarm
name: House
code: 0000
pending_time: 10 #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: False #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.door_window_sensor_158d0001de62ef
  - sensor.camera_motion
  - sensor.motion_hall

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

# 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_158d0001b1ce64
  - sensor.camera_motion
  - sensor.motion_lounge
  - sensor.motion_hall

# 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_158d0001b1ce64

# This group is special and only effects 'perimeter mode'. If perimeter_mode is enabled then any sensor in this group will trigger the alarm immediately if arm perimeter is set. There is no delayed group for this mode (unless requested as a feature of course!)
perimeter:
  - binary_sensor.door_window_sensor_158d0001de73a7
  - binary_sensor.door_window_sensor_158d0001de62ef

@gazoscalvertos I have tested the new code and the lock implementation works great. I added it to the delayed group and it gave me a warning when opened and triggered the alarm perfectly.

I am seeing the same this error message repeated over and over in my log though:

Log Details (ERROR)

Wed Dec 27 2017 12:57:28 GMT-0500 (EST)

Error doing job: Future exception was never retrieved
Traceback (most recent call last):
File “/usr/lib/python3.4/concurrent/futures/thread.py”, line 54, in run
result = self.fn(*self.args, **self.kwargs)
File “/home/homeassistant/.homeassistant/custom_components/alarm_control_panel/bwalarm.py”, line 186, in state_change_listener
if new.state.lower() == STATE_ON or new.state.lower() == STATE_TRUE or new.state.lower() == STATE_UNLOCKED or new.state_lower() == STATE_OPEN or new.state.lower() == STATE_DETECTED:
AttributeError: ‘State’ object has no attribute ‘state_lower’

@gazoscalvertos Another issue I am facing is if I enable the override mode, the alarm won’t arm at all.

Yeah I can confirm I get the same terrors in the log. Will check it out. Override mode also needs some work

1 Like

Thanks @gazoscalvertos for your quick response. Fibaro sensors works perfect but the Aeotec sensors will not trigger alert even if it senses motion.

On the other hand I created a separate automation script which trigger notifications when state changes from “0” to “8” for Aeotec sensors. That works fine for Aeotec sensors.

Below is my setup on Alarm panel. The sensor marked as Study is Fibaro and it will trigger even if state says “off” when it senses motion. Others are Aeotec and it will not trigger alert even if it senses motion.

Please note, above Alarm state is armed.

Thanks
RT

Hello Gazoscalvertos,
With the bug fix worked perfectly, thanks.
However I noticed another issue, after activating “home mode” and then disable it, if I activate the “away mode”, the sensors programmed as “homemodeignore” become inactive.

yeah sorry folks the new code introduced a few bugs working on them now

No problem, I also realized that the “shake” function does not work, nor does it allow the alarm to be activated if any sensor is open.

Now as a suggestion, the countdown circle should appear when any “Delayed Sensor” is activated so we have an idea of the remaining time until the alarm goes on.

Again, congrats for the great job!

Ok…

Sorted the following bugs:

  • Open sensor warning (shake feature)
  • Groups back working again home/away mode, thanks for the headsup @edufalcao
  • Fixed the weird repeated log error

Working on the timer delay feature.

@thakkar.rahul for the aeotec sensors is 8 the ‘on’ state of the sensor, or do you pull this from the attribute level?

Deactivating perimeter mode now works too!! :slight_smile:

This bug has been there for a while, I mentioned it in a previous post but maybe didn’t explain it well enough.

I’ve tested the update but it will no longer allow me to arm the alarm at all, theres a showstopper there somewhere.