MQTT Client

Questions and comments specific to a particular plugin should go here.
wawa79
Posts: 22
Joined: Fri Nov 02, 2012 11:01 pm

Re: MQTT Client

Post by wawa79 » Fri Oct 20, 2017 8:08 pm

Hello Walter,

In this topic I had endless connection/deconnection loop with your Paho-based plugin and my warkaround was... to stick to the old Mosquitto-based one.

I just found the issue with the Paho plugin when posting this post (this is why it has been edited): to create a 2nd subscription, I copy/paste the 1st one which results in the 2 subscription to have same MQTT-clientID. When changing the MQTT-clientID to different values, I no longer get the problem.

Below is a the Eg config that subscribes 2 topics on test.mosquitto.org broker and produces the looping behavior. I let you tell if this is normal behavior as per MQTT spec or if it a bug.

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1722" Guid="{40F7E6BE-17C0-44C6-9B54-954ECA0AB06A}" Time="1508530026.72">
    <Autostart Name="Autostart" Expanded="True">
        <Plugin Identifier="MQTTthreads" Guid="{D5CCABA6-8E20-4B59-A7A7-9C197F91037F}" File="MQTT Client">
            gAIpLg==
        </Plugin>
    </Autostart>
    <Folder Name="&lt;unnamed folder&gt;" Expanded="True">
        <Macro Name="MQTT Client: Start a new MQTT subscription " Expanded="True">
            <Action Name="Subscribe topic1">
                MQTTthreads.MQTTclient(u'topic1', u'test.mosquitto.org', 1883, u'eg_topic1', False, '979305467018', False, False, u'username', u'password', False, u'', u'', u'', u'TLSv1.2')
            </Action>
            <Action Name="Subscribe topic2">
                MQTTthreads.MQTTclient(u'topic2', u'test.mosquitto.org', 1883, u'eg_topic2', False, '979305467018', False, False, u'username', u'password', False, u'', u'', u'', u'TLSv1.2')
            </Action>
        </Macro>
    </Folder>
</EventGhost>
Thank you in advance!

Snowbird
Experienced User
Posts: 239
Joined: Fri Jul 03, 2009 10:04 am

Re: MQTT Client

Post by Snowbird » Fri Oct 20, 2017 11:39 pm

Hi,

you just need to change the ID, you are using the same ID twice "979305467018", that's why it is looping, just change it to whatever you want, for example "123451234" it doesn't matter as long as you use it once and only once.

wawa79
Posts: 22
Joined: Fri Nov 02, 2012 11:01 pm

Re: MQTT Client

Post by wawa79 » Sun Oct 22, 2017 5:07 pm

Snowbird wrote:
Fri Oct 20, 2017 11:39 pm
Hi,

you just need to change the ID, you are using the same ID twice "979305467018", that's why it is looping, just change it to whatever you want, for example "123451234" it doesn't matter as long as you use it once and only once.
You probably replied before I edited my post. Thank you for the support!

Septik
Posts: 37
Joined: Sun Feb 15, 2015 1:29 pm

Re: MQTT Client

Post by Septik » Tue Oct 24, 2017 6:50 pm

krambriw wrote:
Thu Oct 19, 2017 5:29 pm
Hi there, yeah it is easy to forget minor details,

I think it will work for you but you have to give each subscription a unique name. Like in this example, they are simply named 1,2,3,4 and all are connected to an external broker

Hope this helps,
Kind regards, Walter
Hey again.

Finally found time to play around with this again. After reading other comments, it seems like I maybe was using the same ID twice (by using the same "action" to add each subscription). This time, however, I'm unable to subscribe at all, although the plugin seems to think it's subscribing a thousand times! :p

Image

Edit: Not sure what was wrong, but after reconfiguring Home Assistant to use CloudMQTT instead of the local broker, I'm not having these issues. Might have been an error in my configuration then rather than in your plugin.

livioavalle
Posts: 1
Joined: Tue Feb 13, 2018 8:19 pm

Mqtt volume control

Post by livioavalle » Tue Feb 13, 2018 8:24 pm

Hi, i need your help.
I've installed eventghost and mqtt plugin. i have a mqtt server that work.
I want to make a macro that read a number from a mqtt topic and then set the volume with this number.
example. i publish 50 on the mqtt topic, the macro read the 50 number and set volume to 50. but i donth know how to set up. Can anyone help me?
I use windows 10
Thank you.

Post Reply