core: Growatt integration broken
The problem
growatt server fails since this morning. updated to newest version of home assistant but same issue. deleted and readded integration but same issue.
What version of Home Assistant Core has the issue?
2022.8.2
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant Container
Integration causing the issue
growatt
Link to integration documentation on our website
https://www.home-assistant.io/integrations/growatt_server/
Diagnostics information
not available with this integration
Example YAML snippet
No response
Anything in the logs that might be useful for us?
Logger: homeassistant.components.sensor
Source: components/growatt_server/sensor.py:42
Integration: Sensor (documentation, issues)
First occurred: 12:01:04 PM (3 occurrences)
Last logged: 12:44:12 PM
Error while setting up growatt_server platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 281, in _async_setup_platform
await asyncio.shield(task)
File "/usr/src/homeassistant/homeassistant/components/growatt_server/sensor.py", line 74, in async_setup_entry
devices, plant_id = await hass.async_add_executor_job(get_device_list, api, config)
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/growatt_server/sensor.py", line 42, in get_device_list
login_response = api.login(config[CONF_USERNAME], config[CONF_PASSWORD])
File "/usr/local/lib/python3.10/site-packages/growattServer/__init__.py", line 119, in login
data = json.loads(response.content.decode('utf-8'))['back']
File "/usr/local/lib/python3.10/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.10/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.10/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)
Logger: homeassistant.components.sensor
Source: components/growatt_server/sensor.py:55
Integration: Sensor (documentation, issues)
First occurred: 12:25:18 PM (1 occurrences)
Last logged: 12:25:18 PM
Error while setting up growatt_server platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 281, in _async_setup_platform
await asyncio.shield(task)
File "/usr/src/homeassistant/homeassistant/components/growatt_server/sensor.py", line 74, in async_setup_entry
devices, plant_id = await hass.async_add_executor_job(get_device_list, api, config)
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/growatt_server/sensor.py", line 55, in get_device_list
devices = api.device_list(plant_id)
File "/usr/local/lib/python3.10/site-packages/growattServer/__init__.py", line 503, in device_list
return self.plant_info(plant_id)['deviceList']
File "/usr/local/lib/python3.10/site-packages/growattServer/__init__.py", line 516, in plant_info
data = json.loads(response.content.decode('utf-8'))
File "/usr/local/lib/python3.10/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.10/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.10/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)
Additional information
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 182 (19 by maintainers)
Hi All,
I submitted the PR last night for the fix on top of @coffeedave’s original settings update. Once the fix is included and people update their HA instances it’ll automatically update anyone using the old URL to use the new one, no further changes required. For those of you that have used the settings tweak described above to switch over to the new URL it will not change it, as that’s the desired end-goal. The change also changes the old URL to the new one for users configuring the integration for the first time (or re-configuring after removing it).
For those of you that are interested, I’ve also worked out why my system wasn’t being affected by it. My HA configuration for Growatt predates when we had the option to specify a URL, therefore there was nothing in my “core.config_entries”. In that scenario it defaults to whatever the upstream PyPi_GrowattServer library uses which is the correct URL (it turns out this was updated months ago and we should have updated the HA integration at the same time).
Anyway, the fix is imminent (you can follow it here if you’re interested), in the meantime you have the workaround.
Hi Everyone,
Thanks for the continued updates and workarounds etc. I’m now back from my weekend away and able to look at this again. Whilst I’m still unable to re-create this issue myself I am able to confirm that the shinephone app (which this library is reverse engineered from) has changed it’s endpoint to
https://server.growatt.com/as described above by @coffeedave.@coffeedave has kindly submitted the PR to update the module, and after one more refinement it will be ready to merge. The final refinement will mean that when the version of HA is released containing the fix you won’t need to make any changes, the configuration will automatically update.
In the meantime, the fix to update your
core.config_entriesas described above to change the URL from whatever is currently there tohttps://server-api.growatt.com/will work around the issue.There is no need to email growatt via their support channels as there is no official support for this integration, or the library that Indy & I support, all we do is
spoofbeing the android app in order to pull information.I fully acknowledge that this particular issue has been a real pain for people and apologise for how disruptive it’s been, especially considering the problem is so intermittent for people. I know there are other options available (I’ve seen grott mentioned in this chain) and don’t blame people for trying alternative methods. I will continue to maintain this library so long as it’s viable and possible to do so, it just helps when I can actually reproduce the issues other people are having 😛 !
The fix will come soon, in the meantime the workaround is described above for people.
@mjooris - While this issue does seem to be fixed for yourself, can I please as you to re-open this bug as it’s clearly affecting people and we shouldn’t mark it as resolved until the official fix is out there.
Belatedly, changing the server URL fixed it for me too. However, it’s essential that the url entry in core.config_entries includes the forward slash too.
Before my entry was: “url”: “https://server.growatt.com”,
Which I had to change to: “url”: “https://server-api.growatt.com/”,
Without the last forward slash I was getting the ‘Failed to establish a new connection: [Errno -2] Name does not resolve’ error.
Hope it helps others.
This change in the config file solved it for me: I Just changed /config/.storage/core.config_entries Look for the GroWatt part and changed: From: server.growatt.com To: server-api.growatt.com
I had the same issue, same error, until yesterday morning:
I Just changed /config/.storage/core.config_entries Look for the GroWatt part and changed: From: server.growatt.com To: server-api.growatt.com
Both are reachable from the browser, but evidently the top one not via Home Assistant, for a to me unclear reason. (Via: https://github.com/home-assistant/home-assistant.io/issues/23705)
Growatt no longer works after the latest Home Assistant update
Growatt application is back to old server settings server.growatt.com when updating Home Assistant. The correct settings are server-api.growatt.com If you want to solve this you can run the following command in SSH
Go to:
Settings Add-ons Install SSH & Web Terminal
Open SSH terminal and run the following command:
sed -i ‘s/server.growatt.com/server-api.growatt.com/g’ /config/.storage/core.config_entries
Restart your Home Assistant and Growatt is working again.
https://github.com/home-assistant/home-assistant.io/issues/23705#issuecomment-1214799146
@Edem123456
I followed these simple steps to change the file. For me it worked
Go to:
Settings Add-ons Install SSH & Web Terminal
Open SSH terminal and run the following command:
sed -i ‘s/server.growatt.com/server-api.growatt.com/g’ /config/.storage/core.config_entries
please note. The line above is one single line. Not three!
Restart your Home Assistant and Growatt is working again.
This has also fixed my issue. @muppet3000 big thumbs up for your continued efforts with this. Anyone offering their own time and knowledge to an open source platform is doing the rest of us huge favours. Thank you.
If you’re talking about the ShinePhone app, I can see it’s hitting oss.growatt.com according to my DNS server.
this works for me to! (for now, hopefully it stays that way)
@muppet3000 is it a possibility to integrate this in the integration. Maybe set a picklist in the settings to choose from different servers?
Probably doesn’t help you, but mine would suddenly add, and I could then change the server. Now mine is working.
Not sure why you think this has been merged or released but the PR still hasn’t been merged by the maintainers yet: https://github.com/home-assistant/core/pull/76824
So it’s not in any release yet. Once it’s merged it will be in the next dev/nightly release though.
@Edem123456 the change that @coffeedave made to this has been approved and tagged for release in 2022.8.6 which I believe has just come out so you should be able to upgrade and not fiddle with the backend stuff.
As another alternative this could be used for a local solution. It is based on a ESP8266 and Modbus. Additional information can be found on: https://youtu.be/krCdt2nv3BM
Sorry for the quick reply after my previous message… I managed to figure it out. Before adding the new integration, I edited the const.py file in the homeassistant container (/usr/src/homeassistant/homeassistant/components/growatt_server/) and changed from:
https://server.growatt.com to https://server-api.growatt.com.
I then restarted and re-added the Growatt integration. All seems to be up and running for now.
I just tried this as well, and i agree, my integration started to work. I have no idea if it will be stable, but it was not working before, and 3 restarts did not do anything.
This might also be why the app is working, if the app is polling the server-api address.
Aside from the “normal” “Server timeout” that i have been getting on the app for some time, that will go away if i refresh, the app has always shown the right data, even when the HA integration refused to show anything.
Just reporting initial results from changing to grott (https://github.com/johanmeijer/grott) to get rid of server.growatt.com: Grott is installed and running. Data goes directly from shineWifi to a windows computer running the grott python script, which publishes the data on MQTT which I then use in HA. Grott relays to Growatt so the shinePhone app is still useful.
@mahmoud-os93: according to the docs Grott can handle two inverters - I don’t have two inverters to test.
I will run this for a couple of days to see if it’s stable in my setup and report back.
it stop working after update HA this morning