eavanvalkenburg / pysiaalarm

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

Integration with ELDES alarm systems #17

Open mach0gr opened 3 years ago

mach0gr commented 3 years ago

Hi ! I'm trying to integrate with an alarm system by ELDES. I have the same issue with the thread here https://github.com/Cheaterdev/sia-ha/issues/3

My options on Alarm system side are like this image

image with the following being the messages being transmitted, sorry long image

image

On HA side these are some logs that keep on comming. 2021-08-12 19:11:31 WARNING (MainThread) [pysiaalarm.base_server] CRC mismatch, ignoring message. Sent CRC: AA1A, Calculated CRC: 1B95. Line was "ADM-CID"0227R4F39L4F39#4F39[#4F39|3401 01 057] 2021-08-12 19:11:43 WARNING (MainThread) [pysiaalarm.base_server] CRC mismatch, ignoring message. Sent CRC: 155A, Calculated CRC: 1A3E. Line was "ADM-CID"0228R4F39L4F39#4F39[#4F39|3401 01 057] 2021-08-12 19:11:54 WARNING (MainThread) [pysiaalarm.base_server] CRC mismatch, ignoring message. Sent CRC: C89B, Calculated CRC: DA12. Line was "ADM-CID"0229R4F39L4F39#4F39[#4F39|3401 01 057] 2021-08-12 19:12:58 WARNING (MainThread) [pysiaalarm.base_server] CRC mismatch, ignoring message. Sent CRC: 8D07, Calculated CRC: 06E1. Line was "ADM-CID"0233R4F39L4F39#4F39[#4F39|3401 01 057] 2021-08-12 19:13:10 WARNING (MainThread) [pysiaalarm.base_server] CRC mismatch, ignoring message. Sent CRC: 1C46, Calculated CRC: C623. Line was "ADM-CID"0234R4F39L4F39#4F39[#4F39|3401 01 057] 2021-08-12 19:13:21 WARNING (MainThread) [pysiaalarm.base_server] CRC mismatch, ignoring message. Sent CRC: C187, Calculated CRC: 060F. Line was "ADM-CID"0235R4F39L4F39#4F39[#4F39|3401 01 057] 2021-08-12 19:13:44 WARNING (MainThread) [pysiaalarm.base_server] CRC mismatch, ignoring message. Sent CRC: E7C7, Calculated CRC: 0678. Line was "ADM-CID"0236R4F39L4F39#4F39[#4F39|3401 01 057] 2021-08-12 19:13:56 WARNING (MainThread) [pysiaalarm.base_server] CRC mismatch, ignoring message. Sent CRC: 3A06, Calculated CRC: C654. Line was "ADM-CID"0237R4F39L4F39#4F39[#4F39|3401 01 057] 2021-08-12 19:14:07 WARNING (MainThread) [pysiaalarm.base_server] CRC mismatch, ignoring message. Sent CRC: 8546, Calculated CRC: C7FF. Line was "ADM-CID"0238R4F39L4F39#4F39[#4F39|3401 01 057] 2021-08-12 19:14:26 WARNING (MainThread) [pysiaalarm.base_server] CRC mismatch, ignoring message. Sent CRC: 5887, Calculated CRC: 07D3. Line was "ADM-CID"0239R4F39L4F39#4F39[#4F39|3401 01 057] 2021-08-12 19:14:38 WARNING (MainThread) [pysiaalarm.base_server] CRC mismatch, ignoring message. Sent CRC: 9B16, Calculated CRC: 97D7. Line was "ADM-CID"0240R4F39L4F39#4F39[#4F39|3401 01 057] 2021-08-12 19:14:50 WARNING (MainThread) [pysiaalarm.base_server] CRC mismatch, ignoring message. Sent CRC: 46D7, Calculated CRC: 57FB. Line was "ADM-CID"0241R4F39L4F39#4F39[#4F39|3401 01 057] 2021-08-12 19:15:08 WARNING (MainThread) [pysiaalarm.base_server] CRC mismatch, ignoring message. Sent CRC: 6097, Calculated CRC: 578C. Line was "ADM-CID"0242R4F39L4F39#4F39[#4F39|3401 01 057] 2021-08-12 19:15:20 WARNING (MainThread) [pysiaalarm.base_server] CRC mismatch, ignoring message. Sent CRC: BD56, Calculated CRC: 97A0. Line was "ADM-CID"0243R4F39L4F39#4F39[#4F39|3401 01 057] 2021-08-12 19:15:31 WARNING (MainThread) [pysiaalarm.base_server] CRC mismatch, ignoring message. Sent CRC: 2C17, Calculated CRC: 5762. Line was "ADM-CID"0244R4F39L4F39#4F39[#4F39|3401 01 057] 2021-08-12 19:15:50 WARNING (MainThread) [pysiaalarm.base_server] CRC mismatch, ignoring message. Sent CRC: F1D6, Calculated CRC: 974E. Line was "ADM-CID"0245R4F39L4F39#4F39[#4F39|3401 01 057] 2021-08-12 19:16:01 WARNING (MainThread) [pysiaalarm.base_server] CRC mismatch, ignoring message. Sent CRC: D796, Calculated CRC: 9739. Line was "ADM-CID"0246R4F39L4F39#4F39[#4F39|3401 01 057] 2021-08-12 19:16:13 WARNING (MainThread) [pysiaalarm.base_server] CRC mismatch, ignoring message. Sent CRC: 0A57, Calculated CRC: 5715. Line was "ADM-CID"0247R4F39L4F39#4F39[#4F39|3401 01 057]

