Comfort Home Automation/ Security System Forums Home
Home Search search Menu menu Not logged in - Login | Register

Comfort 2 Alarm working with Home Assistant!
 Moderated by: slychiu
 New Topic   Reply   Printer Friendly 
 Rate Topic 
AuthorPost
 Posted: Saturday Apr 14th, 2018 07:41 pm
   PM  Quote  Reply 
1st Post
koochy_rat
Member
 

Joined: Saturday Apr 14th, 2018
Location:  
Posts: 6
Status: 
Offline

  back to top

Hi all,

I am sharing my Comfort integration with Home Assistant. This is a standalone Comfort to MQTT bridge for Cytech's Comfort II Ultra Alarm system with UCM/ETH03 module primarily intended to integrate with Home Assistant (or OpenHAB or other MQTT compatible systems). It can run on a Raspberry Pi and other systems with Python 3 support.

With Home Assistant, you can further extend the Comfort system with more complex logic, inputs, outputs and actions. Using virtual inputs, you can define additional zones in Comfort triggered by any sensor available in your Home Assistant setup. Or vice-versa, having Comfort trigger any action in your Home Assistant setup.


Instructions and source code available at:
https://github.com/koochyrat/comfort2

Attached is my HADashboard setup for Home Assistant

Attachment: hadashboard.png (Downloaded 99 times)

Last edited on Saturday Apr 14th, 2018 07:45 pm by koochy_rat



 Posted: Sunday Apr 15th, 2018 06:02 am
   PM  Quote  Reply 
2nd Post
slychiu
Administrator


Joined: Saturday Apr 29th, 2006
Location: Singapore
Posts: 4204
Status: 
Offline

  back to top

Very nice, Koochy_rat!
I hope you dont mind us sharing your news



 Posted: Sunday Apr 15th, 2018 05:13 pm
   PM  Quote  Reply 
3rd Post
koochy_rat
Member
 

Joined: Saturday Apr 14th, 2018
Location:  
Posts: 6
Status: 
Offline

  back to top

No problem, please share away. It's totally free for anyone to use, modify or distribute :D



 Posted: Sunday Apr 15th, 2018 07:08 pm
   PM  Quote  Reply 
4th Post
Sota
Member
 

Joined: Friday May 3rd, 2013
Location: Galway, Ireland
Posts: 6
Status: 
Offline

  back to top

This is something I've been thinking about but I'm not familiar with Home Assistant, do you have any guidance on using this with OpenHAB / Mosquitto?



 Posted: Monday Apr 16th, 2018 08:07 pm
   PM  Quote  Reply 
5th Post
koochy_rat
Member
 

Joined: Saturday Apr 14th, 2018
Location:  
Posts: 6
Status: 
Offline

  back to top

Sorry, I am not familiar with OpenHAB, but it should just be about defining the appropriate topics for MQTT sensors and switches. The should be some guides out there on how to do this. Test with just one sensor, say "comfort2/input1" then activate that input by opening/closing doors or windows in the corresponding zone and you should see some message in the comfort2.py console as well as your mosquitto log and hopefully in OpenHAB. Comfort alarm does not need to be armed for this.



 Posted: Wednesday May 23rd, 2018 08:33 am
   PM  Quote  Reply 
6th Post
mikeinnc
Member
 

Joined: Wednesday Mar 18th, 2015
Location: Perth, Australia
Posts: 61
Status: 
Offline

  back to top

So, I have Home Assistant (HA) successfully running on a RaspberryPi with my MQTT broker, Mosquitto, running on another, separate, Pi on my home network. HA is using MQTT and it works perfectly for a number of Tasmota flashed switches. If I want to connect my Comfort alarm system to HA, is it essential I install the paho-mqtt client, and presumably on the Pi running HA? And - can Comfort be shown in HA automatically, or must I use the command once HA is running? Thanks so much for this - it looks like it will be fantastic! :)



 Posted: Friday May 25th, 2018 04:44 am
   PM  Quote  Reply 
7th Post
koochy_rat
Member
 

Joined: Saturday Apr 14th, 2018
Location:  
Posts: 6
Status: 
Offline

  back to top

Yes, the comfort2.py script requires paho-mqtt library to be installed. It is not a broker so it won't interfere with your Mosquitto and HA. You can run it on any Pi in your network. Comfort will not show in HA automatically, you will need to manually setup HA accordingly with MQTT alarm, sensors, and switches. Check my github link above for details. Since you are using Mosquitto as your broker, set comfort2.py to connect to it. It doesn't matter who starts up first as it will constantly reattempt connection.



 Posted: Monday May 28th, 2018 05:25 am
   PM  Quote  Reply 
8th Post
mikeinnc
Member
 

