majektom / node-red-contrib-satel-integra-integration

Node-red nodes facilitating integration with Satel Integra alarm/home automation system
MIT License
6 stars 4 forks source link

Howto use? #2

Closed IamJanS closed 3 years ago

IamJanS commented 4 years ago

Hi,

I installed your software, I see the decoder and encoder nodes. But how do I get the Integra data in and out? Do you have a example of howto setup connectivity between the ETHM-1 PLUS and the nodes?

Best regards,

Jan

majektom commented 4 years ago

Hi Jan,

The encoder and decoder nodes translates node-red messages to and from protocol frames. You need other nodes to send and receive protocol frames from a device. For example tcp request.

Below is a flow which allows to inject a protocol command and dumps received answer to the debug pane:

[{"id":"e91747fc.6a4e3","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"7ef44a3d.8606b4","type":"tcp request","z":"e91747fc.6a4e3","server":"10.0.0.10","port":"7094","out":"sit","splitc":" ","name":"","x":760,"y":220,"wires":[["2ec26882.a6cf38"]]},{"id":"faa46956.8c552","type":"satel-integra-encoder","z":"e91747fc.6a4e3","name":"Satel Integra encoder","x":520,"y":220,"wires":[["7ef44a3d.8606b4"]]},{"id":"5a5980f8.4ea9b","type":"inject","z":"e91747fc.6a4e3","name":"New data command","topic":"new_data","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":230,"y":160,"wires":[["faa46956.8c552"]]},{"id":"ad9c3a99.ae5de","type":"inject","z":"e91747fc.6a4e3","name":"Outputs state command","topic":"outputs_state","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":220,"y":200,"wires":[["faa46956.8c552"]]},{"id":"cc9a1720.dc37b","type":"inject","z":"e91747fc.6a4e3","name":"Zones tamper command","topic":"zones_tamper","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":210,"y":240,"wires":[["faa46956.8c552"]]},{"id":"69dfd586.289134","type":"inject","z":"e91747fc.6a4e3","name":"Zones violation command","topic":"zones_violation","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":210,"y":280,"wires":[["faa46956.8c552"]]},{"id":"2ec26882.a6cf38","type":"satel-integra-decoder","z":"e91747fc.6a4e3","name":"Satel Integra decoder","x":1000,"y":220,"wires":[["ffd1ed49.42288"]]},{"id":"ffd1ed49.42288","type":"debug","z":"e91747fc.6a4e3","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1190,"y":220,"wires":[]}]

You have to put IP address of your Satel device in server field of the tcp request node. And if you don't use the default port number, you also need to change the port field.

Regards, Tomasz

IamJanS commented 4 years ago

Tomasz,

Thank you very much, works like a charm. I expected the communication with the ETHM-1 PLUS to be encrypted/secured, but it seems to be much more basic....

The link you use in the node documentation, I think it should refer to this document: https://www.satel.pl/en/download/instrukcje/ethm1_op_int_2020-03-05_4f512412.pdf

How do you handle zone violations? Polling must be quite fast to not miss any events from PIRs, what are your thoughts?

I hope you implement more commands :).

Best regards,

Jan

majektom commented 4 years ago

Unfortunately, Satel doesn't provide any option to encrypt the communication. However, as long as you don't expose the communication outside your local network it shouldn't be a big problem.

Yes, you're right. The link is wrong. I have to change it. Thanks.

I think sending new data command every 1 second to check whether any data has changed since the last request should be enough in most cases. And then, when new data answer indicates a change in the data of your interest (for example zones violation in your case), you send request for that data immediately (zones violation command in your case). If you're afraid that you might miss some events, you can of course increase the frequency of sending new data command.

I'm going to add more commands gradually when I see a use case for them. Do you have any particular need?

Regards, Tomasz

kaniagandzowski commented 3 years ago

How use outputs_off?

I find

Outputs on command - msg.topic must be set to outputs_on. Additionally the following properties are mandatory:

msg.prefixAndUserCode - 16 character long string containing (optional) prefix followed by user code. If length of prefix + length of user code is less than 16 characters, remaining characters should be filled with 'f'. E.g. for prefix: "0346" and user code: "7696", the property value should be "03467696ffffffff".
msg.outputs - 128 or 256 elements long boolean array. Index of an element is equal to index of an output. Outputs for which their corresponding array element is set to true, will be turned on. The other outputs will remain unchanged.

But can't use.

majektom commented 3 years ago

Hi @kaniagandzowski ,

Find below an example of flow which allows to inject _outputson and _outputsoff command for output number 16:

[{"id":"842eeaff.859e78","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"e5d19447.8404e","type":"function","z":"842eeaff.859e78","name":"Output 16","func":"msg.outputs = new Array(128).fill(false);\nmsg.outputs[16] = true;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":300,"y":120,"wires":[["83ec950c.4ed2d8"]]},{"id":"83ec950c.4ed2d8","type":"change","z":"842eeaff.859e78","name":"Set user code","rules":[{"t":"set","p":"prefixAndUserCode","pt":"msg","to":"1234ffffffffffff","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":120,"wires":[["9af063cd.875b58"]]},{"id":"bd421aa2.a4a688","type":"inject","z":"842eeaff.859e78","name":"Outputs on","props":[{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"outputs_on","x":140,"y":100,"wires":[["e5d19447.8404e"]]},{"id":"64e3f9c8.64b418","type":"inject","z":"842eeaff.859e78","name":"Outputs off","props":[{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"outputs_off","x":140,"y":140,"wires":[["e5d19447.8404e"]]},{"id":"9af063cd.875b58","type":"satel-integra-encoder","z":"842eeaff.859e78","name":"Satel Integra encoder","x":700,"y":120,"wires":[["c82f1a14.faf6b"]]},{"id":"c82f1a14.faf6b","type":"tcp request","z":"842eeaff.859e78","server":"192.168.1.1","port":"7094","out":"sit","splitc":" ","name":"Connection","x":910,"y":120,"wires":[["bb1f9758.2b2e5"]]},{"id":"bb1f9758.2b2e5","type":"satel-integra-decoder","z":"842eeaff.859e78","name":"Satel Integra decoder","x":1120,"y":120,"wires":[["f9ac0608.d0923"]]},{"id":"f9ac0608.d0923","type":"debug","z":"842eeaff.859e78","name":"Print integra answer","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1120,"y":220,"wires":[]}]

Of course you have to adjust prefixAndUserCode parameter in "Set user code" node and server and port parameters in "Connection" node.

Regards, Tomasz

kaniagandzowski commented 3 years ago

Thanks. Its work now

nufke commented 3 years ago

Unfortunately, Satel doesn't provide any option to encrypt the communication. However, as long as you don't expose the communication outside your local network it shouldn't be a big problem.

It seems the OpenHAB folks got encryption working, see https://github.com/openhab/openhab-addons/tree/main/bundles/org.openhab.binding.satel/src/main/java/org/openhab/binding/satel/internal

majektom commented 3 years ago

Indeed, there is an option to turn on 192-bits AES encryption of the data transmitted in the TCP channel. I couldn't find any official documentation from Satel on how the encryption should be applied. However, it should be possible to reverse engineer it from the OpenHAB project. I will play around with that. Thanks for the hint.

majektom commented 3 years ago

Encryption has been added in version 1.1.0, but there is a bug in this version. The bug has been fixed in version 1.1.1, so that is the version which actually started supporting encrypted channel. The new node "connection" needs to be used in place of the regular TCP request node to benefit from encryption. Anyway, I'm closing the issue as it started going off the original topic.