Bwalarm (akasma74 edition)

New code installed and it seems to be working a treat :slight_smile:

Forgot to mention, I pretty much only set and disarm the alarm through the android alarm panel i’ve setup and wallmounted a rasp pi hardwired near the front door and screen plus i’ve got an cheap android phone near the staircase.

Otherwise I just use the alarm panel in lovelace as I found the dedicated frame a bit clunky (although the override / warning of an open sensor is an absolutely incredible feature! WAF (wife approval factor) for the more complex tab to set the alarm doesn’t fly need to keep it as simple as possible.

If we could get that override into the lovelace platform that would be amazing, I did notice someone mentioned something about an iframe into the front end which could be cool if we polish it.

Glad to hear your config is working again.
Thanks for the explanation regarding using the component in Lovelace mode.
To be honest, it’s pretty different to how the author designed it and I’ll need to investigate it further to see what’s possible.
As it’s not a bug fix but rather a feature request, I can’t promise anything soon because currently I just don’t have enough time to do any serious development. Hope you understand.

hello. i installed bwalarm with no problems. i also have konnected component to manage sensors and siren. but i got 2 questions/problems. 1st is i cant set how long the alarm will trigger from the iu of bwalarm. no matter how long i set the seconds it triggers based on the timer set on the siren set in sensor config file. and second i cant figure out how to set i.ex. sensor triggers, siren hits for i.ex 300 seconds then turn off and if the sensor is still open to retriger the siren for 300 seconds

Go to Settings (at the bottom right of your screen) → Sensors
There you can change Trigger Time for each alarm mode (Home/Away etc)

I don’t get that mate


Same thing here - could you elaborate?

Does anyone use perimeter mode? I was thinking of using it only when we have overnight guests who might roam about downstairs.

Well, I personally yet to start using it, but it’s unclear if there is any difference between Perimeter and Home mode. Anyone (before I dive into the code)?

Isn’t it that you (the user) can define (in settings) a third ‘armed’ option? You have armed away, home and perimeter? So for me:

away: any/all sensors would trigger an alarm, entry/exit doors would be a delayed alarm
home: all DOWNSTAIRS sensors would trigger an alarm
perimeter: only entry/exit doors would trigger an alarm + outbuilding motion

Yeah, it’s most likely just one more set of sensors/settings for people who need some extra flexibility i.e not only Away.

#####konnected######
konnected:
access_token: alarm
api_host: http://192.168.1.111:8123
devices:
- id: 68c63ad6f05e
binary_sensors:
- pin: 1
type: window
name: ‘panic_button’
inverse: true
- pin: 2
type: window
name: ‘back_windows’
- pin: 5
type: door
name: ‘front_door’
- pin: 6
type: window
name: ‘front_windows’
switches:
- pin: 7
name: ‘alarm’

this is my config for the nodemcu with sensors.

i know the bwalarm settings that you can change the time to the siren but it doesnt work. it still gets the time to trigger from the config file switches -pin7 name alarm the default value which is 300 secs

Can you fix formatting of your config?
As far as I can see, it’s some component’s config - how is it applicable to bwalarm?

{“state”: “disarmed”, “timeoutat”: null, “returnto”: “disarmed”, “states”: {“armed_away”: {“immediate”: [], “delayed”: [“binary_sensor.front_door”], “override”: [], “pending_time”: 20, “warning_time”: 0, “trigger_time”: 6}, “armed_home”: {“immediate”: [], “delayed”: [], “override”: [], “pending_time”: 0, “warning_time”: 0, “trigger_time”: 6}, “armed_perimeter”: {“immediate”: [], “delayed”: [], “override”: [], “pending_time”: 0, “warning_time”: 0, “trigger_time”: 6}}, “armstate”: “disarmed”}

this is my alarm.json file

- id: '1556313173146'
  alias: Trigger alarm while armed home or away
  initial_state: 'on'
  trigger:
  - entity_id: binary_sensor.back_windows
    from: 'off'
    platform: state
    to: 'on'
  - entity_id: binary_sensor.front_door
    from: 'off'
    platform: state
    to: 'on'
  - entity_id: binary_sensor.front_windows
    from: 'off'
    platform: state
    to: 'on'
  - entity_id: binary_sensor.panic_button
    from: 'off'
    platform: state
    to: 'on'
  condition:
  - condition: or
    conditions:
    - condition: state
      entity_id: alarm_control_panel.house
      state: armed_away
    - condition: state
      entity_id: alarm_control_panel.house
      state: armed_home
  action:
  - entity_id: alarm_control_panel.house
    service: alarm_control_panel.alarm_trigger
- id: '1556313328688'
  alias: alarm triggered
  trigger:
  - entity_id: alarm_control_panel.house
    platform: state
    to: triggered
  action:
  - data:
      message: '!Alarm Triggered!'
    service: notify.notify
  - data: {}
    service: switch.turn_on
- id: '1556817962140'
  alias: autostart
  initial_state: 'on'
  trigger:
  - event: start
    platform: homeassistant
  condition: []
  action:
  - alias: ''
    data: {}
    service: automation.turn_on

and this is my automations file (some of them are copy paste from a template not all working)

i got a simple nodemcu with some sensors flashed with konnected files with 3 sensors and 1 siren. all works as intended with normal manual alarm. with bwalarm i cant set the trigger time. no matter what.

also i want when a sensor is open to keep firing i.ex 3 mins straight then stop for a min then fire again 3 mins stop for 1 min then last time 3 mins. so its 3-1-3-1-3-stop

and also the delay for front door dont work for me even if i have set front door to a delayed state for 20 secs, it pops up a warning for a split sec then fires the alarm
its like something else overrides the settings of the bwalarm

Do you want to say that with the alarm.json above your siren will run for 300 seconds?
The value that defines that is trigger_time and as far as I can see you have it set to 6 seconds no matter the alarm mode.

Bwalarm has nothing to do with an sensors, it picks state changes from HA. And it’s the very first time I learn about inability to change bwalarm’s settings.

Try to delete the alarm.json file, copy the default alarm.yaml from the repo and try to configure it wit say, 1 sensor. It’s quick and easy.

there is no such functionality in bwalarm - it’s designed to run for trigger_time and then back to armed state. If you wish, you can write automation that reacts to alarm.state change to triggered I presume, but I wouldn’t recommend that.

If you press Away button, it’s 20 seconds before you leave. If you press Home or Perimeter button, it’s 0 (i.e immediate). Does it make things clear?

and the last thing. I don’t know what is your automation for, but it looks like you are reacting to the sensors’ change of state. If so, just set

initial_state: false

in all of these sensor-related automations and see if it changes the behaviour.
it’s bwalarm’s job and it’s already there.
you need to state which sensors bwalarm should react to (in alarm.yaml manually or via Settings - > Sensors) and that’s it.
the only automation you need is reaction to alarm entity changing its state to disarmed, warning, triggered etc.

I hope it makes sense.

thanks for the reply. i will come back soon with my results :slight_smile:

so. my automations for each sensor must be in alarm.yaml or in automations.yaml?

you need to enter which sensors trigger the alarm immediately and after warning_time in appropriate sections of Settings -> Sensors. as soon as you configure it, you should see it in alarm.yaml

you don’t need any automation that reacts to your sensors triggering and tries to fire the alarm.
disable all of them or remove completely.

well the problem isnt that bwalarm dont work as expected. i counted that the title says triggered responds to the time you set. the problem is that the actual siren.

there is a switch for the siren. when i set in automations this

- id: alarm_triggered
  alias: '[Alarm] Triggered'
  trigger:
  - platform: state
    entity_id: alarm_control_panel.house
    to: 'triggered'
  action:
  - service: switch.turn_on
    entity_id: switch.siren_switch ```

it activates the siren but wont stop on time set on the bwalarm. i know there is something stupid i make but cant figure out

Oh dear. You switched your siren on, you need to switch it off.
There is more than one answer how to do that though.
I cannot provide my own version as it’s a bit special and redundant for many of normal users (I need to cycle my sirens like: 300 seconds in total, 30 seconds on then 10 seconds rest and so on). it’s obsolete after all :\

It’s almost the same as your code, but the other way round

- alias: turn_siren_off
  initial_state: true
  trigger:
    platform: state
    entity_id: alarm_control_panel.house
    from: 'triggered'
  action:
    service: switch.turn_off
    entity_id: switch.siren_switch

p.s please please enclose your code between three single back quotes when you post it - that preserves formatting. without that we won’t be able to help you any further.

oh damn it works now. what kind of sorcery is this. well i thought that the action from triggered to armed state should manage the switch to turn it off. thank you very much
i am onto this for over a week trying to figure it out. i could only set the component switch to a momentary to make it work. you are the man!

ps. i would like to see your take on that alarm cycle. i want someting similar. like 180 secs on 60 secs off 180 on and so on for like 10 mins or so. as long as the sensor is on just in case i got a problem with sensor like i had with the normal hardwired alarm

Just as an FYI, this is how commercial alarm systems work. If the siren time expires and the sensor is still in an alarm state, then the siren is re-triggered for its programmed duration again. Otherwise an intruder could simply wait out the siren time (if there was no one home) and then freely stay in the house silently.