-
-
Notifications
You must be signed in to change notification settings - Fork 83
Enable HA REST API proxy #142
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
base: main
Are you sure you want to change the base?
Conversation
@thecem @goebelmeier i think this I a good improvement. I am using a bearer token currently and with this change I could just skip that and rely on the internal api proxy. |
@wlcrs pls test in nightly |
already tested it @thecem |
@wlcrs do you know how to access these env vars within the evcc config? with that I do not get it work |
This is a main topic since the variable must be accessible within evcc. Don’t know if we have to add those var in evcc. |
currently its not working within the evcc.yaml that this variable gets resolved:
|
Adding support to reading/using this environment variable in/by evcc is the next step. So for the moment we have nothing to test against. @thecem this is a bit of a chicken-or-egg situation. I thought that first introducing this PR was the most straightforward, as it has no other impact whatsoever. Would you consider merging it if I only introduce the change to evcc-nightly for now? |
? It is implemented, but in the right place. |
@wlcrs we just need solutions on both sides. makes no sense to just integrate it here if there is no solution on evcc side itself. so we need to find a solution there, create a PR there and if this is done we can finally merge in the PR here. I guess I found the solution, on evcc side in setup.go line 88 we need to call: I tested it, was not successful. as far as I understand, viper is not replacing the vars it finds in the config.yaml. it just reads in the config.yaml and provides all the data found there into the go application. this article also describes that: https://stackoverflow.com/questions/52756532/go-viper-yaml-values-environment-variables-override in evcc dev chat I raised the question aswell: https://evccgroup.slack.com/archives/C01321PUJAD/p1741625264523309 |
I've written up a proposal on how we can use the HA REST API proxy enabled by this PR here: evcc-io/evcc#19665 Any feedback would be appreciated, as I want to prevent to put work into coding features that the EVCC-team would not consider to merge. |
draft PR: evcc-io/evcc#19687 andi declined this PR due to sundown of yaml config, so we need to find a solution in ui config to use env vars... -> evcc-io/evcc#19687 (comment) |
By adding this line to the add-on configuration, we enable the internal proxy that exposes the HA REST API to the add-on.
In practice, this makes it possible to read the state of HA sensor via the
http://supervisor/core/api/
endpoint, using the authentication token supplied in theSUPERVISOR_TOKEN
environment variable (cfr. HA docs).This effectively allows us to more easily integrate EVCC with HA, as you will no longer need to create long-lived tokens in HA to be able to read sensor data from it. For example: we could easily enable the use of HA entities in the Configuration UI.
Demo:
(jq and curl were installed into the add-on container for testing/demonstration purposes)