コード例 #1
0
ファイル: example.py プロジェクト: zoide/microhomie-nodes
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)
コード例 #2
0
def main():
    homie = HomieDevice(settings)

    node = SimpleHomieNode("nodetype", "node_property")

    homie.add_node(node)

    # run forever
    homie.start()
コード例 #3
0
ファイル: main.example.py プロジェクト: timpur/microhomie
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)
コード例 #4
0
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)
コード例 #5
0
ファイル: example-simple.py プロジェクト: vupham26/microhomie
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)