Bwalarm (akasma74 edition)

that won’t work because this component work as following by default:

  1. check if any of the sensors (excluding override ones) are open
  2. arm only if there is no open sensors found at step 1

so the state of the alarm changes after step 2 and therefore your automation will never be executed when any of the sensors is open.

sounds bad as a) you already grouped them in bwalarm.yaml and b) it will be a pain to maintain the code when you add/remove/rename sensors so I wouldn’t do that.

I’ll think about possible solutions as soon as I have time.
I’d also suggest to read recent posts here as someone mentioned a similar thing.

Hi,

Thanks for taking the time. I tried looking almost all 700 post through and maybe i slipped it, but I wasn’t able to find what I was looking for.

I have created a nodered automation that announces any open sensors on Google TTS and notifies my phone.
Happy to share it if you wish.

I’m not that skilled in nodered, but maybe you can pose the code and I can try importing it.
Maybe I will be able to drill it apart so I can generate it in my automation file afterwards :slight_smile:

Perhaps if the alarm component had an inbuilt switch which would always be on/off based on the current status of all alarm sensors, representing a ‘ready’ status. Then when someone tries to arm the alarm, the component checks that the sensors are closed and if not, provide an output we can then use to trigger TTS etc. The core functionality of this obviously already exists since the component does already check for open sensors, hence we get this shown in the GUI and thus it won’t arm. If we have have an output for this sensor check it would provide customisable options such as TTS, mobile messages etc.

1 Like

Here’s my automation for open sensor notifications. I know there’s a way to pull the sensors directly from BWalarm, but I prefer this more visual representation.

Basically, I can specify whether the sensor notifies me when arming “away” or “home” separately.
It then checks the status of a particular sensor.
The function node formats the message, pulling the sensor name from the previous state node.
Finally, there’s a notify and TTS node.

