YET another take on an alarm system

Hi all,

Well… after debuggin the code I get this.

On line 575 from last version of bwalarm.py whe have this:

 elif new_state == STATE_ALARM_PENDING:
                _LOGGER.debug("[ALARM] Pending user leaving house")
                self._hass.services.call("switch", "turn_on", {self._warning})
                self._timeoutat = now() + datetime.timedelta(seconds=self._pending_time_by_state[self._armstate])
                #self._returnto = STATE_ALARM_ARMED_AWAY
                self.setsignals(self._armstate)

this is the code that blocks my HA to start. If I replace
self._hass.services.call("switch", "turn_on", {self._warning})

by old code

switch.turn_on(self._hass, self._warning)

My HA starts but alarm still not working, any idea?

Has anybody installed this on the Hass.io version?

I have had it running on HassIO since the first version. Seems to be working fine

@sparkydave
So, admittedly I’m a bit of a Newb… how did you install it? I thought the point of the Hass docker container was I couldn’t access the base HA environment, and if I did, it would get overwritten when I update the Hass.io version?

To install you copy a few files to specific places in your config folder. It does not alter the base image. Then configure a couple of YAML files. Read the installation instructions here:

as Tom said above, it is just a matter of having the right files in the right locations. There is no ‘installation’ as such, in the way you would consider installing applications.

One very easy way to do it is to first install (this one is actually an install) the ‘Cloud 9 IDE’ HassIO add-on from the add-on store. This lets you open a second browser window where you can see, edit and add the yaml files very nicely. I use it as my main yaml editor. Once you have this installed it will make setting up the alarm system (and all of your other yaml editing) a lot easier.

Yea, thanks guys, I was being dumb, I do see now that’s it’s just /config files. I’ve got the basic install done, now I just need to setup my automations and things.

Hi All,

Not sure if someone found a fix but my alarm has stopped working after version 0.81 upgrade. I got the latest files from the github but still same issue. I read through some posts and it seems people are having similar issues with bwalarm.py.

Please let me know if you have found a solution to the issue.

Update: Seems like issue between MQTT and Alarm. Below is the log message:

Error doing job: Exception in callback <bound method MQTT._mqtt_handle_message of <homeassistant.components.mqtt.MQTT object at 0x7f8e16fe5908>>

Traceback (most recent call last):
  File "uvloop/cbhandles.pyx", line 66, in uvloop.loop.Handle._run
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/mqtt/__init__.py", line 749, in _mqtt_handle_message
    subscription.callback, msg.topic, payload, msg.qos)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/core.py", line 327, in async_run_job
    target(*args)
  File "/config/custom_components/alarm_control_panel/bwalarm.py", line 668, in message_received
    self.alarm_arm_away('')
  File "/config/custom_components/alarm_control_panel/bwalarm.py", line 485, in alarm_arm_away
    self.process_event(Events.ArmAway)
  File "/config/custom_components/alarm_control_panel/bwalarm.py", line 577, in process_event
    self._hass.services.call("switch", "turn_on", {self._warning})
  File "/usr/local/lib/python3.6/site-packages/homeassistant/core.py", line 1070, in call
    self._hass.loop
  File "/usr/local/lib/python3.6/site-packages/homeassistant/util/async_.py", line 138, in run_coroutine_threadsafe
    raise RuntimeError('Cannot be called from within the event loop')
RuntimeError: Cannot be called from within the event loop

Thanks,
RT

If the alarm was triggered, it would be nice to disarm it by actionable push notification sent to mobile, instead of remembering the PIN.

You can do that by including the PIN in the disarm service call that you assign to the push notification reply button

1 Like

Still getting this error when arming and disarming, works fine just error not sure why
2018-11-02 14:55:38 ERROR (MainThread) [homeassistant.core] Invalid service data for switch.turn_off: expected a dictionary. Got {‘automation.alarm_warning’}

Copy and paste your arm and disarm automations here. Sounds like something is amiss with them.

Noting has changed except the latest home assistant update (when I went .81) and the new bwalarm.py (which fixed system not working after update
But here they are
- id: alarm_armed_away
alias: ‘[Alarm] Away Mode Armed’
trigger:

  • entity_id: alarm_control_panel.house
    platform: state
    to: armed_away
    action:
  • data:
    message: Alarm Away Mode Armed
    service: notify.pushbullet
  • data:
    entity_id: media_player.kelvins_echo
    message: Alarm Away Mode Armed
    service: media_player.alexa_tts
  • alias: ‘’
    data:
    entity_id: script.arm_house
    service: script.turn_on
  • data:
    entity_id: lock.touchscreen_deadbolt_23
    service: lock.lock
  • id: alarm_armed_home
    alias: ‘[Alarm] Home Mode Armed’
    trigger:
    • entity_id: alarm_control_panel.house
      platform: state
      to: armed_home
      action:
    • data:
      message: Alarm Home Mode Armed
      service: notify.pushbullet
    • data:
      message: The house alarm has been switched on in home mode. Goodnight
      service: notify.example_phone_tts
  • id: alarm_arming_away
    alias: ‘[Alarm] Away Mode Arming’
    trigger:
    • entity_id: alarm_control_panel.house
      platform: state
      to: pending
      action:
    • data:
      entity_id: media_player.kelvins_echo
      message: Away Mode Arming
      service: media_player.alexa_tts
  • id: alarm_disarmed
    alias: ‘[Alarm] Disarmed’
    trigger:
    • entity_id: alarm_control_panel.house
      platform: state
      to: disarmed
      action:
    • data:
      message: Alarm Disabled
      service: notify.pushbullet
    • data:
      entity_id: switch.foscam_lounge_arm
      service: switch.turn_off
    • data:
      entity_id: switch.dlink_garage_arm
      service: switch.turn_off
    • data:
      entity_id: switch.siren_46
      service: switch.turn_off
    • data:
      entity_id: media_player.kelvins_echo
      message: Welcome Home Alarm Disarmed
      service: media_player.alexa_tts
  • id: alarm_triggered
    alias: ‘[Alarm] Triggered’
    trigger:
    • entity_id: alarm_control_panel.house
      platform: state
      to: triggered
      action:
    • data:
      entity_id: script.1532570113808
      service: script.turn_on
    • data:
      message: ALARM TRIGGERED!!! {{ states[states.alarm_control_panel.house.attributes.changed_by.split(".")[0]][
      states.alarm_control_panel.house.attributes.changed_by.split(".")[1]].name
      }}
      service: notify.pushbullet

Can you give as the example code, please?

in your script action for the notification reply, have something like this below. (note: not my real code!)

action:
  - service: alarm_control_panel.alarm_disarm
    entity_id: alarm_control_panel.house
    data:
      code: 1234

how you do it will depend on the push notification system that you are using

You need to edit your post and format tit as per the blue banner at the top of the page. Also include the automation directly before automation.alarm_warning

I also updated recently to 0.81.x and found that I couldn’t arm the alarm.
Upgrading to current version solved the problem (of arm/disarm), but as @suds32 I’m getting the Invalid service data for switch.turn_on: expected a dictionary. Got {‘automation.alarm_warning’}

In other order of things, haven’t checked the thread for a long time (that’s what happens when things work)
Is it worth updating to the new UI version?

Im quite keen to try the new UI but can’t find any info on how or screen shots of it

Hi Guys,

Anyone able to make the Alarm run on new 0.8.1.x version? I can’t even open the UI. All I see if below screen.

PS: How do you disable new UI?

Thanks in advance.
RT