Add env vars support to options#349
Conversation
kellerza
left a comment
There was a problem hiding this comment.
If you use env vars, how would you specify the inverters?
Co-authored-by: Johann Kellerman <kellerza@gmail.com>
Co-authored-by: Johann Kellerman <kellerza@gmail.com>
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. |
5e980f6 to
3feb369
Compare
|
@kellerza Discussed changes have been implemented and functionality verified! Seems to work on my side. I also added documentation on this matter. |
| for inv in loads(os.getenv("INVERTERS", "[]")) | ||
| ] | ||
| sensor_definitions: str = os.getenv("SENSOR_DEFINITIONS", "single-phase") | ||
| sensors: list[str] = loads(os.getenv("SENSORS", "[]")) |
There was a problem hiding this comment.
We could potentially support simple comma separated strings here? split instead of loads
There was a problem hiding this comment.
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.
Added support of env vars for docker image