Skip to content

Instantly share code, notes, and snippets.

@kinkerl
Last active February 12, 2018 19:28
Show Gist options
  • Save kinkerl/5c76558652e4102716180dede30b0a5f to your computer and use it in GitHub Desktop.
Save kinkerl/5c76558652e4102716180dede30b0a5f to your computer and use it in GitHub Desktop.
main.py for microhomie quickstart
import utime
import settings
from homie.node.dht22 import DHT22
from homie import HomieDevice
# Homie device setup
homie_device = HomieDevice(settings)
homie_device.add_node(DHT22(interval=60, pin=2))
homie_device.publish_properties()
while True:
# Push the new data to MQTT
homie_device.publish_data()
# Sleep a little bit
utime.sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment