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

[BUG] Incorrect Status Display for switch.production After Turning Off in Home Assistant #102

Closed Neowam closed 7 months ago

Neowam commented 8 months ago

Describe the bug I am using the latest version of [home_assistant_enphase_envoy_installer. I've encountered an issue with the synchronization of switch status between my Enphase controller and the switch.production sensor in Home Assistant.

Account type

Envoy

Home Assistant Core 2024.1.3 Supervisor 2023.12.0 Operating System 11.4 Frontend 20240104.0

Additional context I created a switch from the switch.production sensor in Home Assistant. When I turn off this switch, I observe the following behavior:

However, the switch.production remains on ON and does not get updated or refreshed. After half an hour, the Enphase controller is still OFF, but the switch.production switch still remains on ON.

After pressing the switch after 30 minutes in Home Assistant the switch.production goes the OFF state. After a few seconds its going to ON state, but Enphase Production Switch still stays on OFF.

When manually turning on the Power Production switch within the Enphase Web interface, it's turning on again. Also then switching the Power Production within the Enphase Offline, the sensor is not be syncted to OFF state.

image image image image

Expected Result: When the switch.production switch in Home Assistant is turned off, its status should correctly reflect in both the Enphase controller and in Home Assistant.

Actual Result: The status of the switch.production switch in Home Assistant remains on ON, despite the Enphase controller being actually turned off. This suggests an issue in reading the switch status on the Enphase controller compared to the switch.production sensor in Home Assistant.

vincentwolsink commented 8 months ago

The Envoy becoming slow/unavailable for some time unfortunately happens when triggering production on/off.

What I can think of causing this bug is that we cache the state of the production switch for an hour. It actively reloads the state after switching, but it might be that the Envoy needs some time to update and HA caches the old state for an hour.

I will create a beta version with a reduced cache time. Try that one and let me know if it behaves better.

Neowam commented 8 months ago

The Envoy becoming slow/unavailable for some time unfortunately happens when triggering production on/off.

What I can think of causing this bug is that we cache the state of the production switch for an hour. It actively reloads the state after switching, but it might be that the Envoy needs some time to update and HA caches the old state for an hour.

I will create a beta version with a reduced cache time. Try that one and let me know if it behaves better.

@vincentwolsink many thanks! I will test this case for you with pleasure. Let me know when you have a beta version ready of the code.

vincentwolsink commented 8 months ago

0.3.6-beta1

Neowam commented 8 months ago

Will try coming few days...

Neowam commented 7 months ago

May be closed, I think this works fine now.