Custom Component: Crow Runner/AAP 8/16 Alarm IP Module

Dear Friends,
As i am in the process of migrating into Home Assistant from Domoticz, I find HA to be much more powerful and stable.

I moved all my devices succesfully so far; except for the Crow/AAP Alarm IP Module which i created a plugin for Domoticz myself (https://github.com/febalci/DomoticzCrowAlarm). This module simply provides a telnet connection and gives the status of the sensors and zones realtime on this connection. The telnet connection needs to be open all the time in order to get all status messages from and send required alarm control panel messages.

Could you guys show me the right direction to move on for creating a custom component which will include alarm_control_panel and binary_sensor; or at least a simple custom component which uses socket connection to take reference… The development documents are not very HA beginner friendly, and i am fighting hard to find my way out using the HA github components folder as samples. The IP module do not have an API; i can write one if it is required. Honestly i am trying to solve it as a custom component without any dependencies…

Thanks for all your help…

Hi febalci, have you made any progress with this? I remember seeing you over on the Domoticz forum. I too have a Crow Alarm, but I’m not savvy enough yet to be able to write custom components to talk to it. I remember someone on that forum mentioned they use node-red to convert the TCP packets into MQTT and then used the MQTT alarm panel to talk to the alarm. Would be nice to have something a bit more polished though.

The other thing you could try is having a look at the other alarm components and try adapting them. The Envisalink alarm module also uses a TCP socket connect I believe and you can see the source code for that. It uses the asyncio python library for the socket connection I think. I had a look but got lost. Maybe you can get further than me.

Hello Jock,
That’s exactly what i am doing right now :grinning: Going through the source code of api and ha integrations of envisalink, pioneer and some other socket based integrations. I am in the process of writing an asyncio python api for crow ip module, that is required in order to write a custom-component or native integration, since the integration will use 2 entities, alarm_panel and binary_sensor and maybe a couple of switches.

And it takes some more time for me to understand and get used to HA environment after giving up on domoticz…

Just yesterday i handled the getting messages and processing part of the api successfully; now it’s time to handle sending the commands (arm,disarm etc.) part. Guess it will be handled pretty soon. After i complete and test API, i am gonna work on the custom_conponent integration to HA. The best part is that it will use ‘local push’, so you will be able to see the zone changes instantenously on HA, like it was on domoticz :crossed_fingers:
Anyway, once (if) i can finish it i will post the download address here.

That’s great news to hear that you are making progress! I’ve been eagerly waiting and hoping that someone would be able to do this :smile:

With every bit of dirty code and sins included; my first attempt on an async api and a custom component seems like it is ready. I spent too much time trying to understand the architecture of home assistant and custom components since i am a newbie.

Anyway; this first attempt is on https://github.com/febalci/ha_pycrowipmodule

BUT!!! Please be aware that this is a beta of a beta at its best; All status feedback is working on zones and system status; not so sure about arming/disarming since all my house people are at home and there’s no way to test it for now… So i strongly recommend to try it on a test HA environment if possible and get ready for false alarm triggers :yum:

When i find some time for an isolated home environment, i will also test for arming/disarming. If there is a brave soul to test and send some feedback for me i appreciate… And also, if there’s someone out there with Python and HA experience, maybe they can help me with the mess i made on the code.

There is a sample configuration.yaml entry on the repository.

1 Like

Just tried out your custom components, many thanks for your effort!! I can confirm that the status monitoring is working :slight_smile: I haven’t done too much testing on the arming/disarming, since I’m home, but I did try arming area B and noticed it started arming area A, and noticed that it said area A was armed when it wasn’t so not sure what’s happening there. I’ll do some more testing later, as I have only just got it up and running.

I notice the arming doesn’t require the code to be input, but does disarming require the code?

Ok, testing it for a while. These things work nicely:

  1. All zone binary sensors (Open,Close)
  2. All System Status Binary Sensors (mains power, battery, pendant battery etc.)
  3. Arm Away (Arm), Arm Home (Stay Arm)
  4. Bug in Disarm is corrected today, with pycrowipmodule 0.17
  5. Usage of sensor in automations:
    Sample:
- alias: Close Everything Down on Bedtime or go out when alarm is set Arm Home or Arm Away
  trigger:
  - platform: template
    value_template: '{{is_state_attr(''sensor.area_a_keypad'',''disarmed'',
    False)}}'
  action:
  - service: light.turn_off
    data:
      entity_id:
      - light.mutfak
      - light.salon
  - service: media_player.turn_off
    entity_id: media_player.salon_tv
  - service: cover.close_cover
    data:
      entity_id:
      - cover.qubino_goap_zmnhcdx_flush_shutter_switch_2
      - cover.qubino_goap_zmnhcdx_flush_shutter_switch
      - cover.qubino_goap_zmnhcdx_flush_shutter_switch_3
      - cover.qubino_goap_zmnhcdx_flush_shutter_switch_10
      - cover.qubino_goap_zmnhcdx_flush_shutter_switch_7
      - cover.qubino_goap_zmnhcdx_flush_shutter_switch_6
      - cover.qubino_goap_zmnhcdx_flush_shutter_switch_8
      - cover.qubino_goap_zmnhcdx_flush_shutter_switch_4
      - cover.qubino_goap_zmnhcdx_flush_shutter_switch_9
      - cover.qubino_goap_zmnhcdx_flush_shutter_switch_13
  - service: cover.close_cover
    data_template:
      entity_id: >
        {% if is_state_attr('sensor.area_a_keypad','armed',True) %} 
        cover.qubino_goap_zmnhcdx_flush_shutter_switch_5
        {% endif %}

