mr-manuel / venus-os_dbus-enphase-envoy

This Venus OS driver gets the data from the Enphase Envoy-S and displays it as PV Inverter. It works for all phase combinations. Additionally it's possible to post the data to multiple MQTT topics to get more detailed informations/monitoring for the Enphase system and single inverters.
MIT License
15 stars 2 forks source link

HTTP 401 errors - owner token #6

Closed dmac001 closed 8 months ago

dmac001 commented 1 year ago

Hello,

This is a great project!!!

I'm at a bit of a loss here -- when running enphase-envoy code on Venus OS 3.10~38, RPi 3B+., the log file is showing 'Received HTTP status code 401'. The enphase-envoy code does not click through this warning.

On my Windows Chrome/Edge browsers, I can click-through the "Your connection is not private...", ERR_CERT_AUTHORITY_INVALID and the page redirects to the Enphase home https[Enphase IP]/home#overview. If I open https://10.10.0.239:443/production.json?details=1, I get a page of production json,

{"production":[{"type":"inverters","activeCount":15,"readingTime":0,"wNow":0,"whLifetime":798107},{"type":"eim","activeCount":1,"measurementType":"production","readingTime":1695043269,"wNow":-0.0,"whLifetime":1855744.91,"varhLeadLifetime":......  

Your dbus-enphse-envoy code is very close to working. Is there a way to ignore the 401 security warning and continue and add the proper https authentication?

Excerpt from log file,

2023-09-18 13:08:31.681029500 *** starting dbus-enphase-envoy ***
2023-09-18 13:08:34.497445500 ERROR:root:D7 firmware selected
2023-09-18 13:08:34.508175500 INFO:root:step: tokenManager
2023-09-18 13:08:34.508987500 INFO:root:--> token still empty
2023-09-18 13:08:34.510508500 INFO:root:EnphaseToken: Token still valid. Creation date 2023-09-18 12:56:48 UTC
2023-09-18 13:08:35.511982500 INFO:root:step: fetch_handler
2023-09-18 13:08:35.512477500 INFO:root:step: fetch_production_historic
2023-09-18 13:08:35.521729500 INFO:root:--> data_production_historic not yet ready
2023-09-18 13:08:35.528809500 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): 10.10.0.239:443
2023-09-18 13:08:36.207748500 DEBUG:urllib3.connectionpool:https://10.10.0.239:443 "GET /production.json?details=1 HTTP/1.1" 200 None
2023-09-18 13:08:36.219330500 INFO:root:--> fetch_handler() --> fetch_production_historic(): JSON data feched. Wait 3600 seconds for next run
2023-09-18 13:08:36.529936500 INFO:root:step: fetch_meter_stream
2023-09-18 13:08:36.530771500 INFO:root:--> data_meter_stream not yet ready
2023-09-18 13:08:36.542614500 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): 10.10.0.239:443
2023-09-18 13:08:36.828011500 DEBUG:urllib3.connectionpool:https://10.10.0.239:443 "GET /stream/meter HTTP/1.1" 401 555
2023-09-18 13:08:36.831502500 ERROR:root:--> fetch_meter_stream(): Received HTTP status code 401. Restarting the driver in 60 seconds.
2023-09-18 13:08:37.540739500 INFO:root:--> data_meter_stream not yet ready

Thank you, Don

mr-manuel commented 1 year ago

Hello,

the error ERROR:root:--> fetch_meter_stream(): Received HTTP status code 401. Restarting the driver in 60 seconds. has nothing to do with the self signed certificate. See HTTP status code 401.

Please read "💡 NOTE" in the README.md. Very likely your token has the owner user and not the installer one.

dmac001 commented 1 year ago

I understand, my token is owner. Since the readme references an 2023.06.06 update, I assumed this has been resolved by now, especially considering your recent beta updates.

The point I was trying to make was that I can click-through the 401 error on my desktop browser and view the production json.

I'll keep checking for future updates. Thank you.

mr-manuel commented 1 year ago

UPDATE (2023.06.06): The needed API /stream/meter will be available with the owner token after the release of a firmware update at the end of June. See Make "/stream/meter" available with "owner" token. After this happen I release the next stable release of this driver.

Unfortunately there did not happen much from the Enphase side. To increase a bit the pressure it would help, if you and others also comment under the linked article above in the enphase community.

You could reach out to your installer and ask them to give you installer rights or contact Enphase by linking to the community entry above and request the installer rights.

mr-manuel commented 11 months ago

From latest intel that I got from an Enphase employee it will be changed with v8 of the firmware that will be shipped in Q2/Q3 2024 for Europe.