Joined: Wednesday Mar 18th, 2015
Location: Perth, Australia
Posts: 61
Status: 
Offline

  back to top

Thanks so much to koochy_rat for all his help and assistance with this fabulous extension to Comfort! Home Assistant (HA) is an open-source program that will happily run on a Raspberry Pi and can control and monitor numerous 'smarthome' devices. Being able to integrate Comfort with HA is a huge plus as it brings everything together under one UI. After a couple of minor issues, which koochy_rat soon fixed, I have this working. One issue that may be of use is that if you follow the instructions supplied, if - or when - your terminal session times-out, the program will stop running and all the Comfort entities will be unavailable. I found that using the command 'exec python3 comfort2.py &> /dev/null &' ensures it runs in the background and will NOT stop when you close your Pi terminal session. If you then need to stop the process, use top -u pi (assuming you are running it as the pi user) to see what PID is associated with the python3 process and then kill xxxx where xxxx is that PID. Great work - well worth looking at!:)



 Posted: Monday May 28th, 2018 12:56 pm
   PM  Quote  Reply 
9th Post
phil1155
Member
 

Joined: Friday Nov 9th, 2012
Location:  
Posts: 47
Status: 
Offline

  back to top

Hi Koochy_rat,
I was looking for a way to get Comfort to talk to my Home Automation system and you have created one. Thanks for that.
I implemented Comfort2.py on a debian VM machine ( esxi Vmware) which is also running an open source HA system named Jeedom. I just took out the line calling Home Assistant.
My jeedom app detected the comfort2 "equipment " and started to record the first status messages send by comfort. So was happy to see the disarmed sattus to appear when I did disarmed the alarm.

Now, is it possible to get my Jeedom app to send commands to Comfort through Mosquitto? Any examples of commands would be helpful. Thank you again.

Attachment: object created in jeedom.jpg (Downloaded 46 times)

Last edited on Monday May 28th, 2018 03:16 pm by phil1155



 Posted: Monday May 28th, 2018 03:07 pm
   PM  Quote  Reply 
10th Post
phil1155
Member
 

Joined: Friday Nov 9th, 2012
Location:  
Posts: 47
Status: 
Offline

  back to top

Hi Koochy_rat,
I was looking for a way to get Comfort to talk to my Home Automation system and you have created one. Thanks for that.
I implemented Comfort2.py on a debian VM machine ( esxi Vmware) which is also running an open source HA system named Jeedom. I just took out the line calling Home Assistant.
My jeedom app detected the comfort2 "equipment " and started to record the first status messages send by comfort. So was happy to see the disarmed sattus to appear when I did disarmed the alarm.

Now, is it possible to get my Jeedom app to send commands to Comfort through Mosquitto? Any examples of commands would be helpful. Thank you again.

Attachment: debian terminal.jpg (Downloaded 46 times)

Last edited on Monday May 28th, 2018 03:17 pm by phil1155



 Posted: Tuesday May 29th, 2018 02:11 pm
   PM  Quote  Reply 
11th Post
koochy_rat
Member
 

Joined: Saturday Apr 14th, 2018
Location:  
Posts: 6
Status: 
Offline

  back to top

I'm not familiar with Jeedom, but a quick search shows that there are quite a few MQTT plugins for it. To send commands, you mainly just need to publish the 'comfort2/alarm/set' topic to ARM_HOME, ARM_AWAY or DISARM



 Posted: Wednesday May 30th, 2018 05:15 am
   PM  Quote  Reply 
12th Post
phil1155
Member
 

Joined: Friday Nov 9th, 2012
Location:  
Posts: 47
Status: 
Offline

  back to top

Thanks for the answer , I can see coming traffic form comfort in my debian terminal window, can see that it records a new entry in the list of commands, but did not finf the way /syntax to get a command send from my jeedom app to comfort. IN the sample I published, is the topic syntax ok? And the "Valeur" ( Payload), just DISARM? When testing this command I dont see anything on my debian terminal window.



 Posted: Wednesday May 30th, 2018 06:28 am
   PM  Quote  Reply 
13th Post
phil1155
Member
 

Joined: Friday Nov 9th, 2012
Location:  
Posts: 47
Status: 
Offline

  back to top

Replying to myself.
I was missing to publish as a message. Works now. Many thanks.
Is there a list of the Value(Payload) possibilities to access all commands of Comfort?I am trying to get the gsm message to be forwarded to my HA app through MQTT.

Last edited on Wednesday May 30th, 2018 09:52 am by phil1155



 Posted: Wednesday May 30th, 2018 01:58 pm
   PM  Quote  Reply 
14th Post
koochy_rat
Member
 