I'd love to get this done somehow

eavanvalkenburg commented 3 years ago

Great to see this, I have implemented ADM-CID in my package, but I wasn't able to fully test it and apparently it uses a slightly different CRC calc, so let me have a look! another question, are you using the official integration or the HACS one?

eavanvalkenburg commented 3 years ago

So I've been looking at this, and it is really strange, according to the SIA spec, the CRC calc is done on everything starting with (and including) the quotes before the type (type in this case is ADM-CID), so for some reason there is a difference in my CRC calculation and the one used in your system, I haven't seen this before so I'm reasonably sure that the calculation in the package is correct otherwise my own and other's alarms would also not work, could you maybe try to turn on "set timestamp"? and what other SIA IP standards are there to choose from?

mach0gr commented 3 years ago

Hey there @eavanvalkenburg sorry for not responding sooner, you got me on my vacations break where all digital life is switched off :D I use the official integration, have not installed or played with the HACS one. Using timestamp checkbox I receive different log messages. Let me configure it back to using timestamp and I will come back with the logs. Appreciate your looking into this !

Petros

mach0gr commented 3 years ago

Ok, this is the log when the "Use Time Stamp" is checked in the Configuration of the alarm SIA IP settings.

2021-08-29 13:20:19 WARNING (MainThread) [pysiaalarm.base_server] Code not found, replying with DUH to account: 4F39 2021-08-29 13:20:31 WARNING (MainThread) [pysiaalarm.base_server] Code not found, replying with DUH to account: 4F39 2021-08-29 13:20:42 WARNING (MainThread) [pysiaalarm.base_server] Code not found, replying with DUH to account: 4F39 2021-08-29 13:21:03 WARNING (MainThread) [pysiaalarm.base_server] Code not found, replying with DUH to account: 4F39 2021-08-29 13:21:15 WARNING (MainThread) [pysiaalarm.base_server] Code not found, replying with DUH to account: 4F39 2021-08-29 13:21:26 WARNING (MainThread) [pysiaalarm.base_server] Code not found, replying with DUH to account: 4F39

Any ideas ? How can we dig deeper ?

Petros

norcis commented 3 years ago

Any success with Eldes? I also have it and it's pity they do not provide any public API for integrations.

eavanvalkenburg commented 3 years ago

@norcis and @mach0gr I will need some more logs to figure out what's happening, I know that I do not yet have full coverage for all ADM-CID codes into SIA codes, that is done in this file: https://github.com/eavanvalkenburg/pysiaalarm/blob/master/src/pysiaalarm/data/adm_mapping.json so if you feel comfortable extending that list please go ahead through a pull request! The format is always 4 numbers in ADM-CID, I think the first is either 1 or 3 and means on or off, followed by the code which is three numbers, so that is also the way to read that mapping file.

