New Binding for Caddx alarm panels [NX584, NX8e, ...]

Tags: #<Tag:0x00007f6173eacc58> #<Tag:0x00007f6173eacb18> #<Tag:0x00007f6173eac870>

Hi,

i’m developing a binding for the Caddx alarm panel.

Download jar v1.1.0
Source code [caddx branch]

The binding supports discovery, status updates from the panel, sending of commands to the panel and exposes almost all the information/commands from the panel.

The binding is modeled after the dscalarm binding.
If someone wants to give it a try, i will be happy about any info, comment, suggestion.

Edit 01 Dec 2019:
Submitted PR. Updated jar link above to the latest version.

Edit 22 Apr 2020:
Updated jar link above to the latest version.

Edit 13 Jul 2020:
Updated jar link above to the latest version.
Serial ports are not discovered automatically anymore. The bridge has to be manually defined by the user. Readme

Edit 23 Jul 2020:
Updated jar link above to the latest version.
Added thing actions to the binding. Now the panel can be controlled from within rules. Readme

3 Likes

Hi,
thanks a lot for this work.
I have added the jar file to the addons folder and I can see the binding via the paper UI.
But it s not clear to me how to take it from here. There were no things discovered. I tried adding a thing via the Paper UI, but nor by searching, nor by adding manually it was possible. I have the nxgipd repository running successfully, so my usb setup is ok.
Or I can add things and items via config files but then I will need some guidance in which channel(s) are available or what should be the syntax for those.

I have been experimenting with openhab for a few weeks now. I want to move all my automation logic from openremote into openhab. Integration with my caddx alarm is the only barrier left.
So it would be really great if this binding could work. Thanks for your assistance.

On the Inbox in PaperUI, press the Scan button [top right on the screen].

The discovery process enumerates the Serial ports and tries various baudrates to discover the correct one. After this process is finished the discovered bridge should be in the Inbox.

Once you add the bridge, then also all the partitions,zones get discovered.

I have tried as you suggested, but unfortunately, the bridge is not discovered.
I have added the bridge manually from the paper UI. But also that does not result in discovery of any other things.
I installed openhab op a Rpi via the openhabian image about one month ago.
Here is some output from the log:
After adding the jar file:

2019-07-18 22:24:33.982 [WARN ] [shd.server.session.ServerSessionImpl] - exceptionCaught(ServerSessionImpl[openhab@/127.0.0.1:60122])[state=Opened] InterruptedByTimeoutException: null

Not sure whether this warning is really related to the caddx binding, but I suppose so since timing is really close.
While running the scan in the inbox:

2019-07-18 22:32:40.324 [ERROR] [ing.caddx.internal.CaddxCommunicator] - CaddxCommunicator.run() InterruptedException /dev/ttyUSB0
2019-07-18 22:32:46.755 [ERROR] [ing.caddx.internal.CaddxCommunicator] - CaddxCommunicator.run() TimeoutException caught.
2019-07-18 22:32:47.755 [ERROR] [ing.caddx.internal.CaddxCommunicator] - CaddxCommunicator.run() InterruptedException /dev/ttyUSB0
2019-07-18 22:32:54.133 [ERROR] [ing.caddx.internal.CaddxCommunicator] - CaddxCommunicator.run() TimeoutException caught.
2019-07-18 22:32:55.132 [ERROR] [ing.caddx.internal.CaddxCommunicator] - CaddxCommunicator.run() InterruptedException /dev/ttyUSB0
2019-07-18 22:32:58.271 [ERROR] [ing.caddx.internal.CaddxCommunicator] - CaddxCommunicator.run() TimeoutException caught.
2019-07-18 22:32:59.270 [ERROR] [ing.caddx.internal.CaddxCommunicator] - CaddxCommunicator.run() InterruptedException /dev/ttyUSB0
2019-07-18 22:33:06.602 [ERROR] [ing.caddx.internal.CaddxCommunicator] - CaddxCommunicator.run() TimeoutException caught.
2019-07-18 22:33:07.601 [ERROR] [ing.caddx.internal.CaddxCommunicator] - CaddxCommunicator.run() InterruptedException /dev/ttyUSB0

