Page 8 of 9

Re: MQTT Gateway Plugin

PostPosted: Fri Dec 15, 2017 7:55 pm
by dillwishlist
I'm getting the exact same error (Indigo 6, OS X 10.12.6). I suspect some OS update or something broke it, but I don't know where to look. Any advice would be greatly appreciated!

Thanks
Alexander

Re: MQTT Gateway Plugin

PostPosted: Fri Dec 15, 2017 9:11 pm
by jay (support)
See if this file exists on your system:

Code: Select all
/usr/local/bin/mosquitto_pub


I don't know anything about this plugin, but I suspect the error means that the above command isn't there (or maybe permissions on it are wrong). Which means that mosquito didn't get installed correctly I think. Just a guess on my part though...

Re: MQTT Gateway Plugin

PostPosted: Wed Dec 27, 2017 2:36 pm
by jeremyjjr
dillwishlist wrote:
I'm getting the exact same error (Indigo 6, OS X 10.12.6). I suspect some OS update or something broke it, but I don't know where to look. Any advice would be greatly appreciated!

Thanks
Alexander


Folks, sorry not to have responded sooner! Looks like I accidentally deleted my topic subscription! :(

The file not found error is a result of the subprocess trying to call the 'mosquitto_pub' as previously pointed out. This likely means you've not correctly installed the mosquitto client on your Indigo server.

Instructions for doing this are referenced in the link at the very top of this thread. (refers to installing the MQTT server - but also installs the client files as well - just don't start the server on the Mac)

Jeremy.

Re: MQTT Gateway Plugin

PostPosted: Thu Mar 08, 2018 12:40 pm
by Topolino
This thing is really disappointing. It only sproadically receives updates, and when it does, it isn't able to do anything with them. But hey, it fits very well with the sorry state of other buggy beta plugins on this platform.

Re: MQTT Gateway Plugin

PostPosted: Fri Mar 09, 2018 3:03 pm
by autolog
Just an observation (that may or or may not help you?) - You are more likely to get offers of help if you actually detail what your problem is and how you are trying to use the plugin. :)

Also, just a suggestion, sarcasm is unlikely to aid that process. :wink:

Re: MQTT Gateway Plugin

PostPosted: Sun Mar 11, 2018 2:25 pm
by jh71283
Topolino wrote:
This thing is really disappointing. It only sproadically receives updates, and when it does, it isn't able to do anything with them. But hey, it fits very well with the sorry state of other buggy beta plugins on this platform.


Well, seeing as most of the plugins are open source, I am sure the owners would be glad to accept your bug-fix contributions.


Sent from my iPhone using Tapatalk

Re: MQTT Gateway Plugin

PostPosted: Sun Mar 11, 2018 8:35 pm
by cuhouse
Topolino wrote:
This thing is really disappointing. It only sproadically receives updates, and when it does, it isn't able to do anything with them. But hey, it fits very well with the sorry state of other buggy beta plugins on this platform.


I have been using the MQTT Gateway Plugin for about 8 months. I have a low voltage Sonoff device flashed with Tasmota firmware which is connected to an air purge valve on my stationary air compressor. Jeremy’s plugin sends an “on” topic to it everyday at 3PM. Works great and have never had any issues.

Thanks Jeremy for sharing a great plugin.

Jody

Re: MQTT Gateway Plugin

PostPosted: Mon Mar 12, 2018 3:55 am
by jeremyjjr
Topolino wrote:
This thing is really disappointing. It only sproadically receives updates, and when it does, it isn't able to do anything with them. But hey, it fits very well with the sorry state of other buggy beta plugins on this platform.


As others have hinted, if there is something that's not working specifically for you with this plug in then let me know. Cannot promise to solve the issue, but I'll take a look and see if we can work it collaboratively.

At the end of the day, we are all here trying to help move the community as a whole forwards and trying to have some fun whilst doing it!

J.

Re: MQTT Gateway Plugin

PostPosted: Tue Mar 27, 2018 8:58 pm
by craigsheppard
Hi Jeremy, I'm having some issues updating variables based on MQTT messages.

I have mosquito (broker) running in a docker container, and I can pub/sub with no problem.

If I set up a new mqtt Gateway in Indigo 7 (latest), I get the following in the mosquito broker:

Code: Select all
1522203353: New connection from 172.17.0.1 on port 1883.
1522203353: New client connected from 172.17.0.1 as mosqpub|89005-lhs.local (c1, k60).
1522203353: Client mosqpub|89005-lhs.local disconnected.
1522203354: New connection from 172.17.0.1 on port 1883.
1522203354: New client connected from 172.17.0.1 as mosqsub|89006-lhs.local (c1, k60).

and the following in the indigo log (with debug logging turned on):

Code: Select all
   Enabling plugin "mqttGateway 1.2.0"
   Starting plugin "mqttGateway 1.2.0" (pid 89442)
   mqttGateway                     mqtt debugging enabled
   Started plugin "mqttGateway 1.2.0"
   mqttGateway Debug               startup called
   mqttGateway Debug               io_queue_reader started
   mqttGateway Debug               mqtt_listener for localhost:test started with pid: 89446
   mqttGateway Debug               mqtt_listener for 10.0.1.7:test started with pid: 89447
   mqttGateway Debug               Starting ConcurrentThread ... Active listener threads = 2

I can then get the mqtt Gateway device state to update on/off based on incoming messages:

Code: Select all
mosquitto_pub -h 10.0.1.7 -t test -m on

If I then edit the mqtt Gateway device to write to a variable, the plugin becomes unresponsive after the first message, and I have to reload it to get it to work again.

I re-launched it in the debugger, and found the following error when it tries to write to the variable:

Code: Select all
 mosquitto_pub -h 10.0.1.7 -t test -m hello

Code: Select all
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 763, in run
    self.__target(*self.__args, **self.__kwargs)
  File "plugin.py", line 244, in io_queue_reader
    except e:
NameError: global name 'e' is not defined

The corresponding indigo log looks like this:

Code: Select all
   mqttGateway Debug               io_queue_reader:localhost:test: hello
   mqttGateway                     mqttTest received mqtt message from test
   mqttGateway Debug               will put data into: 946916136

and after that, the plugin no longer adds any messages to the log until it is restarted.

My device config for writing to the variable is this:
Add value to variable: √
Insert in: mqtt
Enter path to data: <I left this field blank>


Am I doing something wrong? Is there a better way to access these messages?

Thanks!

Re: MQTT Gateway Plugin

PostPosted: Fri May 18, 2018 8:09 am
by rlust
Is there a way to automate restarting the MQTT plugin?
Mine is stopping at least once a day, and needs to be rebooted.

Re: MQTT Gateway Plugin

PostPosted: Fri May 18, 2018 11:00 am
by jay (support)
Check out the Restart a Plugin section in the scripting tutorial for an example. This is the id for the plugin: com.simplifiedthinking.mqttgateway

Re: MQTT Gateway Plugin

PostPosted: Tue Jun 26, 2018 2:17 am
by anothersphere
craigsheppard wrote:
If I then edit the mqtt Gateway device to write to a variable, the plugin becomes unresponsive after the first message, and I have to reload it to get it to work again.
.....
Am I doing something wrong? Is there a better way to access these messages?

Thanks!


Any luck with this? I am getting something pretty similar. Works fine until I try to write to a variable.

Re: MQTT Gateway Plugin

PostPosted: Thu Aug 09, 2018 8:10 am
by Umtauscher
Hi Jeremy,

thanks for the plugin.
What I'm trying to do is to enhance my HA system with some cheap sonoff devices.
After struggeling with homebrew I finally got the mosquitto working with MacPorts which was a lot better for me to install.

I have now my first Sonoff Basic installed in my network and the status is just showing fine.
Unfortunately the On/Off buttons in Indigo are greyed out.
As most of the sonoff have a basic On/Off function, it would be a great help and make life much easier if the On/Off could be linked to specifig commands in the corresponding Mqqt Device of your plugin.
I am not sure, if I understand correctly, but would I have to make an additional virtual device and 3 action groups for On/Off/Toggle to make the device behave like a normal switch?
Maybe you could point me into the right direction? Thanks

Wilhelm

Re: MQTT Gateway Plugin

PostPosted: Thu Aug 09, 2018 8:58 am
by rlust
Great idea for an enhancment!

Re: MQTT Gateway Plugin

PostPosted: Sat Aug 11, 2018 7:33 am
by Umtauscher
Hi rlust,

seems I am not alone with this idea.
I just found out the "Greensky MQTT Bridg Plugin" already supports this out of the box, so I have switched.
Cheers
Wilhelm