Growatt Inverter Mode Switch

hmm, makes sense.

well currently I have set it up to 23:30 - 5:30 as these are default slots and then I think it will force battery first if specific additional slots are allocated.

will update if anything :wink:

but greatly appreciate for your work!

2 Likes

ok, here’s an update.

Yesterday I got the additional Intelligent Octopus (IO) slot provided for me from 23:00 to 23:30, and then the usual 23:30 - 5:30.

I have an automation running, that once the IO slot is started, then the Growatt should revert to Battery First. I use these cheap off-peak slots to charge my car (as I want to avoid charging my car off my house battery).

So yesterday car started to charge 23:00 in the cheap IO slot, but the Inverter automation to enable the Battery First did not enable the mode in the right way.
It actually enabled the mode, but it has the default time for start and finish entered in Lovelace starting from 23:30 to 5:30 and automation did not change that.

It means that time slot has not been updated. and I presume it just enabled Battery first with default values which are already in - meaning 23:30 - 5:30.

I know that I am missing something or I should run my automation in some other way?

OK, update with workaround for those on Intelligent Octopus (IO) and Growatt

I keep automation the same as above, but what I did (and still testing) - the timeframe which allows start and stop of Battery first - I set to start 18:30 and to end 6:30.

the automation will just enable or disable battery first timeslot.

IO usually is set between 5 PM and 11 AM and will be more or less always between 11:30 and 5:30, it can be some times earlier/later, but it is extremely rare cases if it is set up earlier than 7 PM to 7 AM

