umqtt.simple trouble
Posted: Fri Nov 23, 2018 7:05 pm
Hi,
as you guys suggested i looked into umqtt.simple to send data from my ESP2866 to my Raspberry Pi 3.
Here is what i did:
On the ESP2866 running Micropython i created the folder "umqtt" and put the simple.py from inside. (https://github.com/micropython/micropyt ... qtt.simple)
From github I also used the example_pub.py.
I didn't know if it was wrong or what the best way to do this is, but i saved it as main.py and used WebREPL to transfer it to the board.
As suggested in the file itself i ran the command on my RPi-Terminal (Connected via VNC-Viewer) and it was ready to receive messages. (mosquitto and mosquitto-clients previously installed) Via Putty i also connected to my Pi and sent the message which was received. Hello was printed on VNC-Viewer.
I thought restarting the ESP2866 would execute main.py and also print "Hello", but nothing happened. I tried to implement my RPi's IP into the
I tried or
I don't really know what to do and the documentation couldn't help me but that was my best guess.
Can someone give me any help?
Greetings, Tom
as you guys suggested i looked into umqtt.simple to send data from my ESP2866 to my Raspberry Pi 3.
Here is what i did:
On the ESP2866 running Micropython i created the folder "umqtt" and put the simple.py from inside. (https://github.com/micropython/micropyt ... qtt.simple)
From github I also used the example_pub.py.
Code: Select all
from umqtt.simple import MQTTClient
# Test reception e.g. with:
# mosquitto_sub -t foo_topic
def main(server="localhost"):
c = MQTTClient("umqtt_client", server)
c.connect()
c.publish(b"foo_topic", b"hello")
c.disconnect()
if __name__ == "__main__":
main()
As suggested in the file itself i ran the command
Code: Select all
mosquitto_sub -t foo_topic
Code: Select all
mosquitto_pub -t foo_topic -m Hello
I thought restarting the ESP2866 would execute main.py and also print "Hello", but nothing happened. I tried to implement my RPi's IP into the
Code: Select all
c = MQTTClient("umqtt_client", server)
I tried
Code: Select all
c = MQTTClient("umqtt_client", 192.168.178.63)
Code: Select all
c = MQTTClient("[code]c = MQTTClient("umqtt_client", server)
Can someone give me any help?
Greetings, Tom