titilambert / pyhydroquebec

DEPRECATED - Get your consumption data from your HydroQuebec account (www.hydroquebec.com)
Apache License 2.0
94 stars 45 forks source link

HassOS addon #64

Open ohmer1 opened 3 years ago

ohmer1 commented 3 years ago

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

arsenicks commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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:

Let me know your feeling, suggestions, ideas.

arsenicks commented 2 years ago

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