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