666djb / SIA2MQTT4HA

Galaxy Flex SIA to MQTT server
MIT License
1 stars 0 forks source link

In testing #1

Open 666djb opened 3 years ago

666djb commented 3 years ago

I have this code in testing running as an add-on in Home Assistant on a Raspberry Pi 3. I have a few automations triggered by changes in the set_status.

asneyap commented 2 years ago

Hi,

Thank you so much for sharing your project. I'm struggling to know how to run it inside my Home Assistant. Could you please tell us how to do it exactly, please?

Thanks

666djb commented 2 years ago

I will get a set of instructions published over the next day or two. I've just run through the process on a clean install of Home Assistant to check the instructions all work.

666djb commented 1 year ago

See the attached PDF SIA2MQTT4HA-HowTo.pdf

moqwerty commented 1 year ago

Thanks a lot for this project and the how-to. I configed Home Assistant and the Flex-20, but I get the follow error with autotest. I have updated the Flex-20 firmware from v3.17 to v3.54, but it didn’t help. Do you have any ideas?

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
> sia2mqtt4ha@0.1.22 start
> node ./dist/server.js
Sat Dec 24 2022 13:48:17 GMT+0000 (Coordinated Universal Time) Starting SIA2MQTT4HA
SIA server listening
Sat Dec 24 2022 13:48:17 GMT+0000 (Coordinated Universal Time) Connected to MQTT broker
/server/dist/sia/siaBlock.js:44
            throw "Parity Error";
            ^
Parity Error
(Use `node --trace-uncaught ...` to show where the exception was thrown)
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped
666djb commented 1 year ago

Hi, it looks like you are receiving messages - that is good, but they are not being parsed correctly. Can you check that you have set the format to be SIA and the SIA Level to be 3 in your Flex.

If you use RSS to configure your Flex 20, I could share a screenshot of my settings. Otherwise, let me know and I'll go through the keypad and check my instructions are accurate.

moqwerty commented 1 year ago

Hi, I use the RSS tool for the configuration. I just checked de settings and the format is level 3, port 10002 and the poling port 0. I have tried account number 000000 and 111111. The error is only visible when the autotest is 1 min. When de autotest is 0 minute there is no error but also none other data visible.

If you have a screenshot of the RSS configuration it would be great.

666djb commented 1 year ago

Here's how my Flex 100 is configured in RSS (the entry for Selfmon doesn't change how this project works, you can have multiple ARC receivers):

Flex1 Flex2 Flex3 Flex4

If that doesn't help, then we'll need to do a bit of debugging...

moqwerty commented 1 year ago

it works, the fault was the enabled encryption alarm report 56.3.3.5.1

compunix-be commented 1 year ago

I'm running this in a docker on separate system. My installation has door and pir zones, but also tamper and fire zones. Are tamper and fire zones supported ? If yes, how should these be configured in the options.json ?

666djb commented 1 year ago

I'm running this in a docker on separate system. My installation has door and pir zones, but also tamper and fire zones. Are tamper and fire zones supported ? If yes, how should these be configured in the options.json ?

Hi!

Currently SIA2MQTT4HA is written so that PIR and Contacts can be used in automations (like detecting a person or detecting a door being opened) - these are internally called "Zone Events". These events can happen even when the alarm is not set.

However, my main purpose for SIA2MQTT4HA is to enable automations based on the alarm system being SET (FULL SET, PART SET, UNSET), TRIGGERED (ALARM, FIRE, PANIC, TAMPER) - these are internally called "System Events".

I could add FIRE to the "Zone Events" handler because smoke/fire detectors have zone numbers (like PIRs and Contacts), but not TAMPER.

As TAMPER and FIRE events don't happen frequently, it might be better for you to use the "System Events". In Home Assistant you can use any of these associated Sensors:

image

To see TAMPER and FIRE events specifically, look at the Event sensor:

Capture

The Home Assistant "state" of the Event sensor indicates what "System Event" has been passed by SIA2MQTT4HA. In the above picture the last event (at 16:17) was "RS" which translates to Remote Call Complete (I made a remote programming connection into the panel), the previous event (at 07:45) was "RP" which translates to Automatic Test. For Tamper the state code would be "TA" when tamper is detected and "TR" when the fault is restored, and for Fire it would be "FA" when a fire zone is triggered and "FR" when it is restored to normal.

You can create an automation in Home Assistant to detect (and then do something about) a Tamper using the state of the "sensor.event" entity like this: image

Does that help?

compunix-be commented 1 year ago

thanks for detailed follow-up, sorry about late reply, I was OoO.

Your suggestion for triggers based on events will definitely work for me. I just need to ensure that I've covered all possible status events.

For background information:

I'm only receiving alarms and activation/deactivation of the system, and motion events when the alarm is activated. I don't receive motion events when alarm is deactivated. Question: to receive motion events when deactivated, is this a configuration of the alarm system ? What should I asked to be configured by that 3th party ?

Issue discovered in following scenario: when I partially arm, 'Part Armed' changes to On and 'Set Status' changes to 'Part Set. But when disabling alarm, 'Set Status' goes to unset, but 'Part Armed' remains On. I think I've never recall seeing Part Armed to a different value then On.

