Giter VIP home page Giter VIP logo

microhomie's Introduction

Microhomie

Documentation Status

Microhomie is a MicroPython framework for Homie, a lightweight MQTT convention for the IoT. Main target for Microhomie is the ESP8266 device and has been well tested and used on ESP32.

Microhomie v3 implements Homie v4.0.0.

Read the Microhomie documentation to get started.

Learn from our examples until we have a "howto build nodes" section in the documentation or join the #microhomie channel on the MicroPython Slack community and chat with us.

Binaries can be verified with minisign and the following public key:

RWTwPeRvouNzP+mcL1t7QDTnKz96i3Kuf95fjpE28szMq8OTycMmiTzX

Update from v2

Microhomie v3 has some breaking changes you should be aware of before update.

  • Microhomie v3 only supports the new LFS2 filesystem. For update you must erase and reflash your device.
  • You may need to update your asyncio coroutines as of the new Micropython asyncio v3. Peter Hinch's has a great asyncio v3 update guide
  • New asyncio V3 primitives from Peter Hinch micropython-async for switch and pushbutton.
  • The utils module was refactored to homie.network.

MicroPython changes

  • btree and vfat support disabled to save some space
  • AccessPoint SSID changed to Microhomie-MAC with the secret microhomiE
  • inisetup.py writes a custom boot.py

Install

Download the latest image and flash it like any MicroPython image to your ESP8266 device. I.E:

esptool --port PORT --baud 460800 write_flash --flash_size=detect --verify -fm dio 0x0 microhomie-esp8266-VERSION.bin

Make your changes in settings.example.py and copy this file as settings.py to your device. You can now test our example nodes from examples/, just copy the main.py to your device. Start with the examples/led node to turn on and off the on-board LED.

Example

This is a basic example to power the on-board LED from an ESP8266 development board:

import settings

from machine import Pin

from homie.node import HomieNode
from homie.device import HomieDevice
from homie.property import HomieProperty
from homie.constants import BOOLEAN, FALSE, TRUE


# Reversed values map for the esp8266 boards on-board LED
ONOFF = {FALSE: 1, TRUE: 0}


# Initialize the pin for the onboard LED
LED = Pin(2, Pin.OUT, value=1)


# The on_message handler to power the led
def toggle_led(topic, payload, retained):
    LED(ONOFF[payload])


def main():
    # Initialize the Homie device
    device = HomieDevice(settings)

    # Initialize the Homie node for the on-board LED
    led_node = HomieNode(id="led", name="On-board 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()


if __name__ == "__main__":
    main()

Build esp8266 image

To build your own Microhomie image for the ESP8266 device, run:

make bootstrap
make
make deploy PORT=/dev/ttyUSBX

Known issues

  • No SSL support for now

Included libraries

  • mqtt_as.py by Peter Hinch but we use the patched version from Kevin Köck. Kevins version has support for a keyword based configuration and unsubscribe.
  • asyncio V3 primitives from Peter Hinch micropython-async repository.

microhomie's People

Contributors

arthurlutz avatar dmartinpro avatar kinkerl avatar rroemhild avatar zoide avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

microhomie's Issues

Upgrade to MICROPYVERSION = 1.12

Could you please take into account the new version of Micropython and build either a ESP8266 and ESP32 version of Microhomie?

BerkelyDB library

What can I safely eliminate if I want to add back the BerkelyDB library? I will only be using relays and the onewire ds18b20 sensor.

help('modules')
main homie/init os uheapq
_boot homie/constants port_diag uio
_onewire homie/device random ujson
apa102 homie/node re uos
array homie/property select upip
aswitch homie/utils socket upip_utarfile
asyn inisetup ssl urandom
binascii io struct ure
builtins json sys uselect
collections lwip time usocket
dht machine uasyncio/init ussl
ds18x20 math uasyncio/core ustruct
errno micropython ubinascii utime
esp mqtt_as ucollections utimeq
flashbdev neopixel ucryptolib uzlib
framebuf network uctypes websocket
gc ntptime uerrno websocket_helper
hashlib onewire uhashlib zlib

Default config problem with wlan config and older Micropython version

Initialization of homie class fails because of the default configuration and missing config() method from network.WLAN on older MicroPython versions:

Traceback (most recent call last):
  File "main.py", line 6, in <module>
  File "/flash/lib/homie/__init__.py", line 31, in <module>
AttributeError: 'WLAN' object has no attribute 'config'
MicroPython v1.8.6-849-fcbbfe3 on 2018-01-03; FiPy with ESP32

Possible solution could be to move the default configuration to a separate file i.e. settings.py and import this file.

Difficulties getting homie_device to start

I am very new to microhomie and having a few problems getting it running. I created a settings.py file and copied it across to my ESP device. I have successfully started WiFi and imported my settings but when I try and run
homie_device = HomieDevice(settings)
I get the following error
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/lib/homie/__init__.py", line 35, in __init__ AttributeError: 'module' object has no attribute 'DEVICE_STATS_INTERVAL'

Any ideas? I am very keen to use this project

onewire node

I have been creating a prototype app and thought I would share this class for onewire DS18X20. I basically took the DHT22 node and modified it. Note: the below will only return the first sensor on the bus as onewire can have many sensors on one gpio. I can be quite easily be modified to enumerate all sensors.

import gc
import time

from ds18x20 import DS18X20
from onewire import OneWire
from machine import Pin
from homie.node import HomieNode

class DS18B20(HomieNode):

def __init__(self, name="One Wire DS18B20", pin=12, interval=60, pull=-1):
    super(DS18B20, self).__init__(name=name, interval=interval)
    gc.collect()
    self.node_id = b"ds18b20"
    print('Pin=' + str(pin))
    self.ds18b20 = DS18X20(OneWire(Pin(pin)))
    addrs = self.ds18b20.scan()
    if not addrs:
        raise Exception('no DS18B20 found at bus on pin %d' % pin)
    # save what should be the only address found
    self.addr = addrs.pop()

    self.temperature = 0

def __str__(self):
    return 'DS18B20: Temperature = {}'.format(
        self.temperature)

def get_properties(self):
    yield (b"ds18b20/$name", self.name)
    yield (b'ds18b20/$type', b'DS81B20')
    yield (b'ds18b20/$properties', b'temperature')

    # temperature
    yield (b'ds18b20/temperature/$name', b'Temperature')
    yield (b'ds18b20/temperature/$unit', b'°F')
    yield (b'ds18b20/temperature/$datatype', b'float')
    yield (b'ds18b20/temperature/$format', b'-40:80')

def update_data(self):
    self.temperature = self.read_temp()

def get_data(self):
    yield (b'ds18b20/temperature', self.temperature)

def read_temp(self, fahrenheit=True):
    """
    Reads temperature from a single DS18X20
    :param fahrenheit: Whether or not to return value in Fahrenheit
    :type fahrenheit: bool
    :return: Temperature
    :rtype: float
    """
    self.ds18b20.convert_temp()
    time.sleep_ms(750)
    temp = self.ds18b20.read_temp(self.addr)
    if fahrenheit:
        ntemp = temp
        print('Temp: ' + str(self.c_to_f(ntemp)))
        return self.c_to_f(ntemp)
    return temp

@staticmethod
def c_to_f(c):
    """
    Converts Celsius to Fahrenheit
    :param c: Temperature in Celsius
    :type c: float
    :return: Temperature in Fahrenheit
    :rtype: float
    """
    return (c * 1.8) + 32

Merge feature branches

Have the feature branches been reviewed and ready to be merged? The logging feature looks like it would be helpful. What is the purpose of the set_state feature?

Thanks,
Rick

Looking to Support this project

Hey guys, for a while now I've been mataining homie for esp8266 C++ code base. I've been thinking alot about time management and the issues I've been facing with the lack of tim I have now that I have a full time job (fresh form uni). With the little time I get, I think I would achieve more spending that time on the micropython platform (a higher level language) than C++. Looking to talk to see how I can help and if help is needed. I feel bad for the fokes over on the C++ platform. But I'm still committed to homie (just in a different way)!

Looking to Support this project

Hey guys, for a while now I've been mataining homie for esp8266 C++ code base. I've been thinking alot about time management and the issues I've been facing with the lack of tim I have now that I have a full time job (fresh form uni). With the little time I get, I think I would achieve more spending that time on the micropython platform (a higher level language) than C++. Looking to talk to see how I can help and if help is needed. I feel bad for the fokes over on the C++ platform. But I'm still committed to homie (just in a different way)!

Publish all nodes on recovery

I want to publish all nodes if connection is lost and then recovered. What would be the best way to handle publishing all nodes if connection to broker is lost then reconnected?

Project Plan

Is there a plan to continue this project and work on the wifi reconnect issue? I noticed a branch asyncio that is using mqtt_as by Peter Hinch. Will the asyncio branch be merged soon?

Thanks,
Rick

Connection losses with many nodes/properties

Hi there,
first of all thanks for this library, I really like how easy it is to build homie devices!

When I tried to use it for my first real-world project, I ran into the following issue, though.
The device has 9 nodes with two properties each (9 motors with speed and direction property).

The problem is that the device tries to publish its nodes and its properties during startup but never accomplishes it since the connection is lost and the property publishing starts all over again.

I first thought it's a problem of my nodes, but I managed to reproduce the issue with the led example.

import settings

from machine import Pin

from homie.constants import FALSE, TRUE, BOOLEAN, INTEGER
from homie.device import HomieDevice
from homie.node import HomieNode
from homie.property import HomieProperty


class LED(HomieNode):

    # Reversed values for the esp8266 boards onboard led
    ONOFF = {FALSE: 1, TRUE: 0}

    def __init__(self, id=0, name="Onboard LED", pin=0):
        super().__init__(id="led%d" % id, name=name, type="LED")

        self.p_power = HomieProperty(
            id="power",
            name="LED Power",
            settable=True,
            datatype=BOOLEAN,
            default=FALSE,
            on_message=self.on_power_msg,
        )
        self.add_property(self.p_power)

        self.directionProperty = HomieProperty(
            id="direction",
            name="direction",
            settable=True,
            datatype=INTEGER,
            default=30,
            on_message=self.direction_msg,
        )
        self.add_property(self.directionProperty)        

    def on_power_msg(self, topic, payload, retained):
        print("power_msg %s" % self.id)

    def direction_msg(self, topic, payload, retained):
        print("direction_msg %s" % self.id)


def main():
    # Homie device setup
    homie = HomieDevice(settings)

    # Add LED node to device
    homie.add_node(LED())
    homie.add_node(LED(1, "LED 1"))
    homie.add_node(LED(2, "LED 2"))
    homie.add_node(LED(3, "LED 3"))
    homie.add_node(LED(4, "LED 4"))
    homie.add_node(LED(5, "LED 5"))
    homie.add_node(LED(6, "LED 6"))
    homie.add_node(LED(7, "LED 7"))
    homie.add_node(LED(8, "LED 8"))
    homie.add_node(LED(9, "LED 9"))
    homie.add_node(LED(10, "LED 10"))
    homie.add_node(LED(11, "LED 11"))

    # run forever
    homie.run_forever()


if __name__ == "__main__":
    main()

This is what happens:

CONNECTION HANDLER!
MQTT SUBSCRIBE: devices/microhomie1/$mpy
MQTT PUBLISH: devices/microhomie1/$homie --> b'4.0.0'
MQTT SUBSCRIBE: devices/microhomie1/led0/power
MQTT SUBSCRIBE: devices/microhomie1/led0/direction
MQTT SUBSCRIBE: devices/microhomie1/led1/power
MQTT SUBSCRIBE: devices/microhomie1/led1/direction
MQTT SUBSCRIBE: devices/microhomie1/led2/power
MQTT SUBSCRIBE: devices/microhomie1/led2/direction
MQTT SUBSCRIBE: devices/microhomie1/led3/power
MQTT SUBSCRIBE: devices/microhomie1/led3/direction
MQTT SUBSCRIBE: devices/microhomie1/led4/power
MQTT SUBSCRIBE: devices/microhomie1/led4/direction
MQTT SUBSCRIBE: devices/microhomie1/led5/power
MQTT SUBSCRIBE: devices/microhomie1/led5/direction
MQTT SUBSCRIBE: devices/microhomie1/led6/power
MQTT SUBSCRIBE: devices/microhomie1/led6/direction
MQTT SUBSCRIBE: devices/microhomie1/led7/power
MQTT SUBSCRIBE: devices/microhomie1/led7/direction
MQTT SUBSCRIBE: devices/microhomie1/led8/power
MQTT SUBSCRIBE: devices/microhomie1/led8/direction
MQTT SUBSCRIBE: devices/microhomie1/led9/power
MQTT SUBSCRIBE: devices/microhomie1/led9/direction
MQTT SUBSCRIBE: devices/microhomie1/led10/power
MQTT SUBSCRIBE: devices/microhomie1/led10/direction
MQTT SUBSCRIBE: devices/microhomie1/led11/power
MQTT SUBSCRIBE: devices/microhomie1/led11/direction
MQTT PUBLISH: devices/microhomie1/$name --> b'microhomie1'
MQTT SUBSCRIBE: devices/microhomie1/led0/power/set
MQTT MESSAGE: devices/microhomie1/led0/power --> false, True
MQTT UNSUBSCRIBE: devices/microhomie1/led0/power
MQTT SUBSCRIBE: devices/microhomie1/led0/direction/set
MQTT MESSAGE: devices/microhomie1/led0/direction --> 30, True
direction_msg led0
MQTT UNSUBSCRIBE: devices/microhomie1/led0/direction
MQTT SUBSCRIBE: devices/microhomie1/led1/power/set
MQTT MESSAGE: devices/microhomie1/led1/power --> false, True
MQTT UNSUBSCRIBE: devices/microhomie1/led1/power
MQTT SUBSCRIBE: devices/microhomie1/led1/direction/set
MQTT MESSAGE: devices/microhomie1/led1/direction --> 30, True
direction_msg led1
MQTT UNSUBSCRIBE: devices/microhomie1/led1/direction
MQTT SUBSCRIBE: devices/microhomie1/led2/power/set
MQTT MESSAGE: devices/microhomie1/led2/power --> false, True
MQTT UNSUBSCRIBE: devices/microhomie1/led2/power
MQTT SUBSCRIBE: devices/microhomie1/led2/direction/set
MQTT MESSAGE: devices/microhomie1/led2/direction --> 30, True
direction_msg led2
MQTT UNSUBSCRIBE: devices/microhomie1/led2/direction
MQTT SUBSCRIBE: devices/microhomie1/led3/power/set
MQTT MESSAGE: devices/microhomie1/led3/power --> false, True
MQTT UNSUBSCRIBE: devices/microhomie1/led3/power
MQTT SUBSCRIBE: devices/microhomie1/led3/direction/set
MQTT MESSAGE: devices/microhomie1/led3/direction --> 30, True
direction_msg led3
MQTT UNSUBSCRIBE: devices/microhomie1/led3/direction
MQTT SUBSCRIBE: devices/microhomie1/led4/power/set
MQTT MESSAGE: devices/microhomie1/led4/power --> false, True
MQTT UNSUBSCRIBE: devices/microhomie1/led4/power
MQTT SUBSCRIBE: devices/microhomie1/led4/direction/set
MQTT MESSAGE: devices/microhomie1/led4/direction --> 30, True
direction_msg led4
MQTT UNSUBSCRIBE: devices/microhomie1/led4/direction
MQTT SUBSCRIBE: devices/microhomie1/led5/power/set
MQTT MESSAGE: devices/microhomie1/led5/power --> false, True
MQTT UNSUBSCRIBE: devices/microhomie1/led5/power
MQTT SUBSCRIBE: devices/microhomie1/led5/direction/set
MQTT MESSAGE: devices/microhomie1/led5/direction --> 30, True
direction_msg led5
MQTT UNSUBSCRIBE: devices/microhomie1/led5/direction
MQTT SUBSCRIBE: devices/microhomie1/led6/power/set
MQTT MESSAGE: devices/microhomie1/led6/power --> false, True
MQTT UNSUBSCRIBE: devices/microhomie1/led6/power
MQTT SUBSCRIBE: devices/microhomie1/led6/direction/set
MQTT MESSAGE: devices/microhomie1/led6/direction --> 30, True
direction_msg led6
MQTT UNSUBSCRIBE: devices/microhomie1/led6/direction
MQTT SUBSCRIBE: devices/microhomie1/led7/power/set
MQTT MESSAGE: devices/microhomie1/led7/power --> false, True
MQTT UNSUBSCRIBE: devices/microhomie1/led7/power
MQTT SUBSCRIBE: devices/microhomie1/led7/direction/set
MQTT MESSAGE: devices/microhomie1/led7/direction --> 30, True
direction_msg led7
MQTT UNSUBSCRIBE: devices/microhomie1/led7/direction
MQTT SUBSCRIBE: devices/microhomie1/led8/power/set
MQTT MESSAGE: devices/microhomie1/led8/power --> false, True
MQTT UNSUBSCRIBE: devices/microhomie1/led8/power
MQTT SUBSCRIBE: devices/microhomie1/led8/direction/set
MQTT MESSAGE: devices/microhomie1/led8/direction --> 30, True
direction_msg led8
MQTT UNSUBSCRIBE: devices/microhomie1/led8/direction
MQTT SUBSCRIBE: devices/microhomie1/led9/power/set
MQTT MESSAGE: devices/microhomie1/led9/power --> false, True
MQTT UNSUBSCRIBE: devices/microhomie1/led9/power
CONNECTION HANDLER!
MQTT SUBSCRIBE: devices/microhomie1/$mpy
MQTT PUBLISH: devices/microhomie1/$homie --> b'4.0.0'
MQTT SUBSCRIBE: devices/microhomie1/led0/power
MQTT SUBSCRIBE: devices/microhomie1/led0/direction
MQTT SUBSCRIBE: devices/microhomie1/led1/power
MQTT SUBSCRIBE: devices/microhomie1/led1/direction
MQTT SUBSCRIBE: devices/microhomie1/led2/power
MQTT SUBSCRIBE: devices/microhomie1/led2/direction
MQTT SUBSCRIBE: devices/microhomie1/led3/power
MQTT SUBSCRIBE: devices/microhomie1/led3/direction
MQTT SUBSCRIBE: devices/microhomie1/led4/power
MQTT SUBSCRIBE: devices/microhomie1/led4/direction
MQTT SUBSCRIBE: devices/microhomie1/led5/power
MQTT SUBSCRIBE: devices/microhomie1/led5/direction
MQTT SUBSCRIBE: devices/microhomie1/led6/power
MQTT SUBSCRIBE: devices/microhomie1/led6/direction
MQTT SUBSCRIBE: devices/microhomie1/led7/power
MQTT SUBSCRIBE: devices/microhomie1/led7/direction
MQTT SUBSCRIBE: devices/microhomie1/led8/power
MQTT SUBSCRIBE: devices/microhomie1/led8/direction
MQTT SUBSCRIBE: devices/microhomie1/led9/power
MQTT SUBSCRIBE: devices/microhomie1/led9/direction
MQTT SUBSCRIBE: devices/microhomie1/led10/power
MQTT SUBSCRIBE: devices/microhomie1/led10/direction
MQTT SUBSCRIBE: devices/microhomie1/led11/power
MQTT SUBSCRIBE: devices/microhomie1/led11/direction
MQTT PUBLISH: devices/microhomie1/$name --> b'microhomie1'
CONNECTION HANDLER!
MQTT SUBSCRIBE: devices/microhomie1/$mpy
MQTT PUBLISH: devices/microhomie1/$homie --> b'4.0.0'
MQTT SUBSCRIBE: devices/microhomie1/led0/power
MQTT SUBSCRIBE: devices/microhomie1/led0/direction
MQTT SUBSCRIBE: devices/microhomie1/led1/power
MQTT SUBSCRIBE: devices/microhomie1/led1/direction
MQTT SUBSCRIBE: devices/microhomie1/led2/power
MQTT SUBSCRIBE: devices/microhomie1/led2/direction
MQTT SUBSCRIBE: devices/microhomie1/led3/power
MQTT SUBSCRIBE: devices/microhomie1/led3/direction
MQTT SUBSCRIBE: devices/microhomie1/led4/power
MQTT SUBSCRIBE: devices/microhomie1/led4/direction
MQTT SUBSCRIBE: devices/microhomie1/led5/power
MQTT SUBSCRIBE: devices/microhomie1/led5/direction
MQTT SUBSCRIBE: devices/microhomie1/led6/power
MQTT SUBSCRIBE: devices/microhomie1/led6/direction
MQTT SUBSCRIBE: devices/microhomie1/led7/power
MQTT SUBSCRIBE: devices/microhomie1/led7/direction
MQTT SUBSCRIBE: devices/microhomie1/led8/power
MQTT SUBSCRIBE: devices/microhomie1/led8/direction
MQTT SUBSCRIBE: devices/microhomie1/led9/power
MQTT SUBSCRIBE: devices/microhomie1/led9/direction
MQTT SUBSCRIBE: devices/microhomie1/led10/power
MQTT SUBSCRIBE: devices/microhomie1/led10/direction
MQTT SUBSCRIBE: devices/microhomie1/led11/power
MQTT SUBSCRIBE: devices/microhomie1/led11/direction
MQTT PUBLISH: devices/microhomie1/$name --> b'microhomie1'
CONNECTION HANDLER!

It then keeps looping...

I'm using version 3.0.2 and MicroPython version v1.14.

Thanks,
Axel

reconnect behavior

Hi---thanks for this project it's been really helped me 🥰

I'm using microhomie on an ESP8266 with microhomie v3.0.2. Sometimes my WiFi goes down. Currently when this happens my device goes offline permanently until I manually reset it. I'm hoping to change this so the device periodically tries to reconnect until it finds WiFi again. As a micropython novice I'm struggling a bit to think about how to best do this.

My first thought would be to use a watchdog that I feed when the connection is good, but I see that you explicitly create a wdt task.

Any advice would be appreciated. Thanks again, I'm really loving homie and micropython.

Device.py raises error for Linux device ID

At the line:

self.device_id = getattr(settings, "DEVICE_ID", get_unique_id())

the function get_unique_id() is evaluated prior to the attribute being searched, the standard nature of Python. This function raises an error if running on a Linux platform that prevents further execution with the ironic message to "...Provide the DEVICE_ID option in your settings.py." Even if this value exists in the settings.py (or any other equivalent object), it'll never be used because of the raised error.

Resolution: possibly using a lazy equivalency such as self.device_id = getattr(settings, "DEVICE_ID", None) or get_unique_id() since False, 0, and None or invalid device IDs anyway?

WDT is Awesome, but...

It can be frustrating during development etc. So I added a setting and code to bypass WDT during testing/debugging.

settings.py
DEBUG = False

device.py
class HomieDevice:
def init(self, settings):
self.debug = getattr(settings, "DEBUG", False)
...
...
if self._first_start is True:
await self.publish_properties()
self._first_start = False

        # activate WDT
        if self.debug is not True:
            loop = get_event_loop()
            loop.create_task(self.wdt())

        # start coros waiting for ready state
        _EVENT.set()
        await sleep_ms(MAIN_DELAY)
        _EVENT.clear()

    await self.publish(DEVICE_STATE, STATE_READY)

main.py
homie = HomieDevice(settings)
homie.debug = True

ESP32 import errors

Hello.
I'm struggling a bit trying to make samples work with newest micropython firmware. But it seems to have some problem, that isn't obvious to me. I'm not sure if that's library issue or micropython issue though. FS structure attached.
structure

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<string>", line 2, in <module>
ImportError: cannot import name HomieDevice

$name is always (null)

Hi,
i need help!

Version 3.0.2.

§name is always (null).

Cant connect to openHAB cause:
java.lang.Exception: Did not receive mandatory topic value: homie/a8f1fd00/$name

Did a review to the homie source code, but I could not find any failure.

Need help.

Thank you!

My settings.py:

WIFI_SSID = "XXXXXXX"

WIFI_PASSWORD = "XXXXXXX"

MQTT_BROKER = "xxx.xxx.xx.xxx"

DEVICE_ID = get_unique_id()

DEVICE_NAME = "mydevice"

DEVICE_STATS_INTERVAL = 50

from homie.constants import EXT_MPY
EXTENSIONS = [EXT_MPY]

MQTT Message:

homie/a8f1fd00/$homie 4.0.0
homie/a8f1fd00/$name (null)
homie/a8f1fd00/$state init
homie/a8f1fd00/$implementation esp8266
homie/a8f1fd00/$nodes led
homie/a8f1fd00/led/$name Onboard LED
homie/a8f1fd00/led/$type LED
homie/a8f1fd00/led/$properties power
homie/a8f1fd00/led/power/$name Power
homie/a8f1fd00/led/power/$datatype boolean
homie/a8f1fd00/led/power/$settable true
homie/a8f1fd00/$extensions (null)
homie/a8f1fd00/$state ready
homie/a8f1fd00/led/power false

Next branch

How comfortable are you with the "next" branch? Are there any bugs that you have encountered that needs to be worked on?
Also, are you building it against Micropython v1.12 or the source master branch?

Thanks,
Rick

Looking to Support this project

Hey guys, for a while now I've been mataining homie for esp8266 C++ code base. I've been thinking alot about time management and the issues I've been facing with the lack of tim I have now that I have a full time job (fresh form uni). With the little time I get, I think I would achieve more spending that time on the micropython platform (a higher level language) than C++. Looking to talk to see how I can help and if help is needed. I feel bad for the fokes over on the C++ platform. But I'm still committed to homie (just in a different way)!

Looking to Support this project

Hey guys, for a while now I've been mataining homie for esp8266 C++ code base. I've been thinking alot about time management and the issues I've been facing with the lack of tim I have now that I have a full time job (fresh form uni). With the little time I get, I think I would achieve more spending that time on the micropython platform (a higher level language) than C++. Looking to talk to see how I can help and if help is needed. I feel bad for the fokes over on the C++ platform. But I'm still committed to homie (just in a different way)!

Relais Node not being restored

The 1.0.0 (asyncio version) Relay node is not being restored after restarting the esp8266. In my case I have two relays relay_0 and relay_1 and on restart neither one is restored.
self.relay_property = HomieNodeProperty(
id="power",
name="Relay",
settable=True,
retained=True,
datatype="bool",
default=TRUE,
restore=True,
range=2,
)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.