Example #1
0
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)
Example #2
0
def main():
    # Initialize the Homie device
    device = HomieDevice(settings)

    # Initialize the Homie node for the onboard LED
    led_node = HomieNode(
        id="led",
        name="Onboard LED",
        type="LED",
    )

    # Initialize the Homie property to power on/off the led
    led_power = HomieProperty(
        id="power",
        name="Power",
        settable=True,
        datatype=BOOLEAN,
        default=FALSE,
        on_message=toggle_led,
    )

    # Add the power property to the node
    led_node.add_property(led_power)

    # Add the led node to the device
    device.add_node(led_node)

    # Run
    device.run_forever()
Example #3
0
def main():
    homie = HomieDevice(settings)

    # Add LED node to device
    homie.add_node(LED(pin=2))

    # run forever
    homie.start()
Example #4
0
def main():
    homie = HomieDevice(settings)

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

    homie.add_node(node)

    # run forever
    homie.start()
Example #5
0
def main():
    # Homie device setup
    homie = HomieDevice(settings)

    # Add PIR node to device
    homie.add_node(Relais())

    # run forever
    homie.start()
Example #6
0
def main():
    # Homie device setup
    homie = HomieDevice(settings)

    # Add PIR node to device
    homie.add_node(PIR())

    # run forever
    homie.run_forever()
Example #7
0
def main():
    # Homie device setup
    homie = HomieDevice(settings)

    # Add LED node to device
    homie.add_node(AmbientLight(pin=5, leds=60))

    # run forever
    homie.start()
Example #8
0
def main():
    # Homie device setup
    homie = HomieDevice(settings)

    # Add dht22 node
    homie.add_node(DHT22(pin=4))

    # run forever
    homie.run_forever()
Example #9
0
def main():
    # Homie device setup
    homie = HomieDevice(settings)

    # Add LED node to device
    homie.add_node(LED())

    # run forever
    homie.start()
Example #10
0
def main():
    homie = HomieDevice(settings)

    # Add LED node to device
    homie.add_node(LED(pin=2))

    # publish device and node properties
    homie.publish_properties()

    while True:

        # publish device data
        homie.publish_data()

        # check for new mqtt messages
        homie.mqtt.check_msg()

        utime.sleep(1)
Example #11
0
def main():
    homie = HomieDevice(settings)

    homie.add_node(
        AmbientLight(
            pin=4,
            leds=3
        )
    )

    homie.run_forever()
Example #12
0
def main():
    wdt = WDT(timeout=3000)

    homie = HomieDevice(settings)

    homie.add_node(Error())

    # publish device and node properties
    homie.publish_properties()

    while True:
        # reset the errors
        homie.errors = 0

        # publish device data
        homie.publish_data()

        # feed wdt if we have no errors
        if not homie.errors:
            wdt.feed()

        utime.sleep(1)
Example #13
0
def main():
    # Network Setup
    utils.disable_ap()

    # Homie device setup
    homie = HomieDevice(settings)

    # Add LED node to device
    homie.add_node(LED(pin=2))

    # run forever
    homie.start()
Example #14
0
def main():
    # Network Setup
    utils.disable_ap()

    # Homie device setup
    homie = HomieDevice(settings)

    # Add LED node to device
    door = Switch(type="magnet", name="Stable door", pin=4)
    homie.add_node(door)

    # run forever
    homie.start()
Example #15
0
def main():
    relay1 = ShellyRelay("relay1",
                         rpin=4,
                         swpin=5,
                         name="Light Switch 01",
                         type="Shelly 2.5")
    relay2 = ShellyRelay("relay2",
                         rpin=15,
                         swpin=13,
                         name="Light Switch 02",
                         type="Shelly 2.5")

    homie = HomieDevice(settings)
    homie.add_node(relay1)
    homie.add_node(relay2)
    homie.start()
Example #16
0
def main():
    i2c = I2C(scl=Pin(16), sda=Pin(17))

    bmp280 = bme280.BME280(i2c=i2c)

    bmp280Node = BMP280Node(id="bmp280",
                            name="Enviroment-Sensor",
                            bmp280=bmp280)

    leds = neopixel.NeoPixel(Pin(23, Pin.OUT), 28)

    controlNode = LEDControlNode(id="leds1",
                                 name="LEDs",
                                 pin_up=Pin(18),
                                 pin_down=Pin(5),
                                 leds=leds)

    # Homie device setup
    homie = HomieDevice(settings)
    homie.add_node(bmp280Node)
    homie.add_node(controlNode)

    # run forever
    homie.run_forever()
def main():
    # homie
    print("homie main")
    homie = HomieDevice(settings)
    homie.add_node(WeatherSensor(device=homie))
    homie.run_forever()
Example #18
0
def main():
    homie = HomieDevice(settings)
    homie.add_node(HTTP(url="http://10.0.0.1/status.html"))
    homie.start()
def main():
    # homie
    homie = HomieDevice(settings)
    homie.add_node(K30(device=homie))
    homie.run_forever()
Example #20
0
def main():
    homie_dev = HomieDevice(settings)
    homie_dev.add_node(BME280())
    homie_dev.publish_properties()
    homie_dev.start()
Example #21
0
def main():
    homie = HomieDevice(settings)
    homie.add_node(SmartSocket())
    homie.start()
Example #22
0
def main():
    homie = HomieDevice(settings)
    homie.add_node(SmartSocket())
    homie.run_forever()
Example #23
0
def main():
    homie = HomieDevice(settings)
    homie.add_node(DS18B20())
    homie.run_forever()