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!