core
core copied to clipboard
Growatt_server integration not working in
The problem
Growatt_server integration works in HA version 2022.10.4 not in version 2022.10.5.
What version of Home Assistant Core has the issue?
2022.10.5
What was the last working version of Home Assistant Core?
2022.10.4
What type of installation are you running?
Home Assistant Container
Integration causing the issue
growatt_server
Link to integration documentation on our website
https://www.home-assistant.io/integrations/growatt_server
Diagnostics information
No response
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:164
Integration: Sensor (documentation, issues)
First occurred: 1:36:19 PM (2 occurrences)
Last logged: 1:36:19 PM
Error adding entities for domain sensor with platform growatt_server
Error while setting up growatt_server platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 428, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 691, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 777, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 533, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 571, in _async_write_ha_state
state = self._stringify_state(available)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 539, in _stringify_state
if (state := self.state) is None:
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 404, in state
value = self.native_value
File "/usr/src/homeassistant/homeassistant/components/growatt_server/sensor.py", line 164, in native_value
result = round(result, self.entity_description.precision)
TypeError: type NoneType doesn't define __round__ method
-----------------------------------------------------------
Logger: homeassistant.components.growatt_server.sensor
Source: components/growatt_server/sensor.py:176
Integration: Growatt Server (documentation, issues)
First occurred: 1:36:19 PM (1 occurrences)
Last logged: 1:36:19 PM
Unable to fetch data from Growatt server
Additional information
Updated and downgraded the version a couple of times and problem is solved in 2022.10.4.
Hey there @indykoning, @muppet3000, @jasperplant, mind taking a look at this issue as it has been labeled with an integration (growatt_server
) you are listed as a code owner for? Thanks!
Code owner commands
Code owners of growatt_server
can trigger bot actions by commenting:
-
@home-assistant close
Closes the issue. -
@home-assistant rename Awesome new title
Change the title of the issue. -
@home-assistant unassign growatt_server
Removes the current integration label and assignees on the issue, add the integration domain after the command.
(message by CodeOwnersMention)
growatt_server documentation growatt_server source (message by IssueLinks)
I think it is server related I now also get no information from Growatt in version 2022.10.4. If I log in directly on one of the websites only https://server.growatt.com accepts my credentials.
I've noticed that there seems to be some real problems with the growatt API server today. I've just tried to access it on my phone and it's really struggling to load anything, I haven't seen any other complaints about the HA integration, so I think it's almost definitely an issue with the server.
I think it is time for me to try to make it local with esphome and the growatt integration for esphome :-)
I see a similiar problem:
2022-10-25 18:46:10.751 ERROR (MainThread) [homeassistant.components.sensor] 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 86, 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 43, 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)
I think it would be helpful if the integration logged more info when it fails, for example http headers and payload.
API seems to be working again.
API seems to be working again.
For me no, even app show network error from 16:00 GMT
It's working again normally for me too.
I think it is server related I now also get no information from Growatt in version 2022.10.4. If I log in directly on one of the websites only https://server.growatt.com accepts my credentials.
I've got same problem - my credentials works only with https://server.growatt.com ... seems like there was a change in login servers because when I try add again Growatt integration i see three different servers then it was ~few days ago:
The main problem to me is that exceptions are raised in a fairly common situation, i.e. the growatt server is unreachable. In growatt_server/sensor.py
@property
def native_value(self):
"""Return the state of the sensor."""
result = self.probe.get_data(self.entity_description.api_key)
if self.entity_description.precision is not None:
result = round(result, self.entity_description.precision)
return result
self.probe.get_data
returns None
if the server is unreachable. This case is not handled properly.
I suggest to test explicitly for result is not None and self..entity_description.precision is not None
Secondly, in
@Throttle(SCAN_INTERVAL)
def update(self):
"""Update probe data."""
self.api.login(self.username, self.password)
_LOGGER.debug("Updating data for %s (%s)", self.device_id, self.growatt_type)
try:
if self.growatt_type == "total":
self.api.login
will raise a JSONDecodeError
exception if the login does not succeed.
Moving self.api.login
into the try
block will catch this situation, i.e.
@Throttle(SCAN_INTERVAL)
def update(self):
"""Update probe data."""
_LOGGER.debug("Updating data for %s (%s)", self.device_id, self.growatt_type)
try:
self.api.login(self.username, self.password)
if self.growatt_type == "total":
@hogend - Thanks, when I'm next in the code for this I'll update as per your suggestions.
With regards to the original point that was raised, this issue was definitely related to the Growatt server being unavailable rather than anything in the integration that stopped working, I agree though, the error reporting could be far better.
In relation to the comment above about the change in server, back in July they (Growatt) changed the URL that needed to be hit in order to pull the information, the old server.growatt.com
endpoint no longer works.
FYI - Looks like it's happening to me today as well, only this time the app seems to be working but the python library that underpins the HA integration is going dog slow and then eventually timing out. I'll continue to monitor it though just in case they've done something to change the API again!!
Definitely problems with their server. The app was almost useless yesterday. Today seems a little more stable in HA but their website access is hit-and-miss with errors. I suspect it seems more stable in HA due to the fact the data only updates every 5 mins. At least that's what I see. The system was only installed yesterday so it's been a great first impression. ;-)
Just look at some of the load times!
I'm on 2022.10.5 and the Growatt integration is not working at all. Has't worked properly for almost a week now. ShinePhone app si also having issues. Server issues!
Logger: homeassistant.components.sensor
Source: components/growatt_server/sensor.py:164
Integration: Sensor (documentation, issues)
First occurred: October 25, 2022 at 18:09:29 (3 occurrences)
Last logged: 15:35:37
Error adding entities for domain sensor with platform growatt_server
Error while setting up growatt_server platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 428, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 691, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 777, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 533, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 571, in _async_write_ha_state
state = self._stringify_state(available)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 539, in _stringify_state
if (state := self.state) is None:
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 404, in state
value = self.native_value
File "/usr/src/homeassistant/homeassistant/components/growatt_server/sensor.py", line 164, in native_value
result = round(result, self.entity_description.precision)
TypeError: type NoneType doesn't define __round__ method
Logger: homeassistant.components.growatt_server.sensor
Source: components/growatt_server/sensor.py:176
Integration: Growatt Server (documentation, issues)
First occurred: October 25, 2022 at 18:09:29 (3 occurrences)
Last logged: 15:35:37
Unable to fetch data from Growatt server
Logger: homeassistant.components.sensor
Source: components/growatt_server/sensor.py:196
Integration: Sensor (documentation, issues)
First occurred: 15:35:35 (6 occurrences)
Last logged: 15:35:36
growatt_server: Error on device update!
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 493, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 703, in async_device_update
await task
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 176, in update
self.probe.update()
File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 192, in wrapper
result = method(*args, **kwargs)
File "/usr/src/homeassistant/homeassistant/components/growatt_server/sensor.py", line 196, in update
self.api.login(self.username, self.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)
I assume they're doing something 'clever' on their end and semi-rate limiting certain connections, either that or it's just blind luck why all the queries from the app on my phone work but the ones from the python client don't. Either way, generally when this has happened in the past it happens for a few days and is then remarkably stable for weeks. I'll continue to monitor the situation.
I had issues today so restarted HA, after Growatt is all ok except the integration is telling me that the api is no longer sending the battery charge level and I should delete that element. Both battery charged today and statement of charge are greyed out in the element list.
Growatt maby change something, with make me logout, if rotating cube spin more then 5 sec in https://server.growatt.com
Had very similar issues yesterday around the same time. I keep running my tests directly from the python library in the background on my server (not using HA at all) and they're devastatingly slow and sometimes just fail altogether.
My recommendation is to just remain patient (I know that's easy to say and harder to do) and see what the situation is like in a few hours at which point it could all be up and stable again. I'm reluctant to jump to any conclusions around changes to the API until at least the app and the website are stable.
In a few hours (once I've finished work and my children have gone to bed) I'll do a load of debugging against the API calls that the phone app is making, just in case they've changed something, but on my first inspections it just looks like their server isn't handling the load properly.
Today 75min early then yesterday 12:43 GMT
More strange for me is: Why integration (not only this one) give-up after some unsuccess trays? It's more logical if NO data come, to reconnect each 5 min for hour then each 30min until success.
Today 75min early then yesterday 12:43 GMT
More strange for me is: Why integration (not only this one) give-up after some unsuccess trays? It's more logical if NO data come, to reconnect each 5 min for hour then each 30min until success.
It's something to do with the way that the module is initialised. The 'login' part of the library is performed during initialisation of the integration, meaning that you can hold onto the session for the lifetime of the integration or until it expires. That way you don't have to log in to the server every 1 minute (which is costly and would put even more load on the server). This is why when you restart HA it will work for a little while, ultimately once they sort whatever problems they have on their end everything will come back to life!
Today 75min early then yesterday 12:43 GMT More strange for me is: Why integration (not only this one) give-up after some unsuccess trays? It's more logical if NO data come, to reconnect each 5 min for hour then each 30min until success.
It's something to do with the way that the module is initialised. The 'login' part of the library is performed during initialisation of the integration, meaning that you can hold onto the session for the lifetime of the integration or until it expires. That way you don't have to log in to the server every 1 minute (which is costly and would put even more load on the server). This is why when you restart HA it will work for a little while, ultimately once they sort whatever problems they have on their end everything will come back to life!
Totally not agree have same problem with tuya integration. i have lot of unlogic flat lines until restart integration. HA must have some internal logic how to proceed when integration is disconnected from remote server or not getting data.
Yesterday "connection loosing" was restored by me this morning after manual integration reload.
Not working for my neither. Was running fine for about a month, then yesterday app started to give errors(HA was pulling the data correctly 'tho). HA version : 2022.10.4, tried reloading the integration, no luck, same error : Unable to fetch data from Growatt.
I purposefully haven't restarted my HA system at all today and I always run with a really out of date version (because I'm lazy and never update it).
This is the data for the last 6 hours (the big flat spots are when no data was being received):
So, as you can see, doing nothing does eventually seem to result in some results, as such this is definitely not an issue with the integration (I agree that the error handling could be more useful though).
It looks like the Growatt server has either been going down regularly or has just been unable to handle the load. I'll continue to monitor. No amount of upgrading or downgrading your HA instances will fix this.
On your graph I see only repeating last value until reconnect. Why value is repeating? NULL = Last value ???
Example how RRD solve this
guess what happen on white stripe
On your graph I see only repeating last value until reconnect. Why value is repeating?
Example how RRD solve this
guess what happen on white stripe
We've gone off topic, it's because I have my grafana pointing at prometheus which pulls the values from HA, which means it pulls the last value rather than a null, so it always looks like it's online. It's something I've been meaning to fix but have never bothered to spend time on it, it's pretty obvious that it's broken when that happens!
Access is restored but have some changes sensor.{plant]_energy_today is missing sensor.[location]_total_energy_today show same
is this maybe to do with the requirement for a country now when signing into the app? missing data for the log in.
is this maybe to do with the requirement for a country now when signing into the app? missing data for the log in.
maby adding more regional CDN-s My access speed is less then 100ms
Same problem here, no data from growatt :(
this is in the log file
File "/usr/src/homeassistant/homeassistant/components/growatt_server/sensor.py", line 176, in update
File "/usr/src/homeassistant/homeassistant/components/growatt_server/sensor.py", line 196, in update
File "/usr/local/lib/python3.10/site-packages/growattServer/__init__.py", line 119, in login