And after manually adding the bridge, it goes to timeout again.

2019-07-18 22:43:57.229 [hingStatusInfoChangedEvent] - 'caddx:bridge:f79ac9b4' changed from UNINITIALIZED to INITIALIZING
==> /var/log/openhab2/openhab.log <==
2019-07-18 22:43:57.268 [INFO ] [.internal.handler.CaddxBridgeHandler] - starting interface at port /dev/ttyUSB0 with baudrate 9600
==> /var/log/openhab2/events.log <==
2019-07-18 22:43:57.271 [hingStatusInfoChangedEvent] - 'caddx:bridge:f79ac9b4' changed from INITIALIZING to OFFLINE
==> /var/log/openhab2/openhab.log <==
2019-07-18 22:44:03.296 [ERROR] [ing.caddx.internal.CaddxCommunicator] - CaddxCommunicator.run() TimeoutException caught.

When I SHH into the Rpi I can read the output from the alarm, so that should not be the problem.

[23:04:51] openhabian@openHABianPi:~$ cat /dev/ttyUSB0

9860000000108599
0860000000400100805199
098600000000400100805199
098600000000400100805199

Have you got any more hints? Options I can try? Thanks for your help!

What is the model of your panel?
I see ASCII data. The binding works with the binary protocol.
Below is a screen dump from the DL900 software of my NX8E config.

The ASCII box is unchecked.

That did the trick indeed. Thanks! Immediately after the setting was changed, the inbox contained some items.
General question: there are many channels available. It’s not clear to me what each of them means (or can do). Is there a way I can figure out? Most of them will create an item type switch by default. Is that on purpose? I just want to be sure to understand and use the full potential here;)
More concrete question; Is there a way to determine if a partition is armed in “away” vs “stay” mode?

For each zone and partition most of the information received from the panel is exposed as channels. For the zones there are zone_type and zone_condition flags for the partitions there are partition_condition flags. All of them create a Switch because they all are just a bit of information On or Off.

You can see all of them in the protocol .pdf. Just google for “nx584 communication protocol”.
Have a look in the .pdf under 04h Zone Status Message and 06h Partition Status Message.

With the version you have there is no way to determine how the partition is armed. As far as i can tell it is only exposed via the 07h Partitions Snapshot Message which is not yet fully handled.

Currently i do not have a stable .jar.
I added support for the retrieval of the panel log messages and the ASCII protocol. (Both features are not yet tested at all)
I will also add the handling of message 07h and release a new .jar after doing some initial tests.

Also some info about the required panel configuration.
You should have at least the following check boxes checked to receive status information:

  • Interface Configuration
  • Zone name request (it is on my TODO list)
  • Zone status request
  • Zone snapshot request
  • Partition status request
  • Partitions snapshot request
  • System status request
  • Log event request.

And the following to send commands to the panel:

  • Primary KP function w/o PIN
  • Secondary KP function
  • Zone bypass toggle

Once i have a new version ready, i will reply here.

Hello,
Do you think the NX-595E would be supported?

I do not own the NX-595E.
From a quick Google search there is a github project which exposes the information via a REST interface. I suppose something could be written to support it.

I was going through the docs. Can you check the value of the “partition_entryguard” channel? This should be the flag that denotes the stay mode. (I’m currently away from home and cannot check)

Idd, that channel indicates whether it’s armed in steady mode.
I would be happy to test your new version. Zone names would be a great feature.
Any plans to make this an “official” binding?

I don’t understand. Is this the channel you were looking for, or not?

Of course.

The following items still need to be finished:

  • Alarm Panel Log handling
  • Documentation
  • Testing

For the panel log handling i don’t know what the binding should expose. I can get from the panel a list with messages but it is not clear to me how a list of strings can be exposed. Maybe for the first version i will add support only for the last message.

Hi @Senna600 you can download the new version of the binding from the following link. Download

Issues:

  • Zone names
    Zone name are retrieved from the panel. Unfortunately the panel only supports English characters. I live in Greece and my keypad supports Greek characters. There is a way to retrieve the zone names directly from the keypad and not through the panel. I don’t know if this affects you. I will look into it next month.

  • Alarm panel log
    For the alarm panel log i decided to retrieve the 10 most recent messages only. If you think it is not enough it is possible to increase it. Just tell me.

  • ASCII communication protocol
    Fully implemented but not tested at all.

Also what configuration do you have on your system?
I have a NX-8E with a NX-1048 keypad and a NX-408 wireless expander.
(@alexxio I also ordered an NX-595E and will have a look into it from next month)

oooOOOOoooo :smiley:
Thank you so much!

The NX-595E has a built in web server to control it directly… I’ve been looking to that Github API project and thanks to it I’ve managed to reproduce some main calls with CURL (also reversing engeneering the javascript of the web page).

Some status calculation are still a little bit “obscure” to me (haven’t got time to dive into it so I just made copy and paste, it uses some array masking) but it works.

When it’s time I can share some code if it can help.

Thank you for your time and effort!

Hi @jossuar. I tried the new jar file. But when added in the addons folder it gives this error in the log;

2019-08-31 23:00:04.474 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/usr/share/openhab2/addons/org.openhab.binding.caddx-2.5.0-SNAPSHOT.jar

org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.caddx [198]

  Unresolved requirement: Import-Package: gnu.io; version="[3.14.0,4.0.0)"

	at org.eclipse.osgi.container.Module.start(Module.java:444) ~[?:?]

	at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383) ~[?:?]

	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [10:org.apache.felix.fileinstall:3.6.4]

	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [10:org.apache.felix.fileinstall:3.6.4]

	at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:520) [10:org.apache.felix.fileinstall:3.6.4]

	at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [10:org.apache.felix.fileinstall:3.6.4]

	at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [10:org.apache.felix.fileinstall:3.6.4]

I had some problems first with uninstalling previous version of the binding and its objects. In the end, I started comepletely over with a fresh install of Openhabian. Only added this jar file, no other binding yet.

Hi Fred, @Senna600

You need to install the serial driver.
To fix this use the following console command:
feature:install openhab-transport-serial

[15:51:37] openhabian@openHABianPi:~$ ssh openhab@localhost -p 8101
Password authentication
Password:

                          __  _____    ____
  ____  ____  ___  ____  / / / /   |  / __ )
 / __ \/ __ \/ _ \/ __ \/ /_/ / /| | / __  |
/ /_/ / /_/ /  __/ / / / __  / ___ |/ /_/ /
\____/ .___/\___/_/ /_/_/ /_/_/  |_/_____/
    /_/                        2.5.0-SNAPSHOT
                               Build #1645

Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown openHAB.

openhab> feature:install openhab-transport-serial

Jep, that was it! After installing and rebooting (not sure whether that was really necesarry but it looks like), discoveries were done. Also zone names were automatically derived (after linking the zone name channel). When would this become an official binding?
Thanks!

@Senna600
To create a Pull Request for the binding, i still need to write some documentation and provide some examples. Also i would like to wait a while to see if there are any problems, like memory consumption etc.

Also can you share your panel configuration, so that i know on which hardware config it runs successfully?

Thanks

Hi Alessio, [@alexxio]

i received the NX-595E and installed it in my system.
I played a little bit around and i have probably messed up something. The website does not work anymore. It gives me 404 errors.

Have you seen something like the below?

Hi!
As a matter of fact it happened too me also one month ago…it happened after a power outage but I don’t know if it’s related because the main alarm board has a backup battery…anyway…

As it was under warranty I called my installer, unfortunately I was not home so I can’t tell you exactly what it did.

For what I could remember he told me he had to completely turn off power to the NX board (and I don’t know if it also try to “reset it” someway).

After it went back online he proceed to change it anyway the next week with a new one because It was not sure if it could happen again and I was under their warranty (very professional from them).

After few days I dig a bit about it with another installer (colleague of the first one) and he told me they have some others with the same problem and the producer suggested to provide additional power supply to the NX board instead of being powered just from the alarm main board.

Does it make sense to you? Does it ring some bell?

If I was too generic I can try to reach out to the installer to ask him some specific tech question.

Let me know.