Hi all.
I have been working these days on a python library that communicates with a souliss gateway, get typical updates and send functional codes. It's not finished yet (not all the typicals are implemented), but I would like to share with you and get some feedback about the path it should be going to. We had been testing it in the spanish forum (Juan Pinto one of them, of course, thank you again ;) and I thing it should work on a normal network.
My final purpose is to integrate Souliss with HomeAssistant (kind of OpenHab written in python), but not with a "closed binding". Instead, I would like to code a simple python program that publish node changes (through MQTT), and listen to MQTT messages to send commands to the gateway. There will be no need to change arduino/esp code in the nodes (keeping Souliss outside MQTT handling). So, any MQTT compatible automation system (including HomeAssistant) would work out of the box.
If you are interested, the library is in
https://github.com/maoterodapena/pysouliss . It works with python 3.6.2. Just clone the repository and :
python main.py -g <ip souliss gateway> -v
It will request the database to the gateway and gather information about all the nodes. The last -v is for verbose, just for troubleshotting. You will see every change on the souliss network. Something like this:
$ python main.py -g 192.168.2.80INFO: Trying to connect to gateway
INFO: 3 nodes found
INFO: Node 0. Added typical 0x11: T11: ON/OFF Digital Output with Timer Option
INFO: Node 0: Typical 0 - T11: ON/OFF Digital Output with Timer Option updated to off
INFO: Node 1. Added typical 0x11: T11: ON/OFF Digital Output with Timer Option
INFO: Node 1. Added typical 0x12: T12: ON/OFF Digital Output with AUTO mode
INFO: Node 1. Added typical 0x13: T13: Digital Input Value
INFO: Node 1. Added typical 0x15: T15: RGB Light
INFO: Node 1. Added typical 0x16: T16: RGB LED Strip
INFO: Node 1. Added typical 0x58: T58: Pressure measure (0, 1500) hPa
INFO: Node 1. Added typical 0x53: T53: Humidity measure (0, 100)
INFO: Node 1. Added typical 0x52: T52: Temperature measure (-20, +50) C
INFO: Node 1: Typical 0 - T11: ON/OFF Digital Output with Timer Option updated to on
INFO: Node 1: Typical 1 - T12: ON/OFF Digital Output with AUTO mode updated to off
INFO: Node 1: Typical 2 - T13: Digital Input Value updated to off
INFO: Node 1: Typical 3 - T15: RGB Light updated to 00:00
INFO: Node 1: Typical 4 - T16: RGB LED Strip updated to 00:00:00:00
INFO: Node 1: Typical 5 - T58: Pressure measure (0, 1500) hPa updated to 66.0 hPa
INFO: Node 1: Typical 6 - T53: Humidity measure (0, 100) updated to 41.0 %
INFO: Node 1: Typical 7 - T52: Temperature measure (-20, +50) C updated to 16.0 C
INFO: Node 1: Typical 7 - T52: Temperature measure (-20, +50) C updated to 17.0 C
INFO: Node 2. Added typical 0x11: T11: ON/OFF Digital Output with Timer Option
INFO: Node 2. Added typical 0x12: T12: ON/OFF Digital Output with AUTO mode
INFO: Node 2. Added typical 0x13: T13: Digital Input Value
INFO: Node 2. Added typical 0x15: T15: RGB Light
INFO: Node 2. Added typical 0x16: T16: RGB LED Strip
INFO: Node 2. Added typical 0x58: T58: Pressure measure (0, 1500) hPa
INFO: Node 2. Added typical 0x53: T53: Humidity measure (0, 100)
INFO: Node 2. Added typical 0x52: T52: Temperature measure (-20, +50) C
INFO: Node 2: Typical 0 - T11: ON/OFF Digital Output with Timer Option updated to on
INFO: Node 2: Typical 1 - T12: ON/OFF Digital Output with AUTO mode updated to off
INFO: Node 2: Typical 2 - T13: Digital Input Value updated to off
INFO: Node 2: Typical 3 - T15: RGB Light updated to 00:00
INFO: Node 2: Typical 4 - T16: RGB LED Strip updated to 00:00:00:00
INFO: Node 2: Typical 5 - T58: Pressure measure (0, 1500) hPa updated to 66.0 hPa
INFO: Node 2: Typical 6 - T53: Humidity measure (0, 100) updated to 41.0 %
INFO: Node 2: Typical 7 - T52: Temperature measure (-20, +50) C updated to 17.0 C
INFO: Node 1: Typical 5 - T58: Pressure measure (0, 1500) hPa updated to 67.0 hPa
INFO: Node 1: Typical 6 - T53: Humidity measure (0, 100) updated to 42.0 %
INFO: Node 2: Typical 5 - T58: Pressure measure (0, 1500) hPa updated to 67.0 hPa
INFO: Node 2: Typical 6 - T53: Humidity measure (0, 100) updated to 42.0 %
There are also a few examples. To run these examples, you will need to install the library with
pip install -e /path/to/the/repository
$ python examples/autogen_openhab_items.py -g 192.168.2.80 -o /etc/openhab/items/souliss.items
This will generate an "openhab compatible" items file after exploring all nodes in the network, something like this:
Group gSouliss "Souliss" <sun>
Group Node_0 "Node 0" <sun> (gSouliss)
Switch switch_T11_0_0 "switch_T11_0_0" <switch> (Switches, Node_0) {souliss="T11:0:0"}
Group Node_1 "Node 1" <sun> (gSouliss)
Switch switch_T11_1_0 "switch_T11_1_0" <switch> (Switches, Node_1) {souliss="T11:1:0"}
Switch switch_T12_1_1 "switch_T12_1_1" <switch> (Switches, Node_1) {souliss="T12:1:1"}
Switch switch_T13_1_2 "switch_T13_1_2" <switch> (Switches, Node_1) {souliss="T13:1:2"}
Number pressure_1_5 "Pressure [%.1f] W_1_5" <pressure> (Measures, Node_1) {souliss="T58:1:9"}
Number humidity_1_6 "Humidity [%.1f]_1_6" <humidity> (Temperature, Measures, Node_1) {souliss="T53:1:11"}
Number temperature_1_7 "Temperature [%.1f °C]_1_7" <temperature> (Temperature, Measures, Node_1) {souliss="T52:1:13"}
Group Node_2 "Node 2" <sun> (gSouliss)
Switch switch_T11_2_0 "switch_T11_2_0" <switch> (Switches, Node_2) {souliss="T11:2:0"}
Switch switch_T12_2_1 "switch_T12_2_1" <switch> (Switches, Node_2) {souliss="T12:2:1"}
Switch switch_T13_2_2 "switch_T13_2_2" <switch> (Switches, Node_2) {souliss="T13:2:2"}
Number pressure_2_5 "Pressure [%.1f] W_2_5" <pressure> (Measures, Node_2) {souliss="T58:2:9"}
Number humidity_2_6 "Humidity [%.1f]_2_6" <humidity> (Temperature, Measures, Node_2) {souliss="T53:2:11"}
Number temperature_2_7 "Temperature [%.1f °C]_2_7" <temperature> (Temperature, Measures, Node_2) {souliss="T52:2:13"}
You will need to add a line on sitemap,
Group item=gSouliss label="Souliss" icon="firstfloor"
Note that not all Typicals are implemented. It's just an example, but, of course, I'm open to suggestions if you find it useful.
$ python examples/example_mqtt.py -g <ip_souliss_gateway> -m <mqtt_broker> -vThis is a "proof of concept". The script explore all nodes and publish all topics as 'pysouliss/<node>/<typical>. You can see the MQTT messages when a switch or sensor is updated (so you can subscribe any other application to show states). And you can send commands with the topic 'pysouliss/<node>/<typical>/cmd with the souliss command on the mqtt payload (only works with simple switches now :(
For instance, to toggle the T11 switch on node 0, typical 0, if you are using mosquitto:
$ mosquitto_pub -t 'pysouliss/0/0/cmd' -m $'\x01'And that is all for now. Please, feel free to give opinions, advices...
Thanks in advance.