vincentwolsink / home_assistant_enphase_envoy_installer

This is a HACS custom integration for Enphase Envoys with firmware version 7 and up.
Apache License 2.0
61 stars 12 forks source link

Production Switch becomes unavailable after turn off. #93

Closed Ayuus closed 11 months ago

Ayuus commented 1 year ago

Describe the bug

I have put the Production Switch on a dashboard. When I switch off, power production is disabled (verified using https://envoy/home, installer login) and Production Switch is disabled. So, I can switch power production off using HA, but I can not switch back on using HA. After reloading the integration, Power Production Switch becomes available again.

Account type

Envoy

Home Assistant

Relevant snippet of Home Assistant error log.

2023-09-14 23:28:23.203 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] HTTP POST Attempt: https://192.168.1.9/auth/check_jwt
2023-09-14 23:28:23.203 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] HTTP POST Data: None
2023-09-14 23:28:23.427 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] HTTP POST https://192.168.1.9/auth/check_jwt: <Response [200 OK]>: <!DOCTYPE html><h2>Valid token.</h2>

2023-09-14 23:28:23.427 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] HTTP POST Cookie: <Cookies[]>
2023-09-14 23:28:23.428 INFO (MainThread) [custom_components.enphase_envoy.envoy_reader] Updating endpoints {'endpoint_production_json_results', 'endpoint_devstatus', 'endpoint_info_results', 'endpoint_pdm_energy', 'endpoint_home_json_results', 'endpoint_inventory_results', 'endpoint_production_power'}
2023-09-14 23:28:23.428 INFO (MainThread) [custom_components.enphase_envoy.envoy_reader] UPDATING ENDPOINT endpoint_production_json_results: https://{}/production.json?details=1
2023-09-14 23:28:23.428 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] HTTP GET Attempt #1: https://192.168.1.9/production.json?details=1: Header:{'Authorization': 'Bearer eyJraWQiOiI3ZDEwMDA1ZC03ODk5LTRkMGQtYmNiNC0yNDRmOThlZTE1NmIiLCJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9.eyJhdWQiOiIxMjIwMjQwMzUyMjEiLCJpc3MiOiJFbnRyZXoiLCJlbnBoYXNlVXNlciI6Imluc3RhbGxlciIsImV4cCI6MTY5NDc2NjcyNSwiaWF0IjoxNjk0NzIzNTI1LCJqdGkiOiJiMDg1YjAwNS1hMDFiLTQ5N2YtODFlOC02Y2Y3MGM4OGRkMTciLCJ1c2VybmFtZSI6InJ1aWpzQGxpdmUuY29tIn0.kJ-9aBk42S6IIFxsL6UXY8zIz6MH0l085S0wa090khj9pRp4z4NQAuQ6xZkKS9ZCob75xYD9Yvf1S0g7v2YSZw'} Cookies:<Cookies[]>
2023-09-14 23:28:53.631 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] TransportError: 
2023-09-14 23:28:53.631 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] HTTP GET Attempt #2: https://192.168.1.9/production.json?details=1: Header:{'Authorization': 'Bearer eyJraWQiOiI3ZDEwMDA1ZC03ODk5LTRkMGQtYmNiNC0yNDRmOThlZTE1NmIiLCJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9.eyJhdWQiOiIxMjIwMjQwMzUyMjEiLCJpc3MiOiJFbnRyZXoiLCJlbnBoYXNlVXNlciI6Imluc3RhbGxlciIsImV4cCI6MTY5NDc2NjcyNSwiaWF0IjoxNjk0NzIzNTI1LCJqdGkiOiJiMDg1YjAwNS1hMDFiLTQ5N2YtODFlOC02Y2Y3MGM4OGRkMTciLCJ1c2VybmFtZSI6InJ1aWpzQGxpdmUuY29tIn0.kJ-9aBk42S6IIFxsL6UXY8zIz6MH0l085S0wa090khj9pRp4z4NQAuQ6xZkKS9ZCob75xYD9Yvf1S0g7v2YSZw'} Cookies:<Cookies[]>
2023-09-14 23:29:23.205 ERROR (MainThread) [custom_components.enphase_envoy] Timeout fetching envoy Envoy 122024035221 data
2023-09-14 23:29:23.205 DEBUG (MainThread) [custom_components.enphase_envoy] Finished fetching envoy Envoy 122024035221 data in 60.003 seconds (success: False)
2023-09-14 23:30:23.203 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] Checking Token value: eyJraWQiOiI3ZDEwMDA1ZC03ODk5LTRkMGQtYmNiNC0yNDRmOThlZTE1NmIiLCJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9.eyJhdWQiOiIxMjIwMjQwMzUyMjEiLCJpc3MiOiJFbnRyZXoiLCJlbnBoYXNlVXNlciI6Imluc3RhbGxlciIsImV4cCI6MTY5NDc2NjcyNSwiaWF0IjoxNjk0NzIzNTI1LCJqdGkiOiJiMDg1YjAwNS1hMDFiLTQ5N2YtODFlOC02Y2Y3MGM4OGRkMTciLCJ1c2VybmFtZSI6InJ1aWpzQGxpdmUuY29tIn0.kJ-9aBk42S6IIFxsL6UXY8zIz6MH0l085S0wa090khj9pRp4z4NQAuQ6xZkKS9ZCob75xYD9Yvf1S0g7v2YSZw
2023-09-14 23:30:23.203 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] Token is populated: eyJraWQiOiI3ZDEwMDA1ZC03ODk5LTRkMGQtYmNiNC0yNDRmOThlZTE1NmIiLCJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9.eyJhdWQiOiIxMjIwMjQwMzUyMjEiLCJpc3MiOiJFbnRyZXoiLCJlbnBoYXNlVXNlciI6Imluc3RhbGxlciIsImV4cCI6MTY5NDc2NjcyNSwiaWF0IjoxNjk0NzIzNTI1LCJqdGkiOiJiMDg1YjAwNS1hMDFiLTQ5N2YtODFlOC02Y2Y3MGM4OGRkMTciLCJ1c2VybmFtZSI6InJ1aWpzQGxpdmUuY29tIn0.kJ-9aBk42S6IIFxsL6UXY8zIz6MH0l085S0wa090khj9pRp4z4NQAuQ6xZkKS9ZCob75xYD9Yvf1S0g7v2YSZw
2023-09-14 23:30:23.203 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] Token expires at: 2023-09-15 10:32:05
2023-09-14 23:30:23.203 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] HTTP POST Attempt: https://192.168.1.9/auth/check_jwt
2023-09-14 23:30:23.203 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] HTTP POST Data: None
2023-09-14 23:30:23.450 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] HTTP POST https://192.168.1.9/auth/check_jwt: <Response [200 OK]>: <!DOCTYPE html><h2>Valid token.</h2>

