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

Hi, Thanks for the info. I am running version 0.116.4 so only a little behind you.

So I restarted HA and all the sensors (badges) appear to be working ok and they are showing a state history which is good.
To be honest I am on the other side of the world to my install at the moment but the family are home and I have remote access, so I can do things and see what happens when they are triggered etc…

Strange that the sensors stopped responding 3 weeks ago… I cant figure out why.

I checked in the RAW editor and I can see my sensors all fine. I will create an entity card and monitor whats going on.
I will let you know if and when they stop responding again.

Thanks for your advice and time, keep safe.

OK, So an update on my sensors.
@febalci they all seemed to work fine up until about 4 days ago and then the badges stopped updating and the history of each sensor became unavailable.
Not being a code guru, where do I start to figure out whats going on?

Cheers

Simon

Is IP module connected with a LAN cable or wifi via a network bridge? I feel like there is something wrong with the network. When you mean “History of each sensor”, i understand that the under Developer-States part, the binary_sensors of the alarm shows “unavailable” ? You better check the statuses from the Developer-States part always, not on Dashboard-Badge history.

Also, does IP Module have static IP Address or DHCP? (You can check it from AAP IP Module settings page, not from HA).

Also is there anything on HA logs related to this component??

Thanks for the reply.
The IP module is connected via LAN cable and has static IP address assigned. I get the same feeling about the network but its pretty robust. I use Ubiquiti USG and AP which has been really good since I upgraded.
I mean when I click the sensor badges, it gives me the sensor history and when the sensors detected movement and when they cleared.
I will keep an eye on when they fail next and check from the developer states. I had a quick look at the logs but nothing obvious about the integration. I have restarted HA, so this could have cleared a lot of messages.

OK, So I just rechecked the logs and found this?

AlarmControlPanel is deprecated, modify CrowIPModuleAlarm to extend AlarmControlPanelEntity
6:16:41 PM – Alarm control panel (WARNING)
SwitchDevice is deprecated, modify CrowIPModuleOutput to extend SwitchEntity
6:16:41 PM – Switch (WARNING)
BinarySensorDevice is deprecated, modify CrowIPModuleBinarySensor to extend BinarySensorEntity
6:16:41 PM – Binary sensor (WARNING)

Any ideas?

I also use Ubiquiti USG and APs. Although i use wifi bridge for IPmodule (non Unifi bridge), it is pretty robust. Did you made the static IP from the USG or the IP Module web settings page? I made it thru IP Module web settings page. The messages in the log should not cause an issue; although it reminds me to correct the deprecated components.

Check out this for Log file backups for HA restarts. So that your log will be backedup automatically during restarts and you will not lose any warnings and errors. Backing up home-assistant.log file on restarts

Corrected the deprecated components to reflect Entity type on github. It should not give any more warnings (I hope…)

Yep, good work. All the errors are gone when I rebooted.
Will see what happens next time the sensors fall over.

I managed to remote desktop into my install ( I am away from home) and looked at the IP address in the IP module. Thats set correcty as it shows in the UBNT web gui. What I did notice was the gateway was not set for some reason. So I set this and also noticed the DNS wasnt set.
What do you have set in this?

Cheers

That’s my IP module Network Settings:

Thanks for this, yes mine looks very similar. Well it does now there is an IP address in the Pri.Gateway.

Time will tell now.

Thank you for the great work, I purchased the IP Module for my Arrowhead alarm based on your work here!

One issue, I’ll do some debugging soon, but if I “Arm” and then “Disarm” before arming is complete, it takes a while for “Pending” to disappear in Home Assistant, any thoughts?

Welcome to our tiny Arrowhead Users community @mish :laughing:

Its been quite some time and i barely remember the contents of this component code (because i am old, lol), but in fact both ‘Arm Away’ and ‘Disarm’ sends the same code ‘KEYS XXX E’. And waits for the acknowledgement from IP module, and then once it gets the ack, it corrects that on the HA.

Would it be possible if you can try that to see the latency is still there; Press ‘Arm Home’ instead of ‘Arm Away’ and then press ‘Disarm’ before arming is complete. Is it the same latency as your problem? ‘Arm Away’ is converted to ‘KEYS XXXX E’ instead of using ‘ARM’ command since one of the users is having a problem but ‘Arm Home’ is still using ‘STAY’ command; i want to make sure the problem is not from sending 2 same ‘KEYS’ commands once in a row.

And unfortunately, i don’t believe i am competent enough to go in detail in debugging, especially on the HA side…

Thank you again @febalci for your work here. I purchased this house a few months ago and your work has saved me from having to replace the entire alarm system. Arrowhead should pay you a commission on IPMODULE sales! :wink:

It doesn’t matter which method I use to arm, the same issue occurs, I can disarm fine from Home Assistant, but it takes 30-60 seconds for the disarm to be display.

I recorded it on YouTube: https://youtu.be/8f12bMT6Hog

I’ll do some deeper debugging over the weekend. Let me know if you have any tips. :slightly_smiling_face:

Yeah, that seems like the component issue, not HA. Will try to find the cause.

I think a temporary solution would be to change “keep_alive” in configuration.yaml to a lower value. The default 60 in keep_alive is send “STATUS” request to IP Module every 60 seconds. If i remember correctly (I am not sure…) when you send an ARM or STAY request, you get back a valid response either ‘AA’ or ‘SA’ to remind Area A Armed or Area A Stay Armed. This comes instantly. I think the ‘DA’ response that should come as a response to Disarm doesn’t come back since there is no DISARM command, it is simply KEYS XXXX E, than it only sends back ‘OK’ so the component should wait for the next STATUS update.

As summary, when you press Disarm just after a STATUS Update you wait 60 seconds for the next update. If you press it 50 seconds after a STATUS Update then you wait 10 seconds for the update. If you lower that “keep_alive” value to let’s say 15 that means you will wait considerably less for the ‘Pending’ to return to ‘Disarmed’. that will create more traffic but i don’t believe it will create much problems.

Minimum is 15 seconds, i don’t know why i made it that way. Maybe to prevent too much traffic. You can lower it on Line 72 of “init.py”:

vol.Optional(CONF_CROW_KEEPALIVE, default=DEFAULT_KEEPALIVE): vol.All(
             vol.Coerce(int), vol.Range(min=15)
         ),

That’s fantastic. Thanks for the workaround!

So if I understand correctly…

Maybe I can change the code so… (Pseudo code follows as I’m on my phone):

disarm_alarm()
{
   send "KEYS XXXX E"
   sent_disarm_time = (datetime(now))
}

Then change the event code so if it sees a “OK” within maybe one or two seconds of sent_disarm_time it treats it as a disarm OK and sets the state correctly?

In fact, we have to see what is the response of IP Module. In order to see this, you can make a telnet connection to IP Module to port 5900 (when ha crow component is not working, since ip module allows one connection at a time), then enter those commands in order:

STATUS

KEYS XXXX E(To Arm Away)

KEYS XXXX E(To Disarm)

You might need to put a blank key at the end after E on KEYS, if this doesnt give a proper response.
The response of these commands will make it clear if we are on the right path. If we are, maybe we can solve it in only the parse response section of the code and a global boolean variable.

Or forget telnet and try in configuration.yaml:

logger:
  default: warning
  logs:
    custom_components.crowipmodule: debug
    pycrowipmodule: debug

And press arm then disarm as usual and copy log file and send me.

Hi Again,
OK @febalci, I have returned home and am more able to sort out the sensor issue I am having.
Again, my badges, with the PIR sensor status have frozen on ‘ON’ (Running Man), and the status in Dev Tools is also ‘ON’.
I checked in the History tab and it appears to have happened at 1.45am, which I then cross referenced in the logs and nothing is in the logs either side of that time for an hour or so.
Any idea where I go from here?
I am going to have a look in my Ubiquiti web gui next to see if anything strange is there.
This is getting really frustrating to find now.

Cheers
Simon

EDIT: I just noticed that if I trigger the sensors they display closed then open again! So reverse of how they should work??? I just logged into the IP module and changed all my settings to the same as yours apart from the IP address, then restarted the module. The sensors now display correctly in HA.
Does this help to pinpoint anything?

EDIT: I just noticed that if I trigger the sensors they display closed then open again! So reverse of how they should work??? I just logged into the IP module and changed all my settings to the same as yours apart from the IP address, then restarted the module. The sensors now display correctly in HA.
Does this help to pinpoint anything?

I am afraid it will happen again; it is very hard to find the problem. But as i understand, the connection from HA to the IP Module keeps alive but the status is giving reverse results? You can open debug as i mentioned in 2 messages before this; although that will fill up your log file quite a bit (if you are on Raspberry and SD card that will create a problem) until the problem occurs again. But something seems off; since mine and other guys here works without issues (as far as i know). I have like 9 PIRs and 13 magnetic sensors and 2 freewave wireless contacts works without an issue. 3 points are important; Alarm panel, IP module and network connection. Since i assume the alarm panel shows the triggers correctly on its lcd screen, there is nothing wrong with the alarm panel or its configuration. So that leaves us with the IP Module and its network connection. If you have means, please test the network cable in any case. If its OK than the only thing left is the IP Module itself.

If as you said the component connection is working but the messages are reversed; than it is really weird. The component asks every 60 seconds (default) for ‘STATUS’ both for keeping the connection alive and to check if every entity is displayed correctly in HA. Because especially with PIRs you get the Zone Open messages almost always but sometimes you don’t get back the Zone Closed message; that is a bug with the IP Module. In order to correct this i made this STATUS check every 60 seconds. The response messages are indicated in This file. So whether the IP Module misses a Zone Closed message from PIRs, it should have correct it at the STATUS requests.

  1. Does this happen only on PIRs?
  2. Your PIR’s are assigned to the same Zone or different Zones and this problem happens on 1 Zone only or happens on different Zones?