MQTT Client

Questions and comments specific to a particular plugin should go here.

Re: MQTT Client

Postby Speshal » Sun Oct 16, 2016 6:15 pm

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
Code: Select all
MQTT.domoticz/out/Lighting 1/3/1
would then send a message to tasker.

Set Variable - %KITCHEN eq ON

Then this event
Code: Select all
MQTT.domoticz/out/Lighting 1/3/0
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 :D
Speshal
 
Posts: 8
Joined: Wed May 28, 2014 2:38 pm

Re: MQTT Client

Postby krambriw » Sun Nov 27, 2016 3:04 pm

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/

Skärmklipp.JPG

Skärmklipp1.JPG


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.
My latest plugins
http://plugins.krambriw.net/index.html

Two men in front of a huge excavator...
- that beast steels work from 100 men with shovels
- well, a 1000 men could do the same using teaspoons
krambriw
Plugin Developer
 
Posts: 2558
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden

Re: MQTT Client

Postby krambriw » Mon Nov 28, 2016 8:19 am

Finally fixed...
My latest plugins
http://plugins.krambriw.net/index.html

Two men in front of a huge excavator...
- that beast steels work from 100 men with shovels
- well, a 1000 men could do the same using teaspoons
krambriw
Plugin Developer
 
Posts: 2558
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden

Re: MQTT Client

Postby eman457 » Sun Dec 04, 2016 3:44 pm

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
eman457
 
Posts: 26
Joined: Wed May 22, 2013 10:53 am

Re: MQTT Client

Postby krambriw » Sun Dec 04, 2016 4:27 pm

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
My latest plugins
http://plugins.krambriw.net/index.html

Two men in front of a huge excavator...
- that beast steels work from 100 men with shovels
- well, a 1000 men could do the same using teaspoons
krambriw
Plugin Developer
 
Posts: 2558
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden

Re: MQTT Client

Postby eman457 » Sun Dec 04, 2016 10:16 pm

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! :mrgreen:

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.
eman457
 
Posts: 26
Joined: Wed May 22, 2013 10:53 am

Re: MQTT Client

Postby kalinkamaen » Thu Dec 15, 2016 8:56 am

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
kalinkamaen
Experienced User
 
Posts: 132
Joined: Wed Dec 26, 2012 9:23 am

Re: MQTT Client

Postby krambriw » Thu Dec 15, 2016 7:06 pm

New version published (1.0.9)

# 2016-12-15 Modified decoding of Domoticz events for Motion Sensors
My latest plugins
http://plugins.krambriw.net/index.html

Two men in front of a huge excavator...
- that beast steels work from 100 men with shovels
- well, a 1000 men could do the same using teaspoons
krambriw
Plugin Developer
 
Posts: 2558
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden

Re: MQTT Client

Postby kalinkamaen » Fri Dec 16, 2016 12:34 pm

Thank you, its working now :)
kalinkamaen
Experienced User
 
Posts: 132
Joined: Wed Dec 26, 2012 9:23 am

Re: MQTT Client

Postby Foune » Sun Jan 08, 2017 5:21 pm

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?
Foune
Experienced User
 
Posts: 65
Joined: Sun Jul 03, 2011 7:08 pm

Re: MQTT Client

Postby krambriw » Sun Jan 08, 2017 9:33 pm

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
My latest plugins
http://plugins.krambriw.net/index.html

Two men in front of a huge excavator...
- that beast steels work from 100 men with shovels
- well, a 1000 men could do the same using teaspoons
krambriw
Plugin Developer
 
Posts: 2558
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden

Re: MQTT Client

Postby Foune » Sun Jan 08, 2017 10:00 pm

Image

Thank you for your help, smart and detailed as usual.
Foune
Experienced User
 
Posts: 65
Joined: Sun Jul 03, 2011 7:08 pm

Re: MQTT Client

Postby AceoStar » Thu Jan 12, 2017 2:25 am

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. :)
AceoStar
 
Posts: 9
Joined: Thu Jan 12, 2017 1:28 am

Re: MQTT Client

Postby heggholmen » Wed Feb 01, 2017 8:29 pm

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
heggholmen
 
Posts: 6
Joined: Thu Aug 07, 2014 3:05 pm

Re: MQTT Client

Postby Foune » Wed Feb 01, 2017 9:31 pm

I've been facing this problem for some hours. Look's like their server is not responding, according to their own statistics

Image

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.
Foune
Experienced User
 
Posts: 65
Joined: Sun Jul 03, 2011 7:08 pm

PreviousNext

Return to Plugin Support

Who is online

Users browsing this forum: No registered users and 7 guests