mach0gr commented 3 years ago

Hi @eavanvalkenburg, I think I got this now. I managed to find the official contact codes (SIA and ADM-CID) and will try match them to extend your json mapping file. You are correct to say that the event format is 4 digit in ADM-CID starting with 1xxx for Opening(alarm) and 3xxx for closing(restore). Will come back...

eavanvalkenburg commented 3 years ago

Thanks @mach0gr !

mach0gr commented 3 years ago

Hi @eavanvalkenburg I created a pull request for that mapping file. For starters I have mapped as much codes as I could match between ADM and SIA or a least the ones that made sense to include. While checking the list of codes supported by my Eldes alarm I can still see a quite a few that haven't been mapped yet. I'm eager to test again when you build a version and check the logs. In the meantime I will try to find relative codes to align the rest.

mach0gr commented 3 years ago

Hi @eavanvalkenburg it was easier than I thought. So I ended up sending you a second pull request with the mapping file now including all codes used by ELDES alarm as seen on the images I sent above in the thread. Most cases should be covered by now.

mach0gr commented 2 years ago

Hi @eavanvalkenburg, Today I installed Homeassistant 2021.10.2 stable and tried the SIA integration but I get the same responses 2021-10-10 09:22:28 WARNING (MainThread) [pysiaalarm.base_server] Code not found, replying with DUH to account: 4F39 2021-10-10 09:22:39 WARNING (MainThread) [pysiaalarm.base_server] Code not found, replying with DUH to account: 4F39 2021-10-10 09:22:51 WARNING (MainThread) [pysiaalarm.base_server] Code not found, replying with DUH to account: 4F39 2021-10-10 09:23:13 WARNING (MainThread) [pysiaalarm.base_server] Code not found, replying with DUH to account: 4F39 2021-10-10 09:23:25 WARNING (MainThread) [pysiaalarm.base_server] Code not found, replying with DUH to account: 4F39 2021-10-10 09:23:37 WARNING (MainThread) [pysiaalarm.base_server] Code not found, replying with DUH to account: 4F39 2021-10-10 09:23:56 WARNING (MainThread) [pysiaalarm.base_server] Code not found, replying with DUH to account: 4F39 2021-10-10 09:24:07 WARNING (MainThread) [pysiaalarm.base_server] Code not found, replying with DUH to account: 4F39 2021-10-10 09:24:19 WARNING (MainThread) [pysiaalarm.base_server] Code not found, replying with DUH to account: 4F39 2021-10-10 09:24:37 WARNING (MainThread) [pysiaalarm.base_server] Code not found, replying with DUH to account: 4F39 2021-10-10 09:24:49 WARNING (MainThread) [pysiaalarm.base_server] Code not found, replying with DUH to account: 4F39 2021-10-10 09:25:01 WARNING (MainThread) [pysiaalarm.base_server] Code not found, replying with DUH to account: 4F39 2021-10-10 09:25:19 WARNING (MainThread) [pysiaalarm.base_server] Code not found, replying with DUH to account: 4F39

I'm using the docker version of Home assistant, not sure if your changes made it to the latest October home assistant release version ?

How can help you with debugging ? maybe I can install the pysiaalarm as standalone somewhere individually and try it there .. I don't know where to start. I'd like to help fix this integration with my Eldes alarm and subsequently other ademco style ones.

Thanks Petros

mach0gr commented 2 years ago

I came up with something that maybe some insight for you. I run a nc -l 2000 locally on my PC and grabbed some of the signals that are being sent. Maybe you can check for spelling or any other character that may be not conforming ?

`nc -l 2000

865E003B"ADM-CID"0418L0#4F39[#4F39|1900 00 000]_18:30:26,08-12-2021 2A33003B"ADM-CID"0419L0#4F39[#4F39|1900 00 000]_18:30:26,08-12-2021 928E003B"ADM-CID"0420L0#4F39[#4F39|1900 00 000]_18:30:26,08-12-2021 3EE3003B"ADM-CID"0421L0#4F39[#4F39|1900 00 000]_18:30:26,08-12-2021 8A57003B"ADM-CID"0422L0#4F39[#4F39|1900 00 000]_18:30:26,08-12-2021`