2023-09-14 23:30:23.451 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] HTTP POST Cookie: <Cookies[<Cookie sessionId=irPDeAwhsAT1pHssgwE6WZhlJ4m0jHIA for 192.168.1.9 />]>
2023-09-14 23:30:23.451 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] We got a session cookie (sessionId), empty the auth header
2023-09-14 23:30:23.451 INFO (MainThread) [custom_components.enphase_envoy.envoy_reader] Updating endpoints {'endpoint_production_json_results', 'endpoint_devstatus', 'endpoint_info_results', 'endpoint_pdm_energy', 'endpoint_home_json_results', 'endpoint_inventory_results', 'endpoint_production_power'}
2023-09-14 23:30:23.451 INFO (MainThread) [custom_components.enphase_envoy.envoy_reader] UPDATING ENDPOINT endpoint_production_json_results: https://{}/production.json?details=1
2023-09-14 23:30:23.452 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] HTTP GET Attempt #1: https://192.168.1.9/production.json?details=1: Header:{} Cookies:<Cookies[<Cookie sessionId=irPDeAwhsAT1pHssgwE6WZhlJ4m0jHIA for 192.168.1.9 />]>
2023-09-14 23:30:53.649 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] TransportError: 
2023-09-14 23:30:53.650 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] HTTP GET Attempt #2: https://192.168.1.9/production.json?details=1: Header:{} Cookies:<Cookies[<Cookie sessionId=irPDeAwhsAT1pHssgwE6WZhlJ4m0jHIA for 192.168.1.9 />]>
2023-09-14 23:31:23.207 DEBUG (MainThread) [custom_components.enphase_envoy] Finished fetching envoy Envoy 122024035221 data in 60.004 seconds (success: False)
2023-09-14 23:32:23.203 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] Checking Token value: eyJraWQiOiI3ZDEwMDA1ZC03ODk5LTRkMGQtYmNiNC0yNDRmOThlZTE1NmIiLCJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9.eyJhdWQiOiIxMjIwMjQwMzUyMjEiLCJpc3MiOiJFbnRyZXoiLCJlbnBoYXNlVXNlciI6Imluc3RhbGxlciIsImV4cCI6MTY5NDc2NjcyNSwiaWF0IjoxNjk0NzIzNTI1LCJqdGkiOiJiMDg1YjAwNS1hMDFiLTQ5N2YtODFlOC02Y2Y3MGM4OGRkMTciLCJ1c2VybmFtZSI6InJ1aWpzQGxpdmUuY29tIn0.kJ-9aBk42S6IIFxsL6UXY8zIz6MH0l085S0wa090khj9pRp4z4NQAuQ6xZkKS9ZCob75xYD9Yvf1S0g7v2YSZw
2023-09-14 23:32:23.204 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] Token is populated: eyJraWQiOiI3ZDEwMDA1ZC03ODk5LTRkMGQtYmNiNC0yNDRmOThlZTE1NmIiLCJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9.eyJhdWQiOiIxMjIwMjQwMzUyMjEiLCJpc3MiOiJFbnRyZXoiLCJlbnBoYXNlVXNlciI6Imluc3RhbGxlciIsImV4cCI6MTY5NDc2NjcyNSwiaWF0IjoxNjk0NzIzNTI1LCJqdGkiOiJiMDg1YjAwNS1hMDFiLTQ5N2YtODFlOC02Y2Y3MGM4OGRkMTciLCJ1c2VybmFtZSI6InJ1aWpzQGxpdmUuY29tIn0.kJ-9aBk42S6IIFxsL6UXY8zIz6MH0l085S0wa090khj9pRp4z4NQAuQ6xZkKS9ZCob75xYD9Yvf1S0g7v2YSZw
2023-09-14 23:32:23.204 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] Token expires at: 2023-09-15 10:32:05
2023-09-14 23:32:23.204 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] HTTP POST Attempt: https://192.168.1.9/auth/check_jwt
2023-09-14 23:32:23.205 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] HTTP POST Data: None
2023-09-14 23:32:23.717 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] HTTP POST https://192.168.1.9/auth/check_jwt: <Response [200 OK]>: <!DOCTYPE html><h2>Valid token.</h2>