Joined: Saturday Apr 14th, 2018
Location:  
Posts: 6
Status: 
Offline

  back to top

If you'd like more control over Comfort, you can use Comfigurator to program a custom Response that allows you to use Comfort internal commands. Then use MQTT to trigger that Response. However I'm not sure if getting the gsm message is possible even with that.



 Posted: Wednesday May 30th, 2018 08:16 pm
   PM  Quote  Reply 
15th Post
phil1155
Member
 

Joined: Friday Nov 9th, 2012
Location:  
Posts: 47
Status: 
Offline

  back to top

Was able to record a Control group command in the Comfort SMS table that did actionnate a flag, captured by MQTT and by my jeedom app.
Means I should now send through comfort SMS to actioonate any other equipment that is not connected to comfort.



 Posted: Thursday Jun 14th, 2018 09:47 pm
   PM  Quote  Reply 
16th Post
steefdebruijn
Member
 

Joined: Sunday Jul 29th, 2012
Location: Netherlands
Posts: 23
Status: 
Offline

  back to top

About starting the thing on a raspberry pi: that system (I use dietpi but others probably the same) uses systemd. So to use it unattended and autostart on boot, create a systemd service file (example below) and enable and start it.

The file (place in /etc/systemd/system/comfort2.service):

[Unit]
Description=Cytech Comfort to MQTT bridge
After=local-fs.target network.target

[Service]
Type=simple
ExecStart=/usr/bin/python3 /root/comfort2.py

[Install]
WantedBy=multi-user.target


Enable and start it:
systemctl daemon-reload
systemctl enable comfort2
systemctl start comfort2


Steef



 Posted: Thursday Jun 14th, 2018 09:51 pm
   PM  Quote  Reply 
17th Post
steefdebruijn
Member
 

Joined: Sunday Jul 29th, 2012
Location: Netherlands
Posts: 23
Status: 
Offline

  back to top

BTW anyone noticed that setting an OUTPUT through MQTT offsets by one (setting comfort2/output10/set to 1 sets output 11 not output 10)? Seems not to happen at other inputs.

Other thing: has anyone succesfully used virtual inputs (so set an input through MQTT to comfort and was able to see this reflected in comfigurator status?

I use this script adapted to USB input instead of ETH with openhab on the other side of MQTT.



 Posted: Wednesday Jun 20th, 2018 04:58 pm
   PM  Quote  Reply 
18th Post
wexfordman
UCM Pi Users
 

Joined: Monday Jan 1st, 2007
Location: Cork, Ireland
Posts: 514
Status: 
Offline

  back to top

mikeinnc wrote: Thanks so much to koochy_rat for all his help and assistance with this fabulous extension to Comfort! Home Assistant (HA) is an open-source program that will happily run on a Raspberry Pi and can control and monitor numerous 'smarthome' devices. Being able to integrate Comfort with HA is a huge plus as it brings everything together under one UI. After a couple of minor issues, which koochy_rat soon fixed, I have this working. One issue that may be of use is that if you follow the instructions supplied, if - or when - your terminal session times-out, the program will stop running and all the Comfort entities will be unavailable. I found that using the command 'exec python3 comfort2.py &> /dev/null &' ensures it runs in the background and will NOT stop when you close your Pi terminal session. If you then need to stop the process, use top -u pi (assuming you are running it as the pi user) to see what PID is associated with the python3 process and then kill xxxx where xxxx is that PID. Great work - well worth looking at!:)

Hi,
I am trying to see if I can get this working with openhab2.
So far I have installed mosquitto broker, and installed paho-mqtt
I am confused now as the next step is to edit the comfort2.py file but I cannot find this, where should it be located ?



 Posted: Thursday Jun 21st, 2018 03:11 pm
   PM  Quote  Reply 
19th Post
schford
UCM Pi Users
 

Joined: Wednesday Feb 25th, 2009
Location:  
Posts: 244
Status: 
Offline

  back to top

You need to grab it from here - https://github.com/koochyrat/comfort2/blob/master/comfort2.py

I just copied and pasted it into a notepad ++ window and then saved that file to where I could run it.

Last edited on Thursday Jun 21st, 2018 03:11 pm by schford



 Posted: Thursday Jun 21st, 2018 10:07 pm
   PM  Quote  Reply 
20th Post
wexfordman
UCM Pi Users
 

Joined: Monday Jan 1st, 2007
Location: Cork, Ireland
Posts: 514
Status: 
Offline

  back to top

Thanks, so I have an matt broker setup, I have comfort talking to it, and I have openhab talking to the broker. Now just need to figure out how to get them to bejave



 Current time is 11:49 pm
Top




UltraBB 1.172 Copyright © 2007-2014 Data 1 Systems