Need Check on these:

  1. Panic Alarm
  2. Output Handling
  3. Zone Alarm handling

Thanks Jock, I just tried arming/disarming today and it works with the new change on 0.17, so please update your custom component from github which uses pycrowipmodule 0.17 to fix disarm bug.
Arming is done with STAY or ARM commands so it does not need code, but disarm is only made with KEYS XXXXE code, so you have to enter the code in configuration.yaml.
Since i use only Area A for whole home, and not use Area B; i didnot care too much on it. But the command ARM sets them both as far as i understand. We have to use ‘A’ or ‘B’ commands for quick_arm_a or quick_arm_b as far as i understand. I will try to take a look at it when i find some time. Thanks for all your help…

Btw, the AAP document of the IP Module commands i use is this:
AAP IP Module pdf

Thanks Erkan, I’ll update the custom component and give a try soon.
One of the first automations I want to implement with this is to have notifications on my phone when the alarm goes off indicating which zone was triggered, since I want to monitor this myself. Thinking of trying node-red to create the automation and get it to send a message to something like push bullet maybe. Have you started playing around with monitoring stuff yet?

Hi Jock, there is a problem with the zone alarms at the moment, i will handle it next week (I am on work travel this week). Once it is handled, it will be very easy to incorporate notifications. I am using pushover notification for electric power cuts using the ‘mains’ binary sensor of this custom Component and it works pretty well. Honestly, if not for some other purpose, you won’t even need to use node-red for this.

Do you mean a problem with how the alarm panels respond when an alarm is triggered? I hadn’t actually tested what happens when an alarm is triggered, but I did create notification automations when each area is triggered, just haven’t tested that yet. I also got the mains failure notification working, and setup notifications when any area is armed or disarmed. I’m using Telegram. The only reason for using node-red is because I’ve never used it before and this was a good little practice exercise to get me started with it :slight_smile:

Well, i uploaded v0.19 to github just now. The fixes are:

  1. Alarm panel now correctly shows as “Pending” during “Arm Exit Delay” or “Stay arm Exit Delay”.
  2. The Zones State were Open/Close only. Added Alarm/Tamper/Bypass as State Attributes to each Zone Device. So you have to use attribute trigger in your automations for zone alarms. On “Area Keypad” Device State Attributes, you will see an “Alarm Zone”; this is supposed to change to the Alarm Zone number when an alarm is triggered. Haven’t tested it tough. Will post an automation for this, once i make sure everything works well.