So by this set up, automation should enable or disable slot and it most likely will be in the right timeframe (you can edit your settings as well.

This was working nicely, but now it’s stopped. The error looks like the account I’m using isn’t working, but I just checked the website and the account is not locked. Did something else in the API change :frowning:

2023-09-25 18:00:24.835911 WARNING get_charge_settings: ------------------------------------------------------------
2023-09-25 18:00:24.837324 WARNING get_charge_settings: Unexpected error in worker for App get_charge_settings:
2023-09-25 18:00:24.838573 WARNING get_charge_settings: Worker Ags: {‘id’: ‘6431ca4877974d4a98f0943c621b184b’, ‘name’: ‘get_charge_settings’, ‘objectid’: ‘6ea8160225ea4628a2ce31fb9845e93c’, ‘type’: ‘state’, ‘function’: <bound method AD_Growatt.get_charge_settings of <growatt_app.AD_Growatt object at 0x7fb1400d50>>, ‘attribute’: ‘state’, ‘entity’: ‘input_button.adgw_get_charge_settings_button’, ‘new_state’: ‘2023-09-25T16:00:24.619998+00:00’, ‘old_state’: ‘2023-09-25T15:55:19.190241+00:00’, ‘pin_app’: True, ‘pin_thread’: 0, ‘kwargs’: {’__thread_id’: ‘thread-0’}}
2023-09-25 18:00:24.839674 WARNING get_charge_settings: ------------------------------------------------------------
2023-09-25 18:00:24.843194 WARNING get_charge_settings: Traceback (most recent call last):
File “/usr/lib/python3.11/site-packages/appdaemon/threading.py”, line 1045, in worker
funcref(
File “/config/appdaemon/apps/growatt_app.py”, line 22, in get_charge_settings
session = api.login(un, pwd) #login and return a session
^^^^^^^^^^^^^^^^^^
File “/config/appdaemon/apps/growattServer.py”, line 132, in login
data = json.loads(response.content.decode(‘utf-8’))[‘back’]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3.11/json/init.py”, line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3.11/json/decoder.py”, line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3.11/json/decoder.py”, line 355, in raw_decode
raise JSONDecodeError(“Expecting value”, s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
2023-09-25 18:00:24.844555 WARNING get_charge_settings: ------------------------------------------------------------

1 Like

Thanks for this Kasper, you did better than me and actually finished doing this. I had got it to work but looking at your code, it does a very similar thing to what I wrote. @mjdyson - thanks for your work as that gave me the basis to build on. I now need to get the automations working with Octopus Agile so will get back to that. However, at the moment it seems that there is lots of blocking or similar going on as my Alexa skill and Python scripts no longer seem to work. Let’s hope it settles down…

yes, the same @Snux
it was some sort of outage yesterday. it is not working anymore since yesterday… :frowning:
also on growatt website I quite often get “Error 500” and “this plant does not exist… Please log in again” errors

any way to look at this @KasperHolchKragelund ?

Hi,
I think some Python update or maybe HA update broke it. I have updated to version 0.41 which fixed it. Just copy the growatt_app.py file from Github (https://github.com/KasperHolchKragelund/ad-growatt/tree/main/appdaemon/apps)

and it should work again,

I think some Python update or maybe HA update broke initialization of the API. I have updated to version 0.41 which fixed it. Just copy the growatt_app.py file from Github (https://github.com/KasperHolchKragelund/ad-growatt/tree/main/appdaemon/apps)

For the 501 errors, that’s Growatt servers being down… they seem to be unstable some days. I’m trying to call the API 5 times in case of error and this fixes it some times, other times the servers are just down for hours.

hmm… not sure if it works.
API status does not change after “press” is pushed even mode is changed in settings.

I pulled the new version, it’s one step forward. I don’t get errors in the appdaemon log now, but the API Status is just showing “Error Msg 501”. I’ll try it again later.

removed as irrelevant

did you manage this working??

I do not think this works. at least not on my side.

I copied over new growatt_app.py, rebooted HA, still same :confused:

I occasionally get a API status of “Initialised” but then it goes back to 501. But I see on the other growatt api usage of @muppet3000 the same 501 issue being reported, so it’s certainly something that changed on the growatt side

Just to add I created a new user on the growatt site and tried that but no change

Ok, please scrap my last few comments.

I think I made some sort of mistake regarding the PY script copying…

I have checked my file versions and looks like I had an old one… not sure if it was overwritten by system reboot or what.

in short, after copying an updated file from latest version 0.41 it looks like it actually works… almost…

I still get error 501 once in a while, but looks like it is sorted after few seconds and any changes are saved…
however after reboot, I get, once I press “Save battery first” - Error saving Battery first: 509
image

then, couple of minutes later, all works…

Are there now any limitations on the API calls?! 509 is “Bandwith limit exceeded”, if this is the same?

App deamon logs after reboot show following:
2023-09-27 16:03:16.112914 INFO AppDaemon: Adding /config/appdaemon/apps to module import path
2023-09-27 16:03:16.115319 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/growattServer.py - ignoring
2023-09-27 16:03:16.116281 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/growatt_app.py
2023-09-27 16:03:16.192385 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/hello.py - ignoring
2023-09-27 16:03:16.193522 INFO AppDaemon: Loading app get_charge_settings using class AD_Growatt from module growatt_app
2023-09-27 16:03:16.195169 INFO AppDaemon: Calling initialize() for get_charge_settings
2023-09-27 16:03:16.208178 INFO AppDaemon: App initialization complete

It has to be something goofy on the growatt side, mine now occasionally works then heads back to the good old 501

Yes, from what I can see in forums, everything using Growatt API is broken.
Nothing to do but wait and see if it resolves itself or if Growatt managed to block all customers from API permanently…

I’ve started looking at non-cloud solutions, as it seems like Growatts main priority is to degrade their own products.

Seems like Growatt API is somewhat coming online again, but quite unstable. So not permanently broken, but it needs to get a lot more stable to be useful.

I spend the day flashing a spare Shine-X with this project: GitHub - otti/Growatt_ShineWiFi-S: Firmware replacement for Growatt ShineWiFi-S
Got it working to some extent and probably in the future it will be a better alternative, as it’s completely independent of Growatt servers. But for now it’s lacking some functionality and documentation on how to set up is written for hardcore nerds.

oh… if to make proper non-cloud solution, it would be epic, imho…