zepiaf / hydroqc

Hydro Quebec API wrapper.
MIT License
9 stars 4 forks source link

[Discussion] how to integrate this project in your setup #29

Open zepiaf opened 2 years ago

zepiaf commented 2 years ago

How would you integrate it in HassOS ?

I tried using AppDaemon 4 Add-on without luck, it looks like that only works with official python projects from https://pypi.org/

Maybe I could figure out how they package their projects and fit your project somehow?

Otherwise I could setup another VM with Python 3 on it and use MQTT Integration in HassOS but that would involve managing an extra machine just for that, I wish I could package everything in a single VM.

Thanks for your great work, I can't wait to use it!

Originally posted by @jchretien in https://github.com/zepiaf/hydroqc/issues/16#issuecomment-1012619791

zepiaf commented 2 years ago

Just re-adding comments:

@zepiaf commented Hey @jchretien, we're not there yet unfortunately. So far it would work from any host in the same network as your mqtt broker. If you can schedule mqtt.py tu run with the virtual env, it should work on windows, linux or a mac. If you don't know how we might be able to help you figure a script to that.

@clauderobi commented I am not familiar with HassOS nor Appdaemon but I would suspect that you are missing some packages that the project here needs. You may or may not be able to fix that. But if not, beside the extra VM route you mentioned, you could instead use a container that has python3 in it. And, if needed, add the needed packages. I would use a container based on Alpine to keep the size as little as possible; but python itself will add a lot....

zepiaf commented 2 years ago

Hassos is a linux flavor used with home assistant, it allows plugins in forms of docker images and has addons that allow running specific code.

As for @clauderobi said I concur : running in a small docker image is probably the cleanest way, even if it's not as a plugin for HassOS / home assistant.

My suggestion would be to install portainer as an addon and adding the container from there.

Creating a basic container should be in the TODO list for this project anyway as it simplifies deployment in any case (custom platform like @clauderobi or homeassistant for the rest of us)

I think that writing a simple Dockerfile should not prove difficult, however I have no idea how to get an image in a public registry that anyone can just fetch from docker.

mdallaire commented 2 years ago

The docker image and github actions to build it is actually something I wanted to do so I can easily run it in my k8s cluster. I was waiting on two things:

This would give us an image that automatically rebuild when a new version is released. I suggest using ghcr.io image registry instead of docker hub.

Until then I run the following in my shell to run mqtt.py every 15 minutes: while true; python3 mqtt.py; sleep 900; end this is for fish shell, the bash equivalent is this: while true; do python3 mqtt.py; sleep 900; done

Regarding the hassos addon, there is one that was built for pyhydroquebec https://github.com/arsenicks/pyhydroquebec-hass-addons it could be a good starting point to get one going for this project.

zepiaf commented 2 years ago

I'm wondering if @titilambert has heard of us and if he's interested in this. If you see the mention and want to give your opinion, you're most welcome to do so :)

zepiaf commented 2 years ago
  • some form of versioning (idealy semver), either git releases or tags that can trigger a docker image rebuild

This would give us an image that automatically rebuild when a new version is released. I suggest using ghcr.io image registry instead of docker hub.

I saw that gitlab offers some sort of registry. I'm all in for using tags / versions as well.

It's probable we can update docker on main branch update but at some point it will need some more "strict" PR review/merge and probably some test / beta / dev branches to avoid breaking everything when there are some changes.

The code is not quite settled as we're still figuring out a lot of stuff.

titilambert commented 2 years ago

Hello, I would love sync with you guys to get more power and create something really cool ! Do you want to call me ?

zepiaf commented 2 years ago

The easiest way I think would be to get some "live" channel like IRC / telegram / signal / or anything. I'm not active on any of these platforms anymore but I'm happy for us to pick one and have some more exchange on this :)

What do you guys think ?

mdallaire commented 2 years ago

I am on discord for the k8s@home and home-assistant servers, I could start a new server on discord if that is a platform that suit you.

titilambert commented 2 years ago

home assistant discord, good idea: https://discord.gg/c5DvZ4e

mdallaire commented 2 years ago

I was actually thinking of a separate one for thy HQ intgrations : https://discord.gg/uHYnEHA2