I am trying these automations now:

- alias: Coming Home
  trigger:
  - platform: template
    value_template: '{{is_state_attr(''binary_sensor.giris_pir'',''alarm'',
    True)}}'
  condition:
  - condition: state
    entity_id: alarm_control_panel.area_a
    state: 'armed_away'
  - condition: state
    entity_id: group.family
    state: 'on'
  action:
  - service: cover.open_cover
    data:
      entity_id:
      - cover.qubino_goap_zmnhcdx_flush_shutter_switch_2
      - cover.qubino_goap_zmnhcdx_flush_shutter_switch
  - service: light.turn_on
    data_template:
      entity_id: >
        {% if is_state('sun.sun','below_horizon') %} 
        light.salon
        light.mutfak
        {% endif %}
  - service: alarm_control_panel.alarm_disarm
    entity_id: alarm_control_panel.area_a
  - service: cover.open_cover
    data_template:
      entity_id: >
        {% if is_state('sun.sun','above_horizon') %} 
        cover.qubino_goap_zmnhcdx_flush_shutter_switch_5
        {% endif %}

And this is for Power Cuts:

# Power cut notification
- alias: Power Cut Mains On/Off
  trigger:
  - platform: state
    entity_id: binary_sensor.mains
  action:
  - service: notify.pushover
    data_template:
      message: > 
        {% if is_state('binary_sensor.mains','off') %}
        Elektrikler Kesildi!!!
        {% else %}
        Elektrikler Geldi...
        {% endif %}

I tried out V0.19 but I’m still getting some strange behaviour. If I press arm home for Area B, it starts arming Area A. Then if I manually stop Area A from arming using the actual keypad, on HA it hangs on Pending for Area A, with the option to disarm. If I press disarm for Area A, it starts Arming both Area A and B. After cancelling that using the keypad, Area A still hangs on Pending, and doesn’t recover, even if I reset the alarm and HA.

If I press Arm Away for Area B, it starts arming both area A and B.

Any ideas?

Sorry I just realised that earlier you mentioned arming individual areas required more work, so it makes sense. It looks like using the Arm Away still works to arm both areas and disarming works to disarm both. However, the Pending thing hanging still seems to be an issue. I can still initiate arming and disarming using the Disable button, but it just stays on Pending. I think it might sort itself out if I let it actually finish the exit delay, arm, then I disarm, but I can’t try that right now with my housemate home. I think this bug has to do with cancelling the arm during exit delay

Yep, found out the pending problem; and the cause. The crow panel is actually disarmed but on HA it stuck on showing pending. You can follow up the versions in manifest.json file on github; where it says (as of now) pycrowipmodule==0.19. I will correct this issue on 0.20. Thanks for your patience Jock.

0.20 is on github

  1. Corrected ‘Pending’ issue.
  2. On Alarm triggered, Alarm_Panel shows it as alarm triggered, on sensor.area_a the attribute ‘alarm_zone’ shows the triggered alarm zone number and also the sensor.area_a state shows this zone number. I found no way of getting the corresponding zone name from the config file in sensor.py; give it to my being noob in HA. Some day i will find it…
  3. After i make sure this works well with my current setup, i will handle the individual area arming for you as well; some more patience…

Thanks Erkan! I’ll give it a try and let you know how it goes. Thanks again for all your work, it’s great to finally have my alarm working with HA :grinning: It looks like we’re the only two on here that have the same alarm - I was wondering if I’d ever find someone else with a Crow alarm. I’m sure one day someone else will stumble across this.

Haha!!! Actually as i see around there are really many people out there using Crow Alarms and Arrowhead AAP Alarms, and Crow or AAP IP Modules, very few people using AAP firmware loaded Crow IP Modules, and only us two having all these plus using homeassistant :laughing:

