Closed jaykayone closed 5 months ago
Missing log of actual problem. Should not be necessary if Enphase sends a redirect header.
Yes it follows the redirect according to the trace.
but there is now data shown as you seen in the log, whNow is 205 but the ui shows no data and the log in the UI says: pv 1 power: jq: empty result
Please run with --log-trace
i added the log in trace mode in the description
Sorry, I meant:
Please run with
--log-headers
pi@raspberrypi:~ $ evcc meter --log-headers
[main ] INFO 2024/05/07 21:25:20 evcc 0.126.2
[main ] INFO 2024/05/07 21:25:20 using config file: /etc/evcc.yaml
[db ] INFO 2024/05/07 21:25:20 using sqlite database: /home/pi/.evcc/evcc.db
[db ] TRACE 2024/05/07 21:25:20 SELECT count(*) FROM sqlite_master WHERE type='table' AND name="settings" -1 <nil>
[db ] TRACE 2024/05/07 21:25:20 SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "settings" AND sql IS NOT NULL order by type = "table" desc 1 <nil>
[db ] TRACE 2024/05/07 21:25:20 SELECT * FROM `settings` LIMIT 1 -1 <nil>
[db ] TRACE 2024/05/07 21:25:20 SELECT * FROM `settings` 1 <nil>
[db ] TRACE 2024/05/07 21:25:20 SELECT count(*) FROM sqlite_master WHERE type='table' AND name="devices" -1 <nil>
[db ] TRACE 2024/05/07 21:25:20 SELECT count(*) FROM sqlite_master WHERE type='table' AND name="device_details" -1 <nil>
[db ] TRACE 2024/05/07 21:25:20 SELECT count(*) FROM sqlite_master WHERE type='table' AND name="configs" -1 <nil>
[db ] TRACE 2024/05/07 21:25:20 SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "configs" AND sql IS NOT NULL order by type = "table" desc 1 <nil>
[db ] TRACE 2024/05/07 21:25:20 SELECT * FROM `configs` LIMIT 1 -1 <nil>
[db ] TRACE 2024/05/07 21:25:20 SELECT count(*) FROM sqlite_master WHERE type='table' AND name="config_details" -1 <nil>
[db ] TRACE 2024/05/07 21:25:20 SELECT sql FROM sqlite_master WHERE type IN ("table","index") AND tbl_name = "config_details" AND sql IS NOT NULL order by type = "table" desc 2 <nil>
[db ] TRACE 2024/05/07 21:25:20 SELECT * FROM `config_details` LIMIT 1 -1 <nil>
[db ] TRACE 2024/05/07 21:25:20 SELECT count(*) FROM sqlite_master WHERE type = "table" AND tbl_name = "config_details" AND (sql LIKE "%CONSTRAINT ""fk_configs_details"" %" OR sql LIKE "%CONSTRAINT fk_configs_details %" OR sql LIKE "%CONSTRAINT `fk_configs_details`%" OR sql LIKE "%CONSTRAINT [fk_configs_details]%" OR sql LIKE "%CONSTRAINT fk_configs_details %") -1 <nil>
[db ] TRACE 2024/05/07 21:25:20 SELECT count(*) FROM sqlite_master WHERE type = "index" AND tbl_name = "config_details" AND name = "idx_unique" -1 <nil>
[db ] TRACE 2024/05/07 21:25:20 SELECT count(*) FROM sqlite_master WHERE type = "table" AND tbl_name = "config_details" AND (sql LIKE "%CONSTRAINT ""fk_devices_details"" %" OR sql LIKE "%CONSTRAINT fk_devices_details %" OR sql LIKE "%CONSTRAINT `fk_devices_details`%" OR sql LIKE "%CONSTRAINT [fk_devices_details]%" OR sql LIKE "%CONSTRAINT fk_devices_details %") -1 <nil>
[db ] TRACE 2024/05/07 21:25:20 SELECT count(*) FROM sqlite_master WHERE type = "table" AND tbl_name = "config_details" AND (sql LIKE "%""device_id"" %" OR sql LIKE "%device_id %" OR sql LIKE "%`device_id`%" OR sql LIKE "%[device_id]%" OR sql LIKE "% device_id %") -1 <nil>
[db ] TRACE 2024/05/07 21:25:20 SELECT * FROM `configs` WHERE `configs`.`class` = 2 ORDER BY id 0 <nil>
[http ] TRACE 2024/05/07 21:25:20 GET http://envoy.local/production.json
[http ] TRACE 2024/05/07 21:25:21
GET /production.json HTTP/1.1
Host: envoy.local
User-Agent: Go-http-client/1.1
Authorization: Bearer xxx Accept-Encoding: gzip
HTTP/1.1 301 Moved Permanently
Content-Length: 175
Connection: keep-alive
Content-Type: text/html
Date: Tue, 07 May 2024 19:25:47 GMT
Location: https://envoy.local/production.json
Server: openresty/1.17.8.1
<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>openresty/1.17.8.1</center>
</body>
</html>
[http ] TRACE 2024/05/07 21:25:21 GET https://envoy.local/production.json
[http ] TRACE 2024/05/07 21:25:23
GET /production.json HTTP/1.1
Host: envoy.local
User-Agent: Go-http-client/1.1
Authorization: Bearer xxx
Referer: http://envoy.local/production.json
Accept-Encoding: gzip
HTTP/1.1 200 OK
Transfer-Encoding: chunked
Cache-Control: no-cache
Connection: keep-alive
Content-Type: application/json
Date: Tue, 07 May 2024 19:25:49 GMT
Expires: 1
Pragma: no-cache
Server: openresty/1.17.8.1
Set-Cookie: sessionId=TAO9egg7mmJjtB7uzTnKbEkmWOzZc0pc; Secure; HttpOnly; path=/
Strict-Transport-Security: max-age=63072000; includeSubdomains
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
c9
{"production":[{"type":"inverters","activeCount":19,"readingTime":1715108566,"wNow":2,"whLifetime":461493}],"storage":[{"type":"acb","activeCount":0,"readingTime":0,"wNow":0,"whNow":0,"state":"idle"}]}
0
[http ] TRACE 2024/05/07 21:25:23 GET http://envoy.local/production.json
[http ] TRACE 2024/05/07 21:25:23
GET /production.json HTTP/1.1
Host: envoy.local
User-Agent: Go-http-client/1.1
Authorization: Bearer xxx
Accept-Encoding: gzip
HTTP/1.1 301 Moved Permanently
Content-Length: 175
Connection: keep-alive
Content-Type: text/html
Date: Tue, 07 May 2024 19:25:49 GMT
Location: https://envoy.local/production.json
Server: openresty/1.17.8.1
<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>openresty/1.17.8.1</center>
</body>
</html>
[http ] TRACE 2024/05/07 21:25:23 GET https://envoy.local/production.json
[http ] TRACE 2024/05/07 21:25:26
GET /production.json HTTP/1.1
Host: envoy.local
User-Agent: Go-http-client/1.1
Authorization: Bearer xxx
Referer: http://envoy.local/production.json
Accept-Encoding: gzip
HTTP/1.1 200 OK
Transfer-Encoding: chunked
Cache-Control: no-cache
Connection: keep-alive
Content-Type: application/json
Date: Tue, 07 May 2024 19:25:52 GMT
Expires: 1
Pragma: no-cache
Server: openresty/1.17.8.1
Set-Cookie: sessionId=TAO9egg7mmJjtB7uzTnKbEkmWOzZc0pc; Secure; HttpOnly; path=/
Strict-Transport-Security: max-age=63072000; includeSubdomains
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
c9
{"production":[{"type":"inverters","activeCount":19,"readingTime":1715108566,"wNow":2,"whLifetime":461493}],"storage":[{"type":"acb","activeCount":0,"readingTime":0,"wNow":0,"whNow":0,"state":"idle"}]}
0
Power: jq: empty result
Energy: jq: empty result
Redirect works as expected. Only there is no .measurementType == "production"
. Seems the api has changed, too.
Workaround for now is to use:
meters:
Feel free to add a new template. V2 api is not compatible.
Hi,
maybe not directly related but I am getting an
Mai 26 10:24:26 raspi-evcc evcc[6188]: [site ] ERROR 2024/05/26 10:24:26 grid meter: unexpected status: 401 (Unauthorized)
some hours after configuration. I added the meter (grid & pv) in evcc.yaml and also tried configuration via UI (..and deleted the yaml configuration part).
After putting a new token from enphase data are retrieved but again after some hours I am getting this error..
Any hints or workarounds? Thank you!
log-headers:
evcc --log-headers [main ] INFO 2024/05/26 10:30:47 evcc 0.126.4 [main ] INFO 2024/05/26 10:30:47 using config file: /etc/evcc.yaml [main ] INFO 2024/05/26 10:30:47 starting ui and api at :7070 [db ] INFO 2024/05/26 10:30:47 using sqlite database: /var/lib/evcc/evcc.db [proxy-502] DEBUG 2024/05/26 10:30:47 modbus proxy for 192.168.178.28:502 listening at :502 [lp-1 ] DEBUG 2024/05/26 10:30:48 charge total import: 4325.000kWh [site ] WARN 2024/05/26 10:30:48 battery configured but residualPower is missing or <= 0 (add residualPower: 100 to site), see https://docs.evcc.io/en/docs/reference/configuration/site#residualpower [site ] INFO 2024/05/26 10:30:48 site config: [site ] INFO 2024/05/26 10:30:48 meters: grid ✓ pv ✓ battery ✓ [site ] INFO 2024/05/26 10:30:48 grid: power ✓ energy ✗ currents ✗ [site ] INFO 2024/05/26 10:30:48 pv 1: power ✓ energy ✓ currents ✗ [site ] INFO 2024/05/26 10:30:48 battery 1: power ✓ energy ✗ currents ✗ soc ✓ capacity ✓ [site ] INFO 2024/05/26 10:30:48 vehicles: [site ] INFO 2024/05/26 10:30:48 vehicle 1: range ✓ finish ✓ status ✓ climate ✗ wakeup ✓ [site ] INFO 2024/05/26 10:30:48 vehicle 2: range ✓ finish ✗ status ✓ climate ✗ wakeup ✓ [lp-1 ] INFO 2024/05/26 10:30:48 loadpoint 1: [lp-1 ] INFO 2024/05/26 10:30:48 mode: minpv [lp-1 ] INFO 2024/05/26 10:30:48 charger: power ✓ energy ✓ currents ✓ phases ✗ wakeup ✗ [lp-1 ] INFO 2024/05/26 10:30:48 meters: charge ✓ [lp-1 ] INFO 2024/05/26 10:30:48 charge: power ✓ energy ✓ currents ✓ [site ] DEBUG 2024/05/26 10:30:48 set buffer soc: 50 [site ] DEBUG 2024/05/26 10:30:48 set buffer start soc: 60 [site ] DEBUG 2024/05/26 10:30:48 set priority soc: 20 [lp-1 ] DEBUG 2024/05/26 10:30:48 phase timer inactive [lp-1 ] DEBUG 2024/05/26 10:30:48 pv timer inactive [lp-1 ] DEBUG 2024/05/26 10:30:48 max charge current: 6A [site ] DEBUG 2024/05/26 10:30:48 ---- [lp-1 ] DEBUG 2024/05/26 10:30:48 charge power: 7600W [lp-1 ] DEBUG 2024/05/26 10:30:48 charge currents: [11 10.9 11]A [site ] ERROR 2024/05/26 10:30:49 pv 1 power: unexpected status: 401 (Unauthorized) [site ] DEBUG 2024/05/26 10:30:49 pv power: 0W [site ] DEBUG 2024/05/26 10:30:49 battery soc: 77% [site ] DEBUG 2024/05/26 10:30:49 battery power: 1337W [site ] ERROR 2024/05/26 10:30:50 grid meter: unexpected status: 401 (Unauthorized)
evcc meter --log-headersrs
[main ] INFO 2024/05/26 10:33:12 evcc 0.126.4 [main ] INFO 2024/05/26 10:33:12 using config file: /etc/evcc.yaml [db ] INFO 2024/05/26 10:33:12 using sqlite database: /var/lib/evcc/evcc.db db:1 ... Power: unexpected status: 401 (Unauthorized)
db:3 ... Power: unexpected status: 401 (Unauthorized) Energy: unexpected status: 401 (Unauthorized)
db:4 .... Power: -3816W Soc: 77% Capacity: 16.5kWh
Maybe the token expires. Impossible to say without logfile and api documentation.
Maybe the token expires. Impossible to say without logfile and api documentation.
yes, semms to be the case... haven't found any documentation how/where to put credentials so that the token could get renewed by the system. If you are owner and self-installer... token it seems token ist valid only for 12 hrs ... I am a self-installer
NOTE: Tokens are valid for a finite time. This is to ensure safety and you must generate a new token upon expiry.
• If the user is a system owner, the token is valid for 1 year. • If the user is an installer, the token is valid for 12 hours.
.... you see in the upper part the log with error 401 and in the second part the values correctly... inbetween I renewed manually the token from enphase....
so, it would be really nice if someone could help implementing the automatic renewel of the token.
@BeneWilh Will start using evcc in combination with enphase next week - when new car is in place.
But:
I use the local enphase-API for some data-analytics. The token was valid for quite a long time (+/- 8 month). Since April 2024 the token expires randomly every 6-8 weeks - last expiration yesterday evening at 19:53. At 23:15 the gateway rebooted automatically. A newly generated token does not work today.
The firmware on the gateway is "D7.6.358". What's yours?
Ask Enphase for documentation
As an installer you could also generate user token. Goto https://entrez.enphaseenergy.com/login Multiple ways to create tokens of installer and user check https://enphase.com/download/accessing-iq-gateway-local-apis-or-local-ui-token-based-authentication
Check token in jwt.io and it will tell you expire date.
I have the same problem with token have a lifetime only 12h00 si your account enphase is "Installer".
So to avoid this problem, it would be use an api call with enphase account.
Is EVCC has this type of access method available for enphase ?
Found some time to investigate: The certificate was invalid + the local self signed certificate (signed by Enphase) was recreated yesterday evening and did not match with the certificate used by the requesting script. So all okay now - will see how evcc integration will work next week.
Describe the bug
Your enphase template uses the http protocol: templates/definition/meter/enphase.yaml
I have enphase working locally and it only works in https, http sends a "301 moved permanently" code.
Could you add a parameter to specify the protocol to use so that it stays does not break things for people on other versions of the API ?
Steps to reproduce
Configuration details
Log details
What type of operating system are you running?
Linux
Version
v0.126.2