homeassistant-growatt_server_api icon indicating copy to clipboard operation
homeassistant-growatt_server_api copied to clipboard

BUG - Intermittently Stops Working

Open ghost opened this issue 1 year ago • 6 comments

Hi

Thank you very much for all your hard work with this integration. It works very well most of the time. However several times a day the integration stops working. If I reload the integration it works fine again. I have set HA to restart every hour via an automation and this works but I wonder if there is another way? Is it possible to check every few minutes if the integration is working and if not automatically reload it??

ghost avatar Nov 16 '23 08:11 ghost

This will automatically ban you

Saentist avatar Nov 17 '23 17:11 Saentist

Banned from where/what?? If you mean Growatt then I have been restarting HA every hour for over a week or so with no ban

ghost avatar Nov 17 '23 19:11 ghost

I'm not sure what @Saentist is talking about, all that happens is that your account gets blocked for about 24 hours. While your suggestion seems good unfortunately that's not how the integration (and more accurately the blocking from Growatt) works. What happens is that they block your account and either the next time you try to log in (which is what happens when you reload the integration or restart home assistant) it won't let you, or your account just hangs until the temporary block expires. This is the reason I've been directing everyone over to use Grott instead (take a look at my other GitHub project), I've put together steps on how to set it up and also how to use my integration to display information with it. Sorry I can't be more help.

muppet3000 avatar Nov 17 '23 20:11 muppet3000

@JansonBHong @muppet3000 hope this is more clear apple image on android is written for 24h image

access via website is possible

Saentist avatar Nov 18 '23 11:11 Saentist

I was having the same problem. Workaround I found:

  • Configure the integration to use the server "https://server.growatt.com". In my tests, this proved to be more stable

  • Edit file "sensor.py" in /config/custom_components/growatt_server_api/sensor.py

  • In lines 35 and 36, change the Scan_Interval and Throttle to at least 10 mins, save and restart HA. This will prevent the Growatt server from blocking your account due to excessive queries.

SCAN_INTERVAL = datetime.timedelta(minutes=10)
THROTTLE = datetime.timedelta(minutes=10)
  • Important: Create a new automation, set the trigger to activate every 1 hour (time pattern > hours = /1). In the action, select Call Service > homeassistant.reload_config_entry > In the Config entry ID field, enter the UUID of the Growatt Server API integration (you can get this ID going to Settings > Devices & services > select the Growatt Server integration > click on Devices > copy the config_entry that appears in the URL)

Captura de tela 2024-02-16 111456

alias: Check API Growatt
description: ""
trigger:
  - platform: time_pattern
    hours: /1
condition: []
action:
  - service: homeassistant.reload_config_entry
    data:
      entry_id: 1ca45a0d2fca0811b9e58ce3d782baa1
    alias: Reload API Growatt
mode: single
  • Save automation and test again. If the problem persists, try increasing the scan_interval and throttle to 15 or 20 mins.

dlangamer avatar Feb 16 '24 14:02 dlangamer

Saw another automation here https://github.com/home-assistant/core/issues/109927#issuecomment-2096611186 which only reloads the config if it's unavailable, maybe this works with entry_id too?

alias: Check API Growatt
description: ""
trigger:
  - platform: time_pattern
    hours: /1
condition: []
condition:
  - condition: state
    entry_id: 1ca45a0d2fca0811b9e58ce3d782baa1
    state: unavailable
action:
  - service: homeassistant.reload_config_entry
    data:
      entry_id: 1ca45a0d2fca0811b9e58ce3d782baa1
    alias: Reload API Growatt
mode: single

Anteus avatar May 20 '24 18:05 Anteus