Crow is an Israeli company shipping worldwide, AAP is a NZ company working with Crow Industries and shipping mainly to NZ and Australia. In my home country Turkey, Crow and DSC are the two main actors in alarm industry.

Some years ago, it took me some mails to make the AAP tech guys convince to have a firmware on IP module just for home automation guys like us… And i was the only beta tester for that firmware and feed them with all the bugs in the firmware for them to correct. After 6-7 tries and lots of testing, they came up with this firmware and i am happy that i convinced them so. They still did not advertise this possibility why i don’t know… Otherwise i was going to spend a hell of a money to change my current perfectly working alarm. And also, the guys at AAP support were the best i have ever encountered in any product support; they tirelessly helped me a lot during the process…

Btw, i have been testing the current 0.20; and everything seems fine. Here is my automations for reference:
Bedtime and Leaving the house (Manual set of arm_away or arm)

- alias: Shut Everything Down on Bedtime
  trigger:
  - platform: template
    value_template: '{{is_state_attr(''sensor.area_a_keypad'',''disarmed'',
    False)}}'
  action:
  - service: light.turn_off
    data:
      entity_id:
      - light.mutfak
      - light.salon
  - service: media_player.turn_off
    entity_id: media_player.salon_tv
  - service: cover.close_cover
    data:
      entity_id:
      - cover.qubino_goap_zmnhcdx_flush_shutter_level_2
      - cover.qubino_goap_zmnhcdx_flush_shutter_level
      - cover.qubino_goap_zmnhcdx_flush_shutter_level_3
      - cover.qubino_goap_zmnhcdx_flush_shutter_level_10
      - cover.qubino_goap_zmnhcdx_flush_shutter_level_7
      - cover.qubino_goap_zmnhcdx_flush_shutter_level_6
      - cover.qubino_goap_zmnhcdx_flush_shutter_level_8
      - cover.qubino_goap_zmnhcdx_flush_shutter_level_4
      - cover.qubino_goap_zmnhcdx_flush_shutter_level_9
      - cover.qubino_goap_zmnhcdx_flush_shutter_level_13
      - cover.qubino_goap_zmnhcdx_flush_shutter_level_5
# SUMMER TIME:
#  - service: cover.close_cover
#    data_template:
#      entity_id: >
#        {%- if is_state_attr('sensor.area_a_keypad','armed',True) %} 
#        cover.qubino_goap_zmnhcdx_flush_shutter_level_5
#        {%- endif %}

Coming Home:

- alias: Coming Home
  trigger:
  - platform: template
    value_template: '{{is_state_attr(''binary_sensor.giris_pir'',''alarm'',
    True)}}'
  condition:
  - condition: state
    entity_id: alarm_control_panel.area_a
    state: 'armed_away'
  - condition: state
    entity_id: group.family
    state: 'on'
  action:
  - service: alarm_control_panel.alarm_disarm
    data:
      entity_id: alarm_control_panel.area_a
      code: !secret crow_code
  - service: cover.open_cover
    data:
      entity_id:
      - cover.qubino_goap_zmnhcdx_flush_shutter_level_2
      - cover.qubino_goap_zmnhcdx_flush_shutter_level
      - cover.qubino_goap_zmnhcdx_flush_shutter_level_3
      - cover.qubino_goap_zmnhcdx_flush_shutter_level_10
      - cover.qubino_goap_zmnhcdx_flush_shutter_level_7
  - service: light.turn_on
    data_template:
      entity_id: >
        {%- if is_state('sun.sun','below_horizon') %} 
        group.all_lights
        {%- endif %}
  - service: cover.open_cover
    data_template:
      entity_id: >
        {%- if is_state('sun.sun','above_horizon') %} 
        cover.qubino_goap_zmnhcdx_flush_shutter_level_5
        {%- endif %}