[{"id":"9529988e.843498","type":"server-events","z":"5da73b18.815574","name":"Call Service Events","server":"b4442cdf.ce6f4","event_type":"call_service","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"x":170,"y":2180,"wires":[["f0c7c379.994d3"]]},{"id":"f0c7c379.994d3","type":"switch","z":"5da73b18.815574","name":"Alarm State","property":"payload.event.service","propertyType":"msg","rules":[{"t":"eq","v":"alarm_arm_away","vt":"str"},{"t":"eq","v":"alarm_arm_home","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":370,"y":2180,"wires":[["c99c2d79.3ab26","fe51b0e.a95475","c1c15248.8912f","ddd18552.49b758","268a1463.02673c","d1bfa8bd.355428","4eb554dc.df9adc","3fe69935.aeeeb6","cb381ae.2de41e8","a86490ff.1478a","fef95f5f.e8a5","42cb55a.18100ac"],["c99c2d79.3ab26","fe51b0e.a95475","c1c15248.8912f","ddd18552.49b758","d1bfa8bd.355428","4eb554dc.df9adc","3fe69935.aeeeb6","cb381ae.2de41e8","a86490ff.1478a","fef95f5f.e8a5","42cb55a.18100ac"]]},{"id":"c99c2d79.3ab26","type":"api-current-state","z":"5da73b18.815574","name":"Alfresco Door","server":"b4442cdf.ce6f4","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"binary_sensor.alfresco_door","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":840,"y":1920,"wires":[["99ed4481.b9fa08"],[]]},{"id":"fe51b0e.a95475","type":"api-current-state","z":"5da73b18.815574","name":"Front Door","server":"b4442cdf.ce6f4","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"binary_sensor.front_door","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":830,"y":1860,"wires":[["99ed4481.b9fa08"],[]]},{"id":"7ff291fe.415db","type":"comment","z":"5da73b18.815574","name":"Sensor Open Notifications","info":"","x":170,"y":1780,"wires":[]},{"id":"c1c15248.8912f","type":"api-current-state","z":"5da73b18.815574","name":"Garage External","server":"b4442cdf.ce6f4","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"binary_sensor.garage_external_door","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":840,"y":1980,"wires":[["99ed4481.b9fa08"],[]]},{"id":"ddd18552.49b758","type":"api-current-state","z":"5da73b18.815574","name":"Laundry Door","server":"b4442cdf.ce6f4","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"binary_sensor.laundry_door","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":840,"y":2100,"wires":[["99ed4481.b9fa08"],[]]},{"id":"268a1463.02673c","type":"api-current-state","z":"5da73b18.815574","name":"Garage Internal","server":"b4442cdf.ce6f4","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"binary_sensor.garage_internal_door","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":840,"y":2040,"wires":[["99ed4481.b9fa08"],[]]},{"id":"d1bfa8bd.355428","type":"api-current-state","z":"5da73b18.815574","name":"Study Window","server":"b4442cdf.ce6f4","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"binary_sensor.study_window","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":840,"y":2240,"wires":[["99ed4481.b9fa08"],[]]},{"id":"ee03f0eb.12ac4","type":"comment","z":"5da73b18.815574","name":"Doors","info":"","x":810,"y":1800,"wires":[]},{"id":"f96d35b7.d87058","type":"comment","z":"5da73b18.815574","name":"Windows","info":"","x":820,"y":2180,"wires":[]},{"id":"4eb554dc.df9adc","type":"api-current-state","z":"5da73b18.815574","name":"Living Room Window","server":"b4442cdf.ce6f4","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"binary_sensor.living_room_window","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":860,"y":2300,"wires":[["99ed4481.b9fa08"],[]]},{"id":"3fe69935.aeeeb6","type":"api-current-state","z":"5da73b18.815574","name":"Dining Room Window","server":"b4442cdf.ce6f4","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"binary_sensor.dining_room_window","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":860,"y":2360,"wires":[["99ed4481.b9fa08"],[]]},{"id":"cb381ae.2de41e8","type":"api-current-state","z":"5da73b18.815574","name":"Retreat Window","server":"b4442cdf.ce6f4","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"binary_sensor.retreat_window","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":840,"y":2420,"wires":[["99ed4481.b9fa08"],[]]},{"id":"a86490ff.1478a","type":"api-current-state","z":"5da73b18.815574","name":"Bedroom 2 Window","server":"b4442cdf.ce6f4","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"binary_sensor.bedroom_2_window","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":850,"y":2480,"wires":[["99ed4481.b9fa08"],[]]},{"id":"fef95f5f.e8a5","type":"api-current-state","z":"5da73b18.815574","name":"Bedroom 3 Window","server":"b4442cdf.ce6f4","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"binary_sensor.bedroom_3_window","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":850,"y":2540,"wires":[["99ed4481.b9fa08"],[]]},{"id":"42cb55a.18100ac","type":"api-current-state","z":"5da73b18.815574","name":"Bathroom","server":"b4442cdf.ce6f4","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"binary_sensor.bathroom_window","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":820,"y":2600,"wires":[["99ed4481.b9fa08"],[]]},{"id":"99ed4481.b9fa08","type":"function","z":"5da73b18.815574","name":"Message","func":"var sensorname = msg.data.attributes.friendly_name\nmsg.message =\n{\n    \"message\": \"Unable to Arm. \" + sensorname + \" Open.\" \n  }\nreturn msg;\n\n","outputs":1,"noerr":0,"x":1160,"y":2200,"wires":[["de529b2b.c691b8","406924bc.9b067c"]]},{"id":"406924bc.9b067c","type":"api-call-service","z":"5da73b18.815574","name":"TTS","server":"b4442cdf.ce6f4","version":1,"debugenabled":false,"service_domain":"tts","service":"google_translate_say","entityId":"media_player.entryway_speaker","data":"{\"message\":\"{{message.message}}\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1370,"y":2240,"wires":[[]]},{"id":"de529b2b.c691b8","type":"api-call-service","z":"5da73b18.815574","name":"Notify","server":"b4442cdf.ce6f4","version":1,"debugenabled":false,"service_domain":"notify","service":"notify","entityId":"","data":"{\"title\":\"ALARM\",\"message\":\"{{message.message}}\"}","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":1370,"y":2160,"wires":[[]]},{"id":"b4442cdf.ce6f4","type":"server","z":"","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

Wow I really like the visuality of NodeRed!
Could be nice if there was some sort of a export possibility to yaml automation. But yeah I know nodered is used for a looooot of things. I’m just trying to keep everything the same, so I don’t end up having a few automations in yaml, some in NodeRed and some directly created in the Automation front-end.

One thing though. The Alarm State, how do you get the information as AhmadK mentioned? The Alarm state does not change if any sensor is open, as the BWalarm does some backend stuff before it gets to the alarm state change?

One might have 3 different arm modes, each with its own set of sensors (and override sections) the alarm should track all sensors? Don’t think so.

The reality is sensors should be checked the moment we know what arm mode is being activated.
I’m thinking about generating a custom event if there are open sensors.

For what it’s worth, many commercial alarm systems operate the way I mentioned, even having a ‘ready’ LED on the keypad.
images

My alarm system has this functionality, although it’s shown as an icon on an LCD screen which you can tap to show open sensors

I appreciate that but imho one of many benefits of software alarms is it’s very flexible and configurable.
The way you mentioned makes sense but I personally prefer more precise diagnostics.

HTML will stop working in 0.115.0

Then don’t update to 0.115 yet.
They’re fast deprecating stuff without giving community devs time to change their code.
So far I’ve no idea how to migrate, mainly because didn’t have time to look into it.

We are still 7 weeks away from 0.115 I was just posting the commits made to remove it in case they offered any insight on how to move from HTML to .js

I get this multiple times per hour. If I disable bwalarm I don’t get it. I can’t figure out what its trying to do. It’s always with ‘id’:21.

I’m running 112.4 HassOS 4.11 Supervisor 228 on Raspberry PI - all current.
bwalarm is v 1.12.6

Has been a problem for many many prior versions but seems worse lately. Maybe worse with 112… but happened long before… Is something deprecated that isn’t alerting? Anyone see this and have tips?

2020-07-14 12:06:41 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.2807739760] Received {'type': 'config/auth/list', 'id': 21}
2020-07-14 12:06:41 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.2807739760] Error handling message: Unauthorized
2020-07-14 12:06:41 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.2807739760] Sending {'id': 21, 'type': 'result', 'success': False, 'error': {'code': 'unauthorized', 'message': 'Unauthorized'}}

Is your client logged in as admin or user?

Well there it is. Thanks. I set the tablet id to admin and the complaining goes away. I don’t recall seeing that as a tip in the documentation. Thanks for enlightening me.

Well, it took me some time to realise that the ugly message is related to a HA API call that works only if one uses admin’s account.
Since then I changed code so it checks if current user’s account and makes the call only if current user is an admin.
However, for some reason it does exist in my dev code but not in master one. Will fix it soon.
Thanks for pointing it out!

1 Like

I got a message tonight saying “This component is not working”.
This has been working for weeks.

I tried restarts, etc.
I backed everything up, and uninstalled Bwalarm, and reinstalled. No success.
I’ve cleared browser cache, etc and still nothing.

Any ideas please?

Did you check the home assistant log like it asks you to do?

Yeah I did. Could not find anything at all pertaining to Bwalarm.

EDIT: Replaced my Bwalarm.yaml, restarted and its working again. Don’t know what could have changed.

EDIT 2: So I had previously added name, under platform: bwalarm. This was never a problem until now, as its breaking the component.
Any ideas how I can rename the entity now? ie. alarm_control_panel.house_alarm

platform: bwalarm
name: House Alarm