My main purpose is also to have automation's based on alarm system status (on/off/partial) and triggers (at least PIR, contacts and fire). The latter so that the sensors and contacts are supplementary/extension to the smoke detectors and motion sensors I have outside the alarm system.

An automation I'm planning is that when alarm system is fully set, and a motion/contact event is generated, that I sound an alarm on sirene linked to HA. That is already covered in current version.

666djb commented 1 year ago

thanks for detailed follow-up, sorry about late reply, I was OoO.

Your suggestion for triggers based on events will definitely work for me. I just need to ensure that I've covered all possible status events.

For background information:

  • my Flex is managed by 3th party, so I don't have access to Flex to make modifs myself
  • from their documentation that I received, I see that TAMPER is also associated to a zone.

I'm only receiving alarms and activation/deactivation of the system, and motion events when the alarm is activated. I don't receive motion events when alarm is deactivated. Question: to receive motion events when deactivated, is this a configuration of the alarm system ? What should I asked to be configured by that 3th party ?

Issue discovered in following scenario: when I partially arm, 'Part Armed' changes to On and 'Set Status' changes to 'Part Set. But when disabling alarm, 'Set Status' goes to unset, but 'Part Armed' remains On. I think I've never recall seeing Part Armed to a different value then On.

My main purpose is also to have automation's based on alarm system status (on/off/partial) and triggers (at least PIR, contacts and fire). The latter so that the sensors and contacts are supplementary/extension to the smoke detectors and motion sensors I have outside the alarm system.

An automation I'm planning is that when alarm system is fully set, and a motion/contact event is generated, that I sound an alarm on sirene linked to HA. That is already covered in current version.

On your question, the answer is a bit complicated as the system needs to be configured to log the triggering of the zones you are interested in whether it is set/unset (activated/deactivated) and still respond when it is set/activated. I don't actually use this functionality myself as I found it cluttered the log up. Anyway, here is how I did it:

Now, when a zone is triggered, a Zone Event should be sent to Home Assistant.

A lot of the above is from memory, I will properly test my assertions when I get a bit of time. A far better way to do this is to implement "SIA Level 4" control and get far richer access to all events - I started to experiment with this but need to find some more information on the protocol to go any further.

On the issue you have discovered, I have found an error in the code that ignored Part Armed being "false", I am testing a very simple fix and will publish a new version over the next day or two.

asneyap commented 1 year ago

Hi there, where could I find information about SIA 4 to explore also on extending this module? Thanks!

666djb commented 1 year ago

Hi there, where could I find information about SIA 4 to explore also on extending this module? Thanks!

I spent many hours looking through the source code from this OpenGalaxy project: https://sourceforge.net/projects/galaxy4linux/files/0.15/

Specifically, I used the protocol and messages for Polling the Zone status.

OpenGalaxy is written to connect to the alarm panel via an RS485 serial connection (i.e. needs wiring into the board itself). I think a lot of the messages are the same when using the SIA4 over TCP/IP connection.

I have some code that I've written to try to test this out and having just had another look, I believe it does something (connects to the panel, polls every few seconds and I get some changes in the output which seem to correspond with PIRs being triggered). I need to find a bit of time to decipher what it is showing me!

If you are really keen, I am happy to share this test code in another repo on here.

asneyap commented 1 year ago

Thank you for the tips! And that code could be a great starting point.

666djb commented 1 year ago

Thank you for the tips! And that code could be a great starting point.

https://github.com/666djb/SIA4hacking

There's a readme file in which I explain what this does so far and how. The code should be simple enough to hack around with.

BriceDet commented 1 month ago

Hi @asneyap @666djb Before to spend many times on my side, could you give a feedback of your "last" status of SIA4 implementation? I've read lots of different projects but never understand if SIA level4 is equivalent on DC-09 or not

Thank you for your news!

666djb commented 1 month ago

Hi @BriceDet It's been a little time since I played with my SIA4 code. But I've just been in and pushed a few changes that I had made - mostly TODO comments, but also a hardcoded example in server.ts that currently runs the getZoneState command (hardcoded to Zone 1021 in sia4stuff.ts). This code works and gets the open/closed state for that zone on my system.

I have previously tested disarming the system (the "doUnset" command) and that works.

What I think I have learnt with SIA4 control of the Honeywell Galaxy control panel is that the following sequence is needed for every command:

This works reliably but it seems a little bit strange to me that you need to connect and login for each and every command rather than being able to keep a TCP session open and issue commands after a single login. Maybe that is just the way SIA4 via TCP/IP works?

So, I know that this code can login, it can get single and multiple zone status, it can disarm the system and I believe it can arm/part arm the system. I'm not sure if much else useful is supported over SIA4.

If I find a bit of time, I might complete the decoding of multiple zones (in response to GetAllZonesOpenState command) and make a menu front end to provide a better demonstrator.

I have NOT built any SIA4 into my SIA2MQTT4HA work.

BriceDet commented 1 month ago

Ho glade to read you with this "very deep details" 👍 Thanks @666djb it's always better to have what you suggest, but "a bit of time" is always complicated to found and for only one guy after a one year sleep repository ? I'll spend "bit of time" during next month to read your code and understand the project. If I have question, I'll open issues

Thanks again for your sharing