eavanvalkenburg / sia

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

Feat: Event documentation + default device (entity) name #47

Open shinyone opened 3 years ago

shinyone commented 3 years ago

Thanks for your work on this, fantastic integration!

I have two suggestions for improvement:

1) Documentation for new events - End-user use of events / sensors, some examples 2) Default name for the device.

Is your feature request related to a problem? Please describe. 1) The following link is specific to Ajax system alarms, but its useful to know their interface to SIA. I see that you support different event codes, I don't know how to listen to an event type and what is the payload. 2) Since the Account name is limited to HEX ASCII characters it would be nice to enter a default (optional) name in the integration settings dialog that would be used for the sensor names. (I like to have meaningful names)

Describe the solution you'd like 1) Just an simple example. For example an automation based on a alarm arm/disarm (OP), alarm tamper event (TA), sensor activation (BA), With device and room information (if known) 2) An extra input for human readable name

Describe alternatives you've considered 1) none 2) I could rename them all, but newly added ones after update would be in the current hex format.

shinyone commented 3 years ago

I can see some event information in the debug logs.

TA for tamper alarm (lid open) 2021-05-09 09:38:37 DEBUG (MainThread) [pysiaalarm.base_server] Incoming line: 9A8C0079"*SIA-DCS"0024L0#AAA 2021-05-09 09:38:37 DEBUG (MainThread) [pysiaalarm.event] Content matches: {'account': 'AAA', 'ti': None, 'id': None, 'ri': '2', 'code': 'TA', 'message': '4', 'xdata': None, 'timestamp': '07:37:48,05-09-2021'}

TR for tamper restore (lid close) 2021-05-09 09:38:39 DEBUG (MainThread) [pysiaalarm.base_server] Incoming line: 29F10079"*SIA-DCS"0025L0#AAA 2021-05-09 09:38:39 DEBUG (MainThread) [pysiaalarm.event] Content matches: {'account': 'AAA', 'ti': None, 'id': None, 'ri': '2', 'code': 'TR', 'message': '4', 'xdata': None, 'timestamp': '07:37:49,05-09-2021'}

a) I saw in the options that there was a toggle for "ignore timestamp", I see that my timestamps (alarm vs HA) do not match, is it related to this or something else? (Hour offset by 2) b) What is "ri"? c) "Message" appears to be the device, because I have two devices in one room and different "message" ids, but no matching ids for the room.

eavanvalkenburg commented 3 years ago

Hi, thanks for taking the time here! The way HA now works is that entity named are user configurable so you can change it to something else there and they prefer not to have names in config since it is only a HA thing. The default is just that. Regarding docs, I have the official integration almost in HA, so the docs will be there and then I can spend some more time on that!

shinyone commented 3 years ago

Thanks. I'm currently reading this thread which also has some useful information and similar requests for room event information. I saw your response to this.

eavanvalkenburg commented 3 years ago

a) I saw in the options that there was a toggle for "ignore timestamp", I see that my timestamps (alarm vs HA) do not match, is it related to this or something else? (Hour offset by 2)

Hour offset by 2 is likely just the difference between UTC and your local time, the SIA messages have UTC timestamps and that is what they are checked against, if that was an issue the logs wouldn't look like this, but if your alarm or server is off by a couple of minutes that appears.

b) What is "ri"?

This is what the official spec calls a zone in the message, not sure how they came up with that...

c) "Message" appears to be the device, because I have two devices in one room and different "message" ids, but no matching ids for the room.

Message is a free text field and different alarms put different things in there, so now way for me to know how to handle that, but this is exactly the type of thing you can use the HA events for, with all of the SIA event fields as part of the event_data. If you go to the events tab in the developer tools you can listen for the SIA events, the format is siaevent{port}_{account}

Hope that helps, let me know if you have other questions!