Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.

HassOS addon #64

Open
ohmer1 opened this issue Feb 14, 2021 · 6 comments
Open

HassOS addon #64

ohmer1 opened this issue Feb 14, 2021 · 6 comments

Comments

@ohmer1
Copy link

ohmer1 commented Feb 14, 2021

Is there an HassOS addon to install and use the mqtt daemon on HassOS?

@arsenicks
Copy link

I started working on that yesterday, I've never done an hass addon so don't put too much hope in that, I'll have to learn. Will update once I get it working and will try to see if there's anything @titilambert can do to make this easier to use but AFAIK the hass add-on code will have to reside on a different repository, so it should be all fine and should not require any change here.

@arsenicks
Copy link

It's easier than I first thought, bad news tho.. The schema of configuration doesn't allow noested object and I'm unable to generate the config file like the python expect it..

options": {
    "timeout": "30",
    "frequency": "8640",
    "accounts":{
        "username": "USERNAME@EMAIL",
        "password": "PASSWORD",
        "contracts":{
            "id": "CONTRACT_ID"
        }

the problem is with the contracts id which is nested under accounts.. I'm trying to see if I can pass env var to the container and just don't use the config file.. If anyone have any experience on that let me know I can use some help!

@bobzer
Copy link

bobzer commented Nov 14, 2021

Maybe we could have an array instead ?
like this :

options": {
    "timeout": "30",
    "frequency": "8640",
    "accounts":{
        "username": "USERNAME@EMAIL",
        "password": "PASSWORD",
        "contracts_id": [
            "CONTRACT_ID"
        ]

@arsenicks
Copy link

Maybe we could have an array instead ? like this :

options": {
    "timeout": "30",
    "frequency": "8640",
    "accounts":{
        "username": "USERNAME@EMAIL",
        "password": "PASSWORD",
        "contracts_id": [
            "CONTRACT_ID"
        ]

Good idea but I was unable to make this work.

@titilambert would you be interested to make some adjustment to the docker images ?

1- As it is right now there's no version tag on images, which force me to use "master" as a version of the addon, the way the addons work in HA force the version of the addon to be the same as the image we get. It would be great to have a tag matching pyhydroquebec version on the image
2- I think it would be pretty simple to build another image to make things easier for hass addon, would you consider this options if required ?

I'll try to understand better how addons are working but just wanted to see what are the options concerning the image. Thanks!

@arsenicks
Copy link

arsenicks commented Nov 15, 2021

Hi guy's, I got something working...

here's the repo if you want to test it: https://github.com/arsenicks/pyhydroquebec-hass-addons

There's plenty of room for improvement and cleaner code but it should work as is.

Todo:

  • Find a way to use only ENV vars and get rid of the config file
  • Improve entrypoint.sh to test if required vars are set
  • Try to add some logic, if hq user/pass are set but not contract number, try to print contract in log
  • Rebuild image using hass add-on tooling(https://github.com/home-assistant/builder) and better understand the whole image thing in hass add-on
  • Cleanup of name, repos url and other stuff.

Let me know your feeling, suggestions, ideas.

@arsenicks
Copy link

For people interested/subscribed to this issue, I just released the 0.1 version of the addon, please test it and report issue on the project!

From the list of todo in my last comment I just completed "Rebuild image using hass add-on tooling(https://github.com/home-assistant/builder) and better understand the whole image thing in hass add-on"

Here's the repo if you want to test it: https://github.com/arsenicks/pyhydroquebec-hass-addons

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants