def main(): homie = HomieDevice(settings) n = SimpleHomieNode(node_type=b'dummy', node_property=b'value', interval=5) n.value = 17 homie.add_node(n) homie.publish_properties() while True: homie.publish_data() n.value = utime.time() print(n) utime.sleep(1)
def main(): homie = HomieDevice(settings) node = SimpleHomieNode("nodetype", "node_property") homie.add_node(node) # run forever homie.start()
def main(): # Homie device setup homie_device = HomieDevice(settings) # Adds a simple test node n = SimpleHomieNode(node_type=b'dummy', node_property=b'value', interval=5) homie_device.add_node(n) # Push information about the device to MQTT homie_device.publish_properties() while True: # Update the data of the simple note for demonstration purpose n.value = utime.time() print("UPDATED: ".format(n)) # Push the new data to MQTT homie_device.publish_data() # Sleep a little bit utime.sleep(1)
import utime import settings from homie.node.simple import SimpleHomieNode from homie import HomieDevice # Homie device setup homie_device = HomieDevice(settings) # Adds a simple test node n = SimpleHomieNode(node_type=b'dummy', node_property=b'value', interval=5) homie_device.add_node(n) # Push information about the device to MQTT homie_device.publish_properties() while True: # Update the data of the simple note for demonstration purpose n.value = utime.time() print("UPDATED: ".format(n)) # Push the new data to MQTT homie_device.publish_data() # Sleep a little bit utime.sleep(1)
import utime import settings from homie.node.simple import SimpleHomieNode from homie import HomieDevice homie = HomieDevice(settings) node = SimpleHomieNode("nodetype", "node_property") homie.add_node(node) # publish device and node properties homie.publish_properties() while True: # publish device data homie.publish_data() node.value = utime.time() utime.sleep(1)