![]() |
|
Comfort to MQTT - Printable Version +- Comfort Automation/ Security System Forums (https://www.comfortforums.com) +-- Forum: Software Applications (https://www.comfortforums.com/forum-4.html) +--- Forum: Comfort with Home Assistant (https://www.comfortforums.com/forum-143.html) +--- Thread: Comfort to MQTT (/thread-4407.html) Pages:
1
2
|
- cab123 - 02-08-2016 Hi, i would like to share with the community my simple driver implementation of comfort to MQTT. I have this running for a couple of months and never registered any failure with the communication. MQTT is amazingly light and mature. And my driver seems to be stable enough for the job, had some issues with strange USB resets, but now it gracefully handles every USB quirks i found, including reconnecting the UCM. This approach provides a simple and flexible way to interact with comfort from/to multiple sources. Personally i have comfort ULTRA, individual power monitoring, solar inverter statistics all feeding data to a MQTT broker. Then I process some of that data in NodeRED and present/control everything in OpenHAB. It works really well. I do not use the alarm section of comfort, only home automation with push buttons, relays, infrared and some KNX stuff. Used hardware: - UCM USB - A x86 server with Debian Jessie installed (could be a raspberry Pi) (1) Connect the UCM/USB to the server and make the USB connection deterministic: (1.1) Find the Device / ID / Serial Number of the device: Code: root@debian:/# lsusb(1.2) From the output above we get: - idVendor: 0403 - idProduct: 6001 - Serial Number: A7007iyv Your data will probabily be the same, except for the unique serial number of your UCM. Next create a file like the one below and add the right info: Code: nano /etc/udev/rules.d/99-usb-serial.rulesCode: SUBSYSTEM==\"tty\", ATTRS{idVendor}==\"0403\", ATTRS{idProduct}==\"6001\", ATTRS{serial}==\"A7007iyv\", SYMLINK+=\"comfort\"Now everytime the USB UCM is connected th the server it will be uniquely available at /dev/comfort, regardless of other USB peripherals in the system. (2) Install MQTT broker and clients http://mosquitto.org/2013/01/mosquitto-debian-repository/ for the clients: sudo apt-get install mosquitto-clients anoher good reference with some testing: https://pallavichaurasia94.wordpress.com/2014/10/14/mosquitto-in-debian/ (3) the script to establish a bridge between Comfort and MQTT: (3.1) First install the folloing perl modules: Code: cpan Net::MQTT::Simple(3.2) Find a appropriate directory, for example /opt and copy the contents of the script to a new file, for example: Code: nano simple_mqtt_serial_select.plCode: #!/usr/bin/perlTo test: WINDOW_1: run the script Code: root@debian:/# perl simple_mqtt_serial_select.plWINDOW_2: listen for MQTT events Code: root@debian:/# mosquitto_sub -v -t comfort/#WINDOW_3: post something to comfort topic MQTT Code: root@debian:/# mosquitto_pub -t comfort/to -m \'LI1234\'On the WINDOW_2 you should see something like: Code: comfort/to LI1234Thatôs it! Now you can subscribe (listen) or post commands to the MQTT broker and interact with comfort. Make the script boot at startup by editing the file just before \"exit 0\" Code: root@debian:/# nano /etc/rc.localCode: /usr/bin/perl /opt/simple_mqtt_serial_select.pl &And now comfort can easily be integrated with other bits of amazing software, like openHAB, NodeRED, etc. If there is any interest in this i can share some of my NodeRED and OpenHAB integration configuration. Have fun! - tech07 - 02-10-2016 yes pleasecan this work with UCM/ETh03? How can this allow working with openhab etc - cab123 - 02-10-2016 Hi, i\'m not sure how the UCM/ETH03 works, since i don\'t have one, but i suppose everything is possible .I\'ll gather some info and post here later a working example of OpenHAB controlling comfort. - cab123 - 02-13-2016 So the next step after having a MQTT broker interacting with comfort is to install NodeRED http://nodered.org/ It is really easy to set up stuff in logical blocks, however some javascript is needed for the functions. This is my processing of comfort stuff: The first \"flow\" updates comfort\'s time periodically. Every 10 minutes a timestamp is generated, passed through the \"Build Date Command\" and sent to the MQTT topic comfort is listening to. The function is something like this: At the bottom of the first image, every group of received messages from Comfort are handled. For instance, i have temperature sensors, one KNX and another from a SCS that are transformed to MQTT also and sent to the broker. This way i can later read the sensors and display them on openHab. The \"split function is configured as shown: and the Sensor function decodes comfort sensor messages like this: Code: var string = msg.payload;All processing can be done here. Imagination is the limit, everything can be done with small bits of code and simple \"flows\". Later i will try to show some of my OpenHab setup that takes advantage of all this data. Fell free to ask any questions. - cab123 - 08-10-2016 Hi guys sorry for the late update, i didn\'t want to show the openhab examples in portuguese so i kept delaying a update. Now i have changed my dashboards to show you what is the final result. for setting up openhab to control comfort you just need to interact with the mqtt broker, still it is a bit slow learning curve but it is totally worth it! and for example inside the TV control you can find the actual control: The buttons listen for updates, so if i turn off my living room TV locally, i am actually pressing a KNX button that sends a telegram to the BUS that is captured by the UCM and passed on to comfort that updates a counter that is sent though serial connection that is captured by the perl driver and sent to MQTT, that broadcasts it to any listening device, where openhab is waiting, and then applies some rules to update the button status that is binded to the TV, so next time i toggle the TV i will perform the right action! Easy! ![]() - slychiu - 08-12-2016 Thats nice. Its good to see Comfort with Openhab. We will try to test it - slychiu - 08-13-2016 How does the Comfort program go into this setup? - cab123 - 09-09-2016 Hi not sure i understand your question. The comfort software requires direct and exclusive access to the UCM, so they cannot exist in a system at the same time. In order to use comfort apps or to upload new configuration, i normally shutdown this \"driver\" and use the socat approach described here: http://www.comfortforums.com/view_topic.php?id=3249&forum_id=83&jump_to=13896#p13896 - meep - 10-06-2016 Hi Is there any chance you could post more of your Node-Red javascript? I need to do exactly this as I want to start using my old comfort as essentially an i/o block for openHab. The more reference code I can find the better. As an aside - any thoughts on how one could go about accessing Comfort voicemail recordings from openHab? Many thanks Peter - idheath - 10-09-2016 I\'m so pleased that I\'ve seen this thread :-) I have just started with openHAB and am just about to have a play with MQTT (for other reasons). I\'ve been wondering for ages how I could connect Comfort to openHAB and wondered myself about MQTT as a sensible option. I have a UCM/ETH02 which I intend to keep for Comfigurator. I also have a UCM/232 which I plan to connect to my Raspberry Pi 3 (which is running openHAB and will also be running MQTT when I install it). I\'ve got a tiny USB to serial converter so I should be able to link my UCM/232 to the Raspberry Pi that way. |