-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Homie mqtt protocoll integration #1
base: main
Are you sure you want to change the base?
Conversation
added program start with checks set to uid based method parameters. All renaming to human readable names is done in hc2mqtt
default is to expose values according to homie mqtt protocoll (https://homieiot.github.io/specification/#payloads) for auto-detection in smart home systems. ---- for backwards compatibility: ------- a) call hc2mqtt with --publish_as_json option to expose a full json to one MQTT value b) renaming of some parameters: define in config (see below) c) call with --mqtt_prefix "homeconnect/" ------------------------------------------------------ - --mqtt_prefix changed to "homie/" for autodetection in smart-home systems (see comment in homie specification) - renaming is done within config: Manually add a json entry "hc2mqtt": according to the updated README inside it. - start program is added by using the mqtt topic .../ActiveProgram
- added description for manually to add config json entry "hc2mqtt" for renaming - added reference to Homie Convention
There are a few things in regards to this PR. First homie is added, but it seems to be mainly focused on homie. The mqtt default topic is changed, and the shebang. Wouldn't it be better to have a -homie parameter or something like that, which prepares the use for homie? instead of the use a set of parameters? And does changing the shebang have implications on not homie users? Second: --log_debug is ugly imo. This should be --loglevel debug/info(default)/warning .... I already though that print should not be used, but logger should be used. But i thought it was a to big of a change to introduce with what i did. The use of different way of logging could be introduced later, but i thing the parameter should be changed. |
Thank you for your feedback. Changing of the shebang was not intended. I thought I reverted this... Didn't this commit synchronize? Regarding the debug option: I am completely open to any changes here. I don't have experience with best practices for logging and especially not which options python offers. PS: I won't have time for this in the next two to three weeks, so please don't be irrititated if my next message will take some time. I will definitly come back to this code! :) |
Ah, the shebang has been reverted indeed. I read that wrong. That debug should be changed, which later on it could get better logging. Now print is used, which should be replaced by logging imo. Thats something for the future. I created my PR hoping it would land in home assistant. Having one repository managing homie and home assistant is probably not very feasible. But i dont think home assistant will be integrated into this code. But it would be nice if homie is a choice, and not an obligation or a default. The default should be just mqtt... And yes, the config could do so much more then just smart devices :) Take your time :) |
I agree that the Homie integration (what is Homie?) should be optional, although I appreciate this implementation because with certain modifications, I was able to get everything I needed for my custom Raspberry-based home automation system, including dishwasher start and scheduling based on the cheapest hourly electricity pricing. |
Sorry for the even longer delay than I thought. But now I finally found some time :)
Yes, let's shift this for future and get the rest combined :)
My itention is very similar, but for openhab instead home assistant (on the other hand I read that they are quite similar / nearly the same? But I am not sure in how fare they are technically the same...). However, in openhab there is an MQTT binding which automatically can import the so-called homie-specifiation. (PS: I didn't know homie before, either, but stumbled over it when importing a cloud free open-source implementation of cleaning robots firmware ("valetudo") and was impressed that all features/properties were automatically found without any specific openhab AddOn for valetudo itself. So I thought: This is the easiest way to get this script into smart home systems without need for someone else, who knows how to program a specific add for e.g. openhab.)
I don't think that homie + home assistant exclude each other in this basic script. If anyone use it to create a add on for a specific smart-home implementation, he/she can use the appropriate options to choose how he/she wants to have it reported.
Ok, then I will include the option with base topic choosing here. To sum it up (Please add if I forgot something)
How do you both think about this? :) |
A little bit offtopic (is there a better way in github?): How do you get it to "manually" start your dishwasher when you filled it but then have a auto-start later on? I plan to do the same based on solar power production and thought maybe enabling the manual-remote-button on the machine can be used as a trigger in my smart home system to watch for solar power (or in your case cheap price). |
@nebkrid thats a lot of information :P. First you can skip that debug you are planning on. It has already been fixed in my latest release. As for homie and home assistant, they maybe not be that far apart, the implementation can be fastly different. I can agree on the way you want to implement the topics, but what are those $ signs exactly? And is this applicable for all devices? If i look at the documentation of the home connect api not every device has the same options. So if you implement the program topic, the program feature must be present. what do you mean with: |
json, mqtt and homie publishing can each individually enabled / disabled see changed README.md bugfixes - thanks to @JW5PX
Please have a look into the examples I added to the documentation. They don't interfere with each other. So if you try the commit I just pushed, as long as you enable the option
This is the only thing which makes the implementation to a "homie" one. If I would explain more than I already tried it would be actually a copy-paste from the documentation, which I linked in my last post. It is not very complicate, maybe takes 15 min to understand. You can also have a look into example No. 4 in the documentation I added (or the example at the homie overview weppage)
That's the main thing of my whole pull request: I generate the topics from the config file. Here the HC devices define there options in a JSON format which is read by the hc2mqtt script.
The current implementation of "MQTT" publishing in your/the original script from osresearch. Now it is the `"publish_as_json" option of my last commit (see example No. 1 in the readme file.) |
following PR from osresearch#26 (comment)
Default is to expose values according to [homie mqtt protocoll] {https://homieiot.github.io/specification} for auto-detection in smart home systems.
for backwards compatibility:
a) call hc2mqtt with --publish_as_json option to expose a full json to one MQTT value
b) renaming of some parameters: define in config (see above)
c) call with --mqtt_prefix "homeconnect/"