eavanvalkenburg / pysiaalarm

A python package to connect to a SIA DC-09 based alarm system.
MIT License
37 stars 30 forks source link

Jablotron JA100: UDP instead of TCP, some non-standard fields #9

Closed andyboeh closed 3 years ago

andyboeh commented 3 years ago

I would like to use pysiaalarm with a Jablotron JA100+ alarm system. This system only supports UDP and requires a few quirks - the CRC field is encoded in binary instead of ASCII and thus uses only two bytes instead of 4.

Do you have interest in supporting this and how to best implement it?

eavanvalkenburg commented 3 years ago

Never noticed it before, but indeed there should also be support for UDP, I will investigate, but just to manage expectations, I don't think I'll be able to do it very quickly, but I will keep you posted!

andyboeh commented 3 years ago

No worries, I implemented it already in my fork: https://github.com/andyboeh/pysiaalarm It was way easier than expected, thanks to this: https://www.credexalarmsystems.eu/en/blog/install-alarm-info/interfacing-jablotron-100-to-pc-domotica-without-cloud/

Please note that I also head to change parts of the parser because the Jablotron never sends a Code - at least not in my use case: My goal is an integration of the PIR sensors into domoticz even when the system is not armed.

In order not to change too much on the parsing side, I added some fixup code to the UDP server. This "corrects" the binary encoded CRC field. The code is not polished, it's more a PoC and not yet ready for a PR.

eavanvalkenburg commented 3 years ago

Nice! that looks pretty good already, I'm currently doing some work on the parsing of the message, so that might also help for this, I'll add the non-cap a-f in my regex. The only thing is that I now mostly use the asyncio version of this (for instance in Home assistant which is what I use) since the asyncio version is much faster and more stable, so take a look at those as well (in the aio folder), they also extend the base classes and most of the logic should be in those anyway.

In general I would like this package to be fully featured for SIA so that definitely should include UDP support!

andyboeh commented 3 years ago

I'm sorry that I can't be of more help: I switched to a USB-based implementation because it offers bi-directional communication.

For reference, a Domoticz implementation that has only been tested with motion sensors is available here: https://github.com/andyboeh/domoticz-jablotron

eavanvalkenburg commented 3 years ago

Makes sense, it is unfortunate that SIA doesn't support bidirectional things. I'll prob see if I can integrate the UDP version anyway, so thanks for creating that.