Skip to content
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

Add env vars support to options #349

Merged
merged 9 commits into from
Oct 13, 2024

Conversation

maslyankov
Copy link
Contributor

Added support of env vars for docker image

Copy link
Owner

@kellerza kellerza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you use env vars, how would you specify the inverters?

hass-addon-sunsynk-multi/README.md Show resolved Hide resolved
src/ha_addon_sunsynk_multi/options.py Outdated Show resolved Hide resolved
src/ha_addon_sunsynk_multi/options.py Outdated Show resolved Hide resolved
maslyankov and others added 2 commits October 11, 2024 13:00
Co-authored-by: Johann Kellerman <[email protected]>
Co-authored-by: Johann Kellerman <[email protected]>
@maslyankov
Copy link
Contributor Author

maslyankov commented Oct 11, 2024

If you use env vars, how would you specify the inverters?

Have not looked at this case. The idea behind was to pass MQTT config more easily when using Docker Compose with env vars. I will look into ways to pass inverter config as well but not sure how useful that would be.

edit: Maybe a good way would be to pass a json object/list in the env vars where lists are specified - inverters, sensors, etc. This would be rather easy to implement.
Will also add the standalone documentation.

@maslyankov
Copy link
Contributor Author

@kellerza Discussed changes have been implemented and functionality verified! Seems to work on my side. I also added documentation on this matter.

@kellerza kellerza merged commit d4c0f38 into kellerza:main Oct 13, 2024
3 of 4 checks passed
for inv in loads(os.getenv("INVERTERS", "[]"))
]
sensor_definitions: str = os.getenv("SENSOR_DEFINITIONS", "single-phase")
sensors: list[str] = loads(os.getenv("SENSORS", "[]"))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could potentially support simple comma separated strings here? split instead of loads

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but I think this is more consistent with other options. In my opinion it could be added as another way to input a list, but shouldn't replace the json format.

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

Successfully merging this pull request may close these issues.

2 participants