jalmeroth / homie-python

A Python-implementation of the homie v2 convention.
https://github.com/marvinroger/homie
54 stars 15 forks source link

Where do we want to go from here? #38

Open jalmeroth opened 6 years ago

jalmeroth commented 6 years ago

Hi guys,

I would like to open a discussion about your use-cases for this project and where to go from here.

My initial need to kick-off this project was to have a dedicated Raspberry Pi mimicking a Homie-ESP8266 device. Having worked with the homie-esp8266 implementation at that time I started to port its functionality to Python.

Unfortunately, the current dev-branch is neither very pythonic nor as compatible to homie-esp8266 as it was in the beginning. I am struggling between focusing to comply to the homie-convention while being pythonic or continuing to try adopting the functionality/feature-set of homie-esp8266.

Whats your opinion about this? I would like to hear some feedback.

Cheers, Jan

bodiroga commented 6 years ago

Hi @jalmeroth!

Nice to see some movements around the project, the whole Homie convention deserves more attention from the IoT community! :+1:

My main interest around this library is to use it when building gateways for non IP protocols (bluetooth, modbus, custom scripts,...) and for quick testing. I'm also interested in moving forward the development of a Homie binding for openHAB, but that's a different story because openHAB uses Java.

I totally agree with you about the dilemma between staying close to the homie-esp8266 project or being more pythonic. My personal opinion is that we should move more towards the pythonic choice, because, at the end, what matters is to comply to the Homie convention, not to follow one of the implementations. And those "advertise" and "setProperty().send()" are weird from pythons perspective. Anyway, I'm not by all means a python expert, so probably my pythonic implementation of the library would be worst than the one resulting from mimicking the esp8266 implementation :rofl:

Another important point is which Homie convention should the library support, now that Homie V3 is the latest official one, because even if 3.0 is the last one, it's not supported by any implementation or controller :cry: I think that first we should focus on making the master branch comply the Homie 2.0.1 version (https://github.com/homieiot/convention/releases/tag/v2.0.1), but that's again my personal opinion.

Many thanks again for your work Jan and best regards,

Aitor

PS: pinging @psyciknz and @fabiosoft to hear their opinion :wink:

psyciknz commented 6 years ago

I just liked the project as it made a consistent messaging platform. Yes I could have writing consistent types of mqtt messages in my raspberry pi devices, but this was available.

In terms of future, does it need one? Does it need to be expanded? Is it not fulfilling the use cases it was designed for?

I can’t think at the moment where the project might go, but then it’s doing everything I currently need.

timbms commented 5 years ago

Hi guys,

openhab has been updated to version 2.4 which features a new binding for mqtt compatible with homie. openhab would then be able to detect devices automatically. I was trying to switch my mqtt publisher to homie-python.

I would like to have an example for a python script that publishes the result of multiple sensors. Could you add such an example?

Regards

psyciknz commented 5 years ago

I did have a bluetooth one that would post a sensor value for each mac address. But it seemed to go a bit strange in the mqtt server and add 1000's of topics after a while I've added my homie scripts: https://github.com/psyciknz/OpenHAB-Scripts

There's a simple temp sensor there, a bluetooth one, and a fan control. That may also pull temp. They all need config file but I just added them quickly so haven't got a default.

BTW, I was thinking of looking into this myself also. That new MQTT version for openhab is an absolute punish and it seemed much easier to start looking in to homie v3.

bodiroga commented 5 years ago

Hi @timbms and @psyciknz!

I have already submitted a PR that makes homie-python compatible with Homie v3, which (in theory) should works flawlessly with openHAB 2.4. Here you have a link to the pull request and a link to the forked repository. You can install it very easily cloning the project (git clone https://github.com/bodiroga/homie-python.git), moving to the new folder (cd homie-python) and executing the installation command (sudo python3 setup.py install). You can find some examples in the "examples" folder (https://github.com/bodiroga/homie-python/tree/homie-v3.0.0/examples).

It would be awesome if you could test the new version of the library and report back any suggestion or issue that you found! :+1:

Best regards,

Aitor

davidgraeff commented 5 years ago

Any progress on the Homie 3 front?

mjcumming commented 5 years ago

I am working on a python - homie 3.0 module. Mostly written but would like to have the code reviewed to get feedback.

https://github.com/mjcumming/Homie

An example switch is below. Very simple to use.

` import time

from device_dimmer import Device_Dimmer

mqtt_settings = { 'MQTT_BROKER' : 'XXXXX', 'MQTT_PORT' : 1883, }

class My_Dimmer(Device_Dimmer):

def set_value(self,topic,payload):
    print('Received MQTT message to set the dimmer to {}. Must replace this method'.format(payload))

try:

dimmer = My_Dimmer(name = 'Test Dimmer',mqtt_settings=mqtt_settings)

while True:
    time.sleep(5)
    dimmer.update(50)
    time.sleep(5)
    dimmer.update(100)

except (KeyboardInterrupt, SystemExit): print("Quitting.")

`

psyciknz commented 5 years ago

Sounds like the project might need to migrate to one of the others. I'm trying to use it for my paradoxip150 module. I'd prefer a 3.0 implementation, and to work in with how I've currently been set up, I'd prefer to load the config from a json object rather than a file.

@mjcumming I like that you have contact items, but you configurations looks a little light (only mqtt server)

mjcumming commented 5 years ago

Sounds like the project might need to migrate to one of the others. I'm trying to use it for my paradoxip150 module. I'd prefer a 3.0 implementation, and to work in with how I've currently been set up, I'd prefer to load the config from a json object rather than a file. @mjcumming I like that you have contact items, but you configurations looks a little light (only mqtt server)

It is a WIP. The example shows a limited use. The following options can be specified. Is there anything else missing?

MQTT_SETTINGS = {
    'MQTT_BROKER' : None,
    'MQTT_PORT' : 1883,
    'MQTT_USERNAME' : None,
    'MQTT_PASSWORD' : None,
    'MQTT_KEEPALIVE' : 60,
    'MQTT_CLIENT_ID' : None,
}

HOMIE_SETTINGS = {
    'version' : '3.0.1',
    'topic' : 'homie', 
    'fw_name' : 'python',
    'fw_version' : sys.version, 
    'update_interval' : 60, 
    'implementation' : sys.platform, 
}