syntax for auth with paho connecting to mqtt [message #1755553] |
Sun, 05 March 2017 16:58 |
Rainer Müller-Knoche Messages: 1 Registered: March 2017 |
Junior Member |
|
|
Trying and search since hours to find the correct systax
Here my phyton scrip
import paho.mqtt.publish as publish
import time
auth ={'username':"username", 'password':"password"}
print("Sending 0...")
publish.single("green", "0", hostname="localhost", auth="auth")
time.sleep(1)
print("Sending 1...")
publish.single("green", "1", hostname="localhost", auth="auth")
time.sleep(0.5)
here the error message
File "blink.py", line 7, in <module>
publish.single("green", "0", hostname="localhost", auth="auth")
File "/usr/local/lib/python2.7/dist-packages/paho/mqtt/publish.py", line 223, in single
multiple([msg], hostname, port, client_id, keepalive, will, auth, tls, protocol, transport)
File "/usr/local/lib/python2.7/dist-packages/paho/mqtt/publish.py", line 129, in multiple
username = auth['username']
TypeError: string indices must be integers, not str
need help
Thank you
Rainer
|
|
|
Powered by
FUDForum. Page generated in 0.03340 seconds