Skip to content

Instantly share code, notes, and snippets.

@eydam-prototyping
Last active February 23, 2021 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eydam-prototyping/a4e82ba8d38dc7ceee7e5e564bf5bd5e to your computer and use it in GitHub Desktop.
Save eydam-prototyping/a4e82ba8d38dc7ceee7e5e564bf5bd5e to your computer and use it in GitHub Desktop.
mqtt.py v1
import ubinascii
import machine
import sys
sys.path.reverse()
from umqtt.robust2 import MQTTClient
sys.path.reverse()
def setup(host, port):
client_id = ubinascii.hexlify(machine.unique_id())
client = MQTTClient(client_id, host, int(port))
client.connect()
return client
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment