eavanvalkenburg / sia

SIA alarm systems integration into Home Assistant
MIT License
48 stars 11 forks source link

Trouble to connect for the first time #19

Closed sr-as2 closed 4 years ago

sr-as2 commented 4 years ago

Hi, i'm using version v.0.3.2 of the integration HA is version 0.112.4

To have more logs i set this options in my configuration.yaml:

logger:
  default: info
  logs:
    custom_components.sia: debug

Entities state:

alarm_control_panel.8124_aaa_1_alarm | unavailable | friendly_name: 8124 - AAA - zone 1 - alarm

sensor.8124_aaa_last_heartbeat | 2020-07-15T10:58:57.401882+00:00 (last HA restart was at 14h28)

Ha logs:

Logger: pysiaalarm.base_sia_server
Source: __main__.py:356
First occurred: 2:28:41 PM (43 occurrences)
Last logged: 2:36:23 PM

CRC mismatch, ignoring message.

And Ajax apps says "Not connected" for the Sia server I don't know what to do... I try with or without encryption...

eavanvalkenburg commented 4 years ago

and what do you have set for the ping interval, and you have dubbelchecked that the exact same settings (account, port, key) are used in both?

sr-as2 commented 4 years ago

1 min for both. Yes, all settings are the same.

image

Screenshot_20200715_144812_com ajaxsystems

in the Heartbeat sensor attribute, i have this:

account: AAA ping_interval: 0:01:00 zone: 0 unit_of_measurement: ISO8601 friendly_name: 8124 - AAA - Last Heartbeat icon: mdi:alarm-light-outline device_class: timestamp

Zone:0 ? Is it normal?

Thanks a lot for your help @eavanvalkenburg !

eavanvalkenburg commented 4 years ago

yeah Zone 0 is correct, the last_heartbeat is unrelated to the number of zones, but is at account level. The thing is that a CRC mismatch means the message that was sent is not the same as the received message, which is strange. Could you add - pysiaalarm: debug to your log and then post some rows from your homeassistant.log (so the full thing not just a screen of the toplevel errors (can be found in your config folder or by clicking Load Full HA log on the log page?

sr-as2 commented 4 years ago

Sure:

2020-07-15 15:03:22 DEBUG (MainThread) [pysiaalarm.aio.sia_client] Starting SIA.
2020-07-15 15:05:04 DEBUG (MainThread) [pysiaalarm.aio.sia_server] Incoming line: 43580023"SIA-DCS"0084L0#AAA[#AAA|Nri1/XC12]
2020-07-15 15:05:04 WARNING (MainThread) [pysiaalarm.base_sia_server] CRC mismatch, ignoring message.

There is about 10 occurence of the same debug message "Incoming line: 43580023"SIA-DCS"0084L0#AAA[#AAA|Nri1/XC12"

eavanvalkenburg commented 4 years ago

I'm not sure why this isn't working but I have been working on updates to the underlying package, could you test that one out? Please change the manifest in your HA (in the custom components folder), to this: ["pysiaalarm==2.0.4b0"], and then reboot it should pull in this version. Let me know how it goes! I'm currently testing it, if it proves good for this and some other people's issues, I will release it later this week.

sr-as2 commented 4 years ago

ok, let's go :-)

2020-07-15 15:30:41 INFO (SyncWorker_36) [homeassistant.util.package] Attempting install of pysiaalarm==2.0.4b0
2020-07-15 15:30:54 INFO (MainThread) [homeassistant.setup] Setting up sia
2020-07-15 15:30:54 DEBUG (MainThread) [pysiaalarm.aio.sia_client] Starting SIA.
2020-07-15 15:31:04 DEBUG (MainThread) [pysiaalarm.aio.sia_server] Incoming line: 43580023"SIA-DCS"0084L0#AAA[#AAA|Nri1/XC12]
2020-07-15 15:31:04 DEBUG (MainThread) [pysiaalarm.base_sia_server] Parsed event: Content: #AAA|Nri1/XC12], Zone: 1, Code: XC, Message: 12, Concerns: None, Type: None, Description: None, Account: AAA, Receiver: None, Prefix: L0, Timestamp: None, Length: 0023, Sequence: 0084, CRC: 4358, Calc CRC: 4358, Message type: None, Encrypted Content: None, Full Message: "SIA-DCS"0084L0#AAA[#AAA|Nri1/XC12]..
2020-07-15 15:31:04 WARNING (MainThread) [pysiaalarm.base_sia_server] Code not found, replying with DUH to account: AAA
...
2020-07-15 15:37:23 DEBUG (MainThread) [pysiaalarm.aio.sia_server] Incoming line: 43580023"SIA-DCS"0084L0#AAA[#AAA|Nri1/XC12]
2020-07-15 15:37:23 DEBUG (MainThread) [pysiaalarm.base_sia_server] Parsed event: Content: #AAA|Nri1/XC12], Zone: 1, Code: XC, Message: 12, Concerns: None, Type: None, Description: None, Account: AAA, Receiver: None, Prefix: L0, Timestamp: None, Length: 0023, Sequence: 0084, CRC: 4358, Calc CRC: 4358, Message type: None, Encrypted Content: None, Full Message: "SIA-DCS"0084L0#AAA[#AAA|Nri1/XC12]..
2020-07-15 15:37:23 WARNING (MainThread) [pysiaalarm.base_sia_server] Code not found, replying with DUH to account: AAA
eavanvalkenburg commented 4 years ago

cool, the XC code is a bit of a strange one, so I think you need to set your alarm to just one IP and port, because that might cause some doubling, and the XC code means either: Malfunction Restore | connection restored, [device] in [room] or Alarm Restore | connection restored, roller shutter [device] in [room]. So not really sure what that means but at least the connection is now established!

sr-as2 commented 4 years ago

Ok i remove the second IP Ajax apps still shows "Not connected" and HA still show "8124 - AAA - zone 1 - alarm" unavailable :(

eavanvalkenburg commented 4 years ago

It is supposed to start sending RP messages, and YG when you change a setting, please add this to REACTIONS in const.py:

    "XC": {"type": "timestamp", "attr": "last_message"},
eavanvalkenburg commented 4 years ago

and a next beta is coming for the package, because it turns out XC is a code that AJAX added that is not in the base SIA protocol!

sr-as2 commented 4 years ago

ok great. Just for information, i'm still having error

2020-07-15 17:36:37 DEBUG (MainThread) [pysiaalarm.aio.sia_server] Incoming line: 43580023"SIA-DCS"0084L0#AAA[#AAA|Nri1/XC12]
2020-07-15 17:36:37 DEBUG (MainThread) [pysiaalarm.base_sia_server] Parsed event: Content: #AAA|Nri1/XC12], Zone: 1, Code: XC, Message: 12, Concerns: None, Type: None, Description: None, Account: AAA, Receiver: None, Prefix: L0, Timestamp: None, Length: 0023, Sequence: 0084, CRC: 4358, Calc CRC: 4358, Message type: None, Encrypted Content: None, Full Message: "SIA-DCS"0084L0#AAA[#AAA|Nri1/XC12]..
2020-07-15 17:36:37 WARNING (MainThread) [pysiaalarm.base_sia_server] Code not found, replying with DUH to account: AAA

i had in the const.py

REACTIONS = {
    "BA": {"type": "alarm", "new_state": "triggered"},
    "BR": {"type": "alarm", "new_state": "previous_state"},
    "CA": {"type": "alarm", "new_state": "armed_away"},
    "CF": {"type": "alarm", "new_state": "armed_custom_bypass"},
    "CG": {"type": "alarm", "new_state": "armed_away"},
    "CL": {"type": "alarm", "new_state": "armed_away"},
    "CP": {"type": "alarm", "new_state": "armed_away"},
    "CQ": {"type": "alarm", "new_state": "armed_away"},
    "GA": {"type": "smoke", "new_state": True},
    "GH": {"type": "smoke", "new_state": False},
    "NL": {"type": "alarm", "new_state": "armed_night"},
    "OA": {"type": "alarm", "new_state": "disarmed"},
    "OG": {"type": "alarm", "new_state": "disarmed"},
    "OP": {"type": "alarm", "new_state": "disarmed"},
    "OQ": {"type": "alarm", "new_state": "disarmed"},
    "OR": {"type": "alarm", "new_state": "disarmed"},
    "RP": {"type": "timestamp", "new_state_eval": "utcnow"},
    "TA": {"type": "alarm", "new_state": "triggered"},
    "WA": {"type": "moisture", "new_state": True},
    "WH": {"type": "moisture", "new_state": False},
    "YG": {"type": "timestamp", "attr": "last_message"},
    "XC": {"type": "timestamp", "attr": "last_message"},
}
eavanvalkenburg commented 4 years ago

Change your manifest.json to this: pysiaalarm==2.0.5b0

sr-as2 commented 4 years ago

Yes ! wouhou it's working! Many thanks @eavanvalkenburg you're the best.

But Sensor alarm seems to stay at "Triggered" even if i am armed or disarmed.

eavanvalkenburg commented 4 years ago

the fact you keep getting the XC code is strange, seems like there is something wrong in your system that doesn't have anything to do with this component, but I can't judge that, I will close this issue.

GerardRibas commented 3 years ago

Sorry to use this thread but I'm having a similar problem after a system restart:

2021-03-25 09:05:09 DEBUG (MainThread) [custom_components.sia.alarm_control_panel] Loading last state: unavailable
2021-03-25 09:05:09 DEBUG (MainThread) [custom_components.sia.alarm_control_panel] Loading last state: unavailable
2021-03-25 09:05:11 DEBUG (MainThread) [pysiaalarm.aio.sia_server] Incoming line: 8BCA00A2"*SIA-DCS"0411L0#42617263656C6F6E[39ECACC2A75FBD98C06C34FEC43618E880C4E42933D99C262713339C9CF7DD19434BD318033E72F7F862026C42785C38EBDF6C5B071D35034A64AB53B1172F1F
2021-03-25 09:05:11 DEBUG (MainThread) [pysiaalarm.base_sia_server] Parsed event: Content: BhyC.+>|#42617263656C6F6E|Nri0/RP0000]_08:05:28,03-25-2021, Zone (ri): 0, Code: RP, Message: 0000, Concerns: Unused, Type: Automatic Test, Description: Automatic communication test report, Account: XXXXX, Receiver: None, Prefix: L0, Timestamp: 2021-03-25 08:05:28, Length: 00A2, Sequence: 0411, CRC: 8BCA, Calc CRC: 8BCA, Message type: Automatic Test, Encrypted Content: 39ECACC2A75FBD98C06C34FEC43618E880C4E42933D99C262713339C9CF7DD19434BD318033E72F7F862026C42785C38EBDF6C5B071D35034A64AB53B1172F1F, Full Message: "*SIA-DCS"0411L0#42617263656C6F6E[39ECACC2A75FBD98C06C34FEC43618E880C4E42933D99C262713339C9CF7DD19434BD318033E72F7F862026C42785C38EBDF6C5B071D35034A64AB53B1172F1F..

Some more messages every interval (1 min):

2021-03-25 09:06:15 DEBUG (MainThread) [pysiaalarm.aio.sia_server] Incoming line: C45000A2"*SIA-DCS"0412L0#42617263656C6F6E[118112028D0877C1880911A47100373B420FE12D5165A0A7310118BB9F963C0F659008AF752BF2FE801DAEAC6ECD20CBD859CB8A6629991546C698A1EB42B168
2021-03-25 09:06:15 DEBUG (MainThread) [pysiaalarm.base_sia_server] Parsed event: Content: m''|#42617263656C6F6E|Nri0/RP0000]_08:06:32,03-25-2021, Zone (ri): 0, Code: RP, Message: 0000, Concerns: Unused, Type: Automatic Test, Description: Automatic communication test report, Account: XXXXX, Receiver: None, Prefix: L0, Timestamp: 2021-03-25 08:06:32, Length: 00A2, Sequence: 0412, CRC: C450, Calc CRC: C450, Message type: Automatic Test, Encrypted Content: 118112028D0877C1880911A47100373B420FE12D5165A0A7310118BB9F963C0F659008AF752BF2FE801DAEAC6ECD20CBD859CB8A6629991546C698A1EB42B168, Full Message: "*SIA-DCS"0412L0#42617263656C6F6E[118112028D0877C1880911A47100373B420FE12D5165A0A7310118BB9F963C0F659008AF752BF2FE801DAEAC6ECD20CBD859CB8A6629991546C698A1EB42B168..
2021-03-25 09:07:20 DEBUG (MainThread) [pysiaalarm.aio.sia_server] Incoming line: 771C00A2"*SIA-DCS"0413L0#42617263656C6F6E[70538A27040D42731090EC5718C816E45D2E7EA1372BD2040BE482100A708831C335176E5B4289A4AF048230228AB8EC6B05F3C1642E689F2F55CBE755338FCA
2021-03-25 09:07:20 DEBUG (MainThread) [pysiaalarm.base_sia_server] Parsed event: Content: ~~\u|#42617263656C6F6E|Nri0/RP0000]_08:07:37,03-25-2021, Zone (ri): 0, Code: RP, Message: 0000, Concerns: Unused, Type: Automatic Test, Description: Automatic communication test report, Account: XXXXX, Receiver: None, Prefix: L0, Timestamp: 2021-03-25 08:07:37, Length: 00A2, Sequence: 0413, CRC: 771C, Calc CRC: 771C, Message type: Automatic Test, Encrypted Content: 70538A27040D42731090EC5718C816E45D2E7EA1372BD2040BE482100A708831C335176E5B4289A4AF048230228AB8EC6B05F3C1642E689F2F55CBE755338FCA, Full Message: "*SIA-DCS"0413L0#42617263656C6F6E[70538A27040D42731090EC5718C816E45D2E7EA1372BD2040BE482100A708831C335176E5B4289A4AF048230228AB8EC6B05F3C1642E689F2F55CBE755338FCA..
2021-03-25 09:08:24 DEBUG (MainThread) [pysiaalarm.aio.sia_server] Incoming line: 88ED00A2"*SIA-DCS"0414L0#42617263656C6F6E[20844C8D4E82B647968B9E2821082E39CFDA879876967029C659EE94634EA7CFDC96FAF84632C0D8C159A61AE5E69FE0A33D31B2C55D9599C53E6F8279675161
2021-03-25 09:08:24 DEBUG (MainThread) [pysiaalarm.base_sia_server] Parsed event: Content: n@46*|#42617263656C6F6E|Nri0/RP0000]_08:08:41,03-25-2021, Zone (ri): 0, Code: RP, Message: 0000, Concerns: Unused, Type: Automatic Test, Description: Automatic communication test report, Account: XXXXX, Receiver: None, Prefix: L0, Timestamp: 2021-03-25 08:08:41, Length: 00A2, Sequence: 0414, CRC: 88ED, Calc CRC: 88ED, Message type: Automatic Test, Encrypted Content: 20844C8D4E82B647968B9E2821082E39CFDA879876967029C659EE94634EA7CFDC96FAF84632C0D8C159A61AE5E69FE0A33D31B2C55D9599C53E6F8279675161, Full Message: "*SIA-DCS"0414L0#42617263656C6F6E[20844C8D4E82B647968B9E2821082E39CFDA879876967029C659EE94634EA7CFDC96FAF84632C0D8C159A61AE5E69FE0A33D31B2C55D9599C53E6F8279675161..

I have two zones, and both are not changing, they remain to Unknown.

If I arm the alarm system and disarmed then the status gets updated.

eavanvalkenburg commented 3 years ago

yeah, that is the expected behaviour, since SIA doesn't send anything unless something changes, so the alarm, moisture and smoke sensors do not update unless something changes with them, for the moisture and smoke I can change the default to Off since those are harder to just turn on and off! The unavailable state can be because of a mistiming between the last RP message and the expected interval from your setup (if you have it set to 1 min in HA, it will wait for 1 min 30 sec to set the sensors (alarm, moisture and smoke) to unavailable), off course if you're alarm waits 10 minutes between RP messages that causes issues, but that doesn't seem to be the problem.