Page 9 of 17
Re: MQTT Client
Posted: Sun Oct 16, 2016 6:15 pm
by Speshal
kalinkamaen wrote:I have made a example of what i think could work for you! But it could be that I understand you wrong.
Thanks for that, it's sort of what I am after but not quite but I think I have figured out a way anyway, I think I'll not bother with Domoticz (tbh I don't really get on with it and don't find it that intuitive anyway) I only installed it as I has a raspberry Pi going free and was looking for a new project.
I don't know if anyone uses Tasker for Android but I can explain what I am trying to do in those terms.
So in Eventghost this event
would then send a message to tasker.
Set Variable - %KITCHEN eq ON
Then this event
would then send the message
Set Variable - %KITCHEN eq Off
Then I could run a task called Kitchen which would go like this.
If %KITCHEN eq On
Perform Task - Kitchen Off
Else If %KITCHEN eq Off
Perform Task - Kitchen On
So what I'm probably going to do is use the Pi as a touch screen home controller and use an old Android phone running Tasker and MQTT broker as an intermediate between the Sonoff switches and Eventghost.
Thanks for all your help anyway

Re: MQTT Client
Posted: Sun Nov 27, 2016 3:04 pm
by krambriw
New version available: Added support for username & password/key authentication as well as for TLS/SSL. Now you can also use those cloud services hosting a MQTT Broker. The setting dialog's have fields for credentials and certificates. The examples below are from my own settings for connections to CloudMQTT. For more information about CloudMQTT and how to set up a plan and configuration, see here:
https://www.cloudmqtt.com/
To upgrade from previous version:
a) Download & install the new plugin (MQTT Client.egplugin)
b) Shutdown EG
c) My personal choice if I have many existing MQTT actions defined is to edit the EG xml file. Find all lines starting with "MQTTthreads.MQTTclient" or "MQTTthreads.publishMQTT". What you need to do is add a number of parameters to each of those lines. Typically they shall look similar to below after you have modified them
Code: Select all
MQTTthreads.MQTTclient(u'CloudMQTT', u'm13.cloudmqtt.com', 18633, u'owntracks', False, '925453717962', False, True, u'username', u'password', False, u'')
MQTTthreads.publishMQTT(u'CloudMQTT', u'm13.cloudmqtt.com', 18633, u'owntracks', u'ownt test', 0, False, '410083033128', True, u'username', u'password', False, u'')
When you do not use credentials it could look like this:
Code: Select all
MQTTthreads.MQTTclient(u'1wire', u'192.168.10.240', 1883, u'/1wire', False, '743893203818', True, False, u'', u'', False, u'')
d) Save and start EG
e) Alternatively you can just delete and recreate all actions once you have restarted EG with the new plugin installed
I have created and included a certificate for CloudMQTT to use when you need a secure connection to the broker. It might be that you have to change the proposed path in the settings. Also remember to use the SSL port if you enable the TLS/SSL support.
Re: MQTT Client
Posted: Mon Nov 28, 2016 8:19 am
by krambriw
Finally fixed...
Re: MQTT Client
Posted: Sun Dec 04, 2016 3:44 pm
by eman457
Hello krambriw,
How would you create the pub -t (publish) topics for this kodi plugin
http://forum.kodi.tv/showthread.php?tid=222109 with the mqtt client? I did the subscription and I get the data coming in to EventGhost but I can't get it to go the other way back to the Broker. Can please show examples of say; stop,play, pause.......etc
Regards.
Eman457
Re: MQTT Client
Posted: Sun Dec 04, 2016 4:27 pm
by krambriw
Hi,
Unfortunately I do not use Kodi but looking at the documentation my guess is that it should look like in the examples below (provided you have not changed the default configured topic prefix kodi/)
Re: MQTT Client
Posted: Sun Dec 04, 2016 10:16 pm
by eman457
krambriw wrote:Hi,
Unfortunately I do not use Kodi but looking at the documentation my guess is that it should look like in the examples below (provided you have not changed the default configured topic prefix kodi/)
Skärmklipp.JPG
Hello krambriw,
That was so cool of you for that help. Everything was right but you have use the MQTT Broker's IP address for it to work!
Now I will have to contact the author of Kodi2mqtt what to do if you have more than one instance of KODI running.
Otherwise you have done well and thank you so much for the hard work.
Re: MQTT Client
Posted: Thu Dec 15, 2016 8:56 am
by kalinkamaen
krambriw wrote:Yes, you are using the correct, it is only the paho version that has support domoticz
I had to improve the decoding of events for on/off switches. I did not know that the event structure could vary that way. Now it should work
New version published
"Modified decoding of Domoticz events for on/off switches"
Hello sir.
When you have time, can you do this same fix for motion sensors as you did to ON and Off switches in Domoticz?
This is how it looks in the log.
MQTT.domoticz/out/Lighting 2/1011 [255, 5, 'Lighting 2', '0EF038E', 1011, 'Postkasse 2', 1, 'AC', '15', 'Motion Sensor', 10]
This is how it looks like when pushed on or off:
MQTT.domoticz/out/Lighting 2/1011
If I tell Domoticz that its an On/off button and switch it on and off from my computer it shows this as on:
MQTT.domoticz/out/Lighting 2/1011/1
Re: MQTT Client
Posted: Thu Dec 15, 2016 7:06 pm
by krambriw
New version published (1.0.9)
# 2016-12-15 Modified decoding of Domoticz events for Motion Sensors
Re: MQTT Client
Posted: Fri Dec 16, 2016 12:34 pm
by kalinkamaen
Thank you, its working now

Re: MQTT Client
Posted: Sun Jan 08, 2017 5:21 pm
by Foune
Hello krambriw,
I'm quite noob on this subject. I have two eventghost machines on my local network, I just want one to check periodically the other one is alive. How can I do this without a freezing eventghost during each test (like the ping plugin) ?
I'll maybe use the XPL plugin, if I don't find anything simpler. I didn't understand well how it works with MQTT, espacially how to create a "sender". What is a "broker"?
Last question : may eventghost trigger events between each other using MQTT?
Re: MQTT Client
Posted: Sun Jan 08, 2017 9:33 pm
by krambriw
I didn't understand well how it works with MQTT, espacially how to create a "sender". What is a "broker"?
I recommend this reading:
http://www.hivemq.com/mqtt-essentials/
Last question : may eventghost trigger events between each other using MQTT?
Of course, is a very good way to do it. You can use a "free" MQTT broker service on the net or have one locally. This guide may help explaining the principle
http://eventghost.net/forum/viewtopic.php?f=13&t=8168
Re: MQTT Client
Posted: Sun Jan 08, 2017 10:00 pm
by Foune
Thank you for your help, smart and detailed as usual.
Re: MQTT Client
Posted: Thu Jan 12, 2017 2:25 am
by AceoStar
I love this plugin! I would have saved a ton of time replicating my monitor in "SmartThings" if this was included by default. Nice work.

Re: MQTT Client
Posted: Wed Feb 01, 2017 8:29 pm
by heggholmen
Hi,
I've tried to install the MQTT Client in my EG. When I try to connect to the test.mosquitto.org, just to verify, all I get is "Trying to reconnect". I've tried to disabled Windows Firewall and also the firewall on my router. Any suggestion on how to troubleshoot further?
//Jan-Erik
Re: MQTT Client
Posted: Wed Feb 01, 2017 9:31 pm
by Foune
I've been facing this problem for some hours. Look's like their server is not responding, according to their own statistics
I don't like the idea of being dependant of a third party server for such a basic feature, so either I set a local MQTT server on my eg machine, either I change my strategy.