eavanvalkenburg commented 2 years ago

This is just that the 1900 code does not have a translation to SIA code yet, there is a new version of the package merged with HA, but not yet released! hopefully I can push that in the next update.

mach0gr commented 2 years ago

I remember mapping the 900 ADM-CID code in the mapping file I sent you. However I don't know if you made a build that made it to the HA October 2021 release.
If there is another way I can test, I would be delighted to help. Since this is a test alarm system I have, if you like I could even set an IP of yours for reception so you could troubleshoot faster. Let me know

eavanvalkenburg commented 2 years ago

It's not in ha yet unfortunately. You might be able to just put the latest version in the custom component but I haven't tested that yet so tread carefully!

nobless commented 2 years ago

any update here ?

eavanvalkenburg commented 2 years ago

not in yet, should be in 2021.11.0

eavanvalkenburg commented 2 years ago

and that should come out today!

nobless commented 2 years ago

tested with Official integration from HA, and later installed beta on top, errors that comes to event log:

2021-11-14 00:49:22 WARNING (MainThread) [pysiaalarm.base_server] Last line could not be parsed succesfully. Error message: Parse content: no matches found in %s, using matcher: %s. Line: ACCA005B"*NULL"0000R4F39L4F39#4F39[1445B13777F941EB7FEDF2BF3F58ED4D4A2C5EE37FB0B5EB65452BF3FD5CED27
2021-11-14 00:49:23 WARNING (MainThread) [pysiaalarm.base_server] Last line could not be parsed succesfully. Error message: Parse content: no matches found in %s, using matcher: %s. Line: DF61005B"*NULL"0000R4F39L4F39#4F39[006BA4E061002747F54D7C8BB8477B22AC4049935CC65286DB4E5FC391CFF8DC
2021-11-14 00:49:32 WARNING (MainThread) [pysiaalarm.base_server] Last line could not be parsed succesfully. Error message: Parse content: no matches found in %s, using matcher: %s. Line: 8747005B"*NULL"0000R4F39L4F39#4F39[E288910354700880A3DDF372C9BBF608D891EB982C4C006D267E213CFB3D7EC9
2021-11-14 00:50:23 WARNING (MainThread) [pysiaalarm.base_server] Last line could not be parsed succesfully. Error message: Parse content: no matches found in %s, using matcher: %s. Line: 8FD9005B"*NULL"0000R4F39L4F39#4F39[0B6C09711F293012ABE1B8F95533951EBD17DD181563DB09FE5E623D6D68D3C0
2021-11-14 00:50:24 WARNING (MainThread) [pysiaalarm.base_server] Last line could not be parsed succesfully. Error message: Parse content: no matches found in %s, using matcher: %s. Line: 843B005B"*NULL"0000R4F39L4F39#4F39[20007BF7267BDFBD3111FFDA04ABE950AAF4B819683A7FBEF7EB0E3C13C173F6
2021-11-14 00:50:39 WARNING (MainThread) [pysiaalarm.base_server] Last line could not be parsed succesfully. Error message: Parse content: no matches found in %s, using matcher: %s. Line: 0E9A005B"*NULL"0000R4F39L4F39#4F39[B6C8BF4C8CB95CDDCB6F9DFB6BC1A02955C71FA96E2A8335A9B6D584212AA746
straga commented 2 years ago

Hi @mach0gr. I have questions. Now Eldes works. And Eldes send always message over SIA IP. Is the system not armed?

Brunelma commented 2 years ago

Hi, sorry I am a newbie with HA... Did you found a way to successfully integrate Eldes Alarm into Home Assistant? Could you please explain me how to do so? Thank you.

mach0gr commented 2 years ago

sorry, never managed to get it working, I quit trying.

eavanvalkenburg commented 2 years ago

Hi all, haven't had a lot of time to spend on this the last could of months, but please add any logging your have here as that allows me to fix things!