2023-09-14 23:32:23.718 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] HTTP POST Cookie: <Cookies[]>
2023-09-14 23:32:23.720 INFO (MainThread) [custom_components.enphase_envoy.envoy_reader] Updating endpoints {'endpoint_production_json_results', 'endpoint_devstatus', 'endpoint_info_results', 'endpoint_pdm_energy', 'endpoint_home_json_results', 'endpoint_inventory_results', 'endpoint_production_power'}
2023-09-14 23:32:23.720 INFO (MainThread) [custom_components.enphase_envoy.envoy_reader] UPDATING ENDPOINT endpoint_production_json_results: https://{}/production.json?details=1
2023-09-14 23:32:23.720 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] HTTP GET Attempt #1: https://192.168.1.9/production.json?details=1: Header:{'Authorization': 'Bearer eyJraWQiOiI3ZDEwMDA1ZC03ODk5LTRkMGQtYmNiNC0yNDRmOThlZTE1NmIiLCJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9.eyJhdWQiOiIxMjIwMjQwMzUyMjEiLCJpc3MiOiJFbnRyZXoiLCJlbnBoYXNlVXNlciI6Imluc3RhbGxlciIsImV4cCI6MTY5NDc2NjcyNSwiaWF0IjoxNjk0NzIzNTI1LCJqdGkiOiJiMDg1YjAwNS1hMDFiLTQ5N2YtODFlOC02Y2Y3MGM4OGRkMTciLCJ1c2VybmFtZSI6InJ1aWpzQGxpdmUuY29tIn0.kJ-9aBk42S6IIFxsL6UXY8zIz6MH0l085S0wa090khj9pRp4z4NQAuQ6xZkKS9ZCob75xYD9Yvf1S0g7v2YSZw'} Cookies:<Cookies[]>
2023-09-14 23:32:53.937 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] TransportError: 
2023-09-14 23:32:53.937 DEBUG (MainThread) [custom_components.enphase_envoy.envoy_reader] HTTP GET Attempt #2: https://192.168.1.9/production.json?details=1: Header:{'Authorization': 'Bearer eyJraWQiOiI3ZDEwMDA1ZC03ODk5LTRkMGQtYmNiNC0yNDRmOThlZTE1NmIiLCJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9.eyJhdWQiOiIxMjIwMjQwMzUyMjEiLCJpc3MiOiJFbnRyZXoiLCJlbnBoYXNlVXNlciI6Imluc3RhbGxlciIsImV4cCI6MTY5NDc2NjcyNSwiaWF0IjoxNjk0NzIzNTI1LCJqdGkiOiJiMDg1YjAwNS1hMDFiLTQ5N2YtODFlOC02Y2Y3MGM4OGRkMTciLCJ1c2VybmFtZSI6InJ1aWpzQGxpdmUuY29tIn0.kJ-9aBk42S6IIFxsL6UXY8zIz6MH0l085S0wa090khj9pRp4z4NQAuQ6xZkKS9ZCob75xYD9Yvf1S0g7v2YSZw'} Cookies:<Cookies[]>
hapklaar commented 1 year ago

FW D7.6.172 Envoy-S

I see the almost the same happening. At first I thought the Production switch didn't respond as it was quite slow to actually disable the production on Envoy. But after about 20 seconds production was disabled.

I was however able to switch prod back on in HA, but the switch returned back to the Off position while I verified it to be on on Envoy. Seems the switch is not accurately showing the current status on Envoy for me.

PS very happy with this integration overall! thanks!

vincentwolsink commented 1 year ago

The code for the production switch in this integration is really simple. But what I noticed, is that the production switching on the Envoy is very buggy at best.

A delay between switching off production and production actually stopping is normal. It is because the Envoy needs to communicate with all inverters to make them stop producing. When turning on production, the delay will probably be even bigger (or you need to power cycle the Envoy in some cases...)

What I also noticed, while the Envoy is communicating with the inverters, it responds very slow (which makes the button unavailable since requesting the status times out @Ayuus). Or it doesn't respond to requests to turn production back on (which makes the button go back to off @hapklaar).

Unfortunately I cannot think of anything we can do for now, to fix this Envoy behaviour.