home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.13k stars 29.8k forks source link

Growatt integration sensors unavailable #100874

Closed rspring closed 11 months ago

rspring commented 11 months ago

The problem

I noticed that the solar production was null in my energy dashboard while there was still electricity returned to the grid. Then I inspected the Growatt sensors and they were all unavailable. I reloaded the Growatt integration without succes. Neither did 'Quick reload'. After a complete 'Restart Home Assistant' the sensors became available again. But after a few hours the problem returned.

What version of Home Assistant Core has the issue?

core-2023.9.2

What was the last working version of Home Assistant Core?

core-2023.9.2

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Growatt

Link to integration documentation on our website

https://www.home-assistant.io/integrations/growatt_server

Diagnostics information

Growatt integration has no option to download diagnostic data

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:43
Integration: Sensor (documentation, issues)
First occurred: 20:21:39 (1 occurrences)
Last logged: 20:21:39

Error while setting up growatt_server platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 359, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/src/homeassistant/homeassistant/components/growatt_server/sensor.py", line 87, in async_setup_entry
    devices, plant_id = await hass.async_add_executor_job(get_device_list, api, config)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/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.11/site-packages/growattServer/__init__.py", line 132, in login
    data = json.loads(response.content.decode('utf-8'))['back']
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/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)

Additional information

My Growatt account is functioning normally at the following website https://server.growatt.com/index

J4CE2 commented 11 months ago
  1. api.server_url = "https://server.growatt.com/"

In my case, this change helped, what I did exactly: in the file - /usr/src/homeassistant/homeassistant/components/growatt_server/sensor.py

api.server_url = "https://server.growatt.com/"
#api.server_url = url

in the file - /usr/src/homeassistant/homeassistant/components/growatt_server/const.py

SERVER_URLS = [
"https://server-api.growatt.com/",
"https://server-us.growatt.com/",
"http://server.smten.com/",
"https://server.growatt.com/",
]

DEPRECATED_URLS = [

]

DEFAULT_URL = SERVER_URLS[0]"

and restart homeassistant, growatt integration

Can you indicate what you are running HA on? I put it on a Raspberry 4, imagege from HA directly onto flascard. But I don't have this folder structure. I couldn't change this.

I cannot adjust this in FileEditor.

That's why you can copy the entire folder into the config/custom_components folder, and make the changes there instead. This essentially will override the core integration version with our custom one with this work around.

ryklebaron commented 11 months ago

Same here. 9.3

I manage 3 other home assistant servers which use the growatt and those are also unavailable.

SimonWellsAus commented 11 months ago

For the people that cannot find the files to edit, follow these steps...

Step 1: Turn off protected mode for Terminal, to access the option, go to Settings, Addons, Advanced SSH, then flip the protection mode button.

Step 2: Open your terminal window, either putty or terminal and type: docker exec -it homeassistant bash

Step 3: Edit the above files, I use vi to edit the files. open the file by typing vi filename. move to the line you wish to edit, when ready to edit, press i then change the text as described above, when ready press esc ,arrow down to the bottom of the file and type :wq

Step 4: edit second file and repeat.

Step 5: Restart Home Assistant.

Step 6: Re-enable protection mode for terminal.

No need to copy the file elsewhere, just edit in place using the above method, takes about 3 mins.

Edit: I should have remined you to take a backup first just in case you have big fingwers :)

2nd Edit: You should setup a couple of additional usernames on the growatt site, just in case 1 gets blocked, you can simply use an alternative etc.. Personally I have 3 setup just in case... Never use your main login, if it gets blocked for any reason, you may loose access etc...

fweijers commented 11 months ago

Same here, The Netherlands.

IgloNL commented 11 months ago

Use samba share to make changes, this files is hidden

If i do it, i only see config or addons or media etc, nothing looks like "growatt_server" :-(

I had the same issue, i also dont run HA on a Pi. Thanks to all the replies above, I combined the two solutions and got it working like this.

  1. Used github desktop and cloned the Home Assistant Core using URL 'https://github.com/home-assistant/core.git'
  2. Once its cloned locally , copy the 'growatt_server' folder
image
  1. connect from a mac/pc to your HA using Samba , copy the growatt_server contents into config -> custom_components ->
image
  1. Open const.py in VS Code , add "https://server.growatt.com/", to SERVER_URLS and remove "https://server.growatt.com/" from DEPRECATED_URLS , save the file
image
  1. Edit the manifest.json and add a version number e.g.
image

save it.

  1. restart HA
  2. Now re-add the Growatt Integration, except this time you should see a cloud icon and the local integration icon

image

This shows your local integration has been recognised

  1. Now the new URL should be selectable

image

  1. Login using your Shine Tool Creds
  2. Growatt works again.

Thanks everyone for commenting above to work out this solution.

Do I need to remove the existing integration first? I followed the steps as described, but unfortunately when I add the integration again (without deleting the existing one) I don't get "the local integration icon" (the box).

MikePerth commented 11 months ago

Do I need to remove the existing integration first? I followed the steps as described, but unfortunately when I add the integration again (without deleting the existing one) I don't get "the local integration icon" (the box).

The local integration icon was visible on my existing Growatt integration after I followed the same steps and restarted HA.

I had to remove the existing integration and add it before it began to update correctly.

MikePerth commented 11 months ago

Thanks everyone for commenting above to work out this solution.

Thank you for your clear instructions on the solution. I have zero experience with code and could follow the step-by-step guide you created

Reaver1988 commented 11 months ago

Use samba share to make changes, this files is hidden

If i do it, i only see config or addons or media etc, nothing looks like "growatt_server" :-(

I had the same issue, i also dont run HA on a Pi. Thanks to all the replies above, I combined the two solutions and got it working like this.

  1. Used github desktop and cloned the Home Assistant Core using URL 'https://github.com/home-assistant/core.git'

  2. Once its cloned locally , copy the 'growatt_server' folder

  3. connect from a mac/pc to your HA using Samba , copy the growatt_server contents into config -> custom_components ->

  4. Open const.py in VS Code , add "https://server.growatt.com/", to SERVER_URLS and remove "https://server.growatt.com/" from DEPRECATED_URLS , save the file

  5. Edit the manifest.json and add a version number e.g.

save it.

  1. restart HA
  2. Now re-add the Growatt Integration, except this time you should see a cloud icon and the local integration icon

This shows your local integration has been recognised

  1. Now the new URL should be selectable

  2. Login using your Shine Tool Creds

  3. Growatt works again.

Thanks everyone for commenting above to work out this solution.

Hey,

thank you for your step by step direction. My Home Assistant does not recognize my custom integration :(
image --> here a screenshot of my samba share image Here my manifest.json image here a cuttoff from my sensor.py image and here a screenshot of my const.py image I restarted the Pi 4 (8gb) a few times now. Probably i forgot something?

IgloNL commented 11 months ago

Do I need to remove the existing integration first? I followed the steps as described, but unfortunately when I add the integration again (without deleting the existing one) I don't get "the local integration icon" (the box).

The local integration icon was visible on my existing Growatt integration after I followed the same steps and restarted HA.

I had to remove the existing integration and add it before it began to update correctly.

Hmm,

Use samba share to make changes, this files is hidden

If i do it, i only see config or addons or media etc, nothing looks like "growatt_server" :-(

I had the same issue, i also dont run HA on a Pi. Thanks to all the replies above, I combined the two solutions and got it working like this.

  1. Used github desktop and cloned the Home Assistant Core using URL 'https://github.com/home-assistant/core.git'

  2. Once its cloned locally , copy the 'growatt_server' folder

  3. connect from a mac/pc to your HA using Samba , copy the growatt_server contents into config -> custom_components ->

  4. Open const.py in VS Code , add "https://server.growatt.com/", to SERVER_URLS and remove "https://server.growatt.com/" from DEPRECATED_URLS , save the file

  5. Edit the manifest.json and add a version number e.g.

save it.

  1. restart HA
  2. Now re-add the Growatt Integration, except this time you should see a cloud icon and the local integration icon

This shows your local integration has been recognised

  1. Now the new URL should be selectable
  2. Login using your Shine Tool Creds
  3. Growatt works again.

Thanks everyone for commenting above to work out this solution.

Hey,

thank you for your step by step direction. My Home Assistant does not recognize my custom integration :( image --> here a screenshot of my samba share image Here my manifest.json image here a cuttoff from my sensor.py and here a screenshot of my const.py image I restarted the Pi 4 (8gb) a few times now. Probably i forgot something? image

Same here on a Raspberry 4 2GB

alparonl commented 11 months ago

I think https://server.growatt.com/ is down

IgloNL commented 11 months ago

I think https://server.growatt.com/ is down

link is not down.

Reaver1988 commented 11 months ago

I think https://server.growatt.com/ is down

Even if the link is invalid, down or whatever Home assistant should recognize my custom component Integration?

Levanterman commented 11 months ago

your manifest.json is missing a commaimage You have a missing comma in your manifest.json At the end of the "requirements" line, add a comma and restart HA Be sure to remove the existing Growatt integration first

tomton68 commented 11 months ago

How can change this in the Intergration for all users?

Indeed, who can update the Integration, such that the new URL is recognized?

alparonl commented 11 months ago

I think https://server.growatt.com/ is down

link is not down.

I get this error, or am I missing something?

File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 179, in _new_conn raise ConnectTimeoutError( urllib3.exceptions.ConnectTimeoutError: (<urllib3.connection.HTTPSConnection object at 0xdbfb0310>, 'Connection to server.growatt.com timed out. (connect timeout=None)')

The growatt dashboard is also not working, connection time-out for me, maybe my IP is blocked... The same URL works if I use my hotspot, so I think something is blocked by growatt

Reaver1988 commented 11 months ago

your manifest.json is missing a comma You have a missing comma in your manifest.json At the end of the "requirements" line, add a comma and restart HA Be sure to remove the existing Growatt integration first

Thank you that was the Problem. Now it works fine for me again :) image

IgloNL commented 11 months ago

My problem is solved to, only needed to delete te existing intregratie, added again, only i got net Indenty's.. But a lot more then before.

IgloNL commented 11 months ago

My problem is solved to, only needed to delete te existing intregratie, added again, only i got net Indenty's.. But a lot more then before.

And i Lost all my Solar Data at my Dashbord of this year # crying

alparonl commented 11 months ago

My problem is solved to, only needed to delete te existing intregratie, added again, only i got net Indenty's.. But a lot more then before.

And i Lost all my Solar Data at my Dashbord of this year # crying

Can you reach https://server.growatt.com/login with your browser? I think some IP ranges are blocked since yesterday

IgloNL commented 11 months ago

My problem is solved to, only needed to delete te existing intregratie, added again, only i got net Indenty's.. But a lot more then before.

And i Lost all my Solar Data at my Dashbord of this year # crying

Can you reach https://server.growatt.com/login with your browser? I think some IP ranges are blocked since yesterday

Yes i can, try it op your Mobile Device with LTE

ULtiMat3DruMa commented 11 months ago

All the entities are screwed up on mine, they are all energy_number not the way they used to be, growatt be dicks

IgloNL commented 11 months ago

All the entities are screwed up on mine, they are all energy_number not the way they used to be, growatt be dicks

Yes indeed. its all gone..

alparonl commented 11 months ago

My problem is solved to, only needed to delete te existing intregratie, added again, only i got net Indenty's.. But a lot more then before.

And i Lost all my Solar Data at my Dashbord of this year # crying

Can you reach https://server.growatt.com/login with your browser? I think some IP ranges are blocked since yesterday

Yes i can, try it op your Mobile Device with LTE

I can reach it fine from a server with a completely different IP, so I do think my IP is blocked since yesterday

I see that the shinelink logger is offline also image

ULtiMat3DruMa commented 11 months ago

looks like they are actively fucking with what the api showing, one minute there's 37 entities the next there is 3

Edit: perhaps its just slow or broken I keep getting error 500 on the native site, and the shine app doesn't work in a stunning surprise to no one

Wim-Zoeteman commented 11 months ago

Since this morning I can't even load the Growatt's home page growatt.com. Thus not only unable to login at the server.growatt.com site. Neither through shinephone app via mobile network. (Also KPN network, same as for my home but of-course different IP)

Hope the root cause will be found and solved swiftly.

bteselle commented 11 months ago

The (ios) Growatt ShinePhone app is also malfunction, so perhaps it is a global problem?

Wim-Zoeteman commented 11 months ago

And all of a sudden I can log in again. (through web browser on server.growatt.com Measurements are missing from 8:30 till 13:40 CET.

Growatt Server API (via HACS) is working on the server.growatt.com. Now let's see when the HA core Integration version of Growatt Server will be working. (I like to keep my history ;-)

alparonl commented 11 months ago

Yes, can confirm it's working again

Spenceralph commented 11 months ago

the original integration?

alparonl commented 11 months ago

With server.growatt.com, didn't try the original yet

Spenceralph commented 11 months ago

Trying to avoid all the modifications :-)

alparonl commented 11 months ago

Just reverted to the original integration, it works again ;-)

ULtiMat3DruMa commented 11 months ago

Just reverted to the original integration, it works again ;-)

Mine doesn't, says 'unknown error'

DieterC1984 commented 11 months ago

same here, not working yet

marcmanusch commented 11 months ago

Not working here ...

alparonl commented 11 months ago

I just reloaded the integration with the adjustments back to the original, and didn't reboot yet and it still worked. I will try with reboot as well.

Tabularasa84 commented 11 months ago

your manifest.json is missing a comma You have a missing comma in your manifest.json At the end of the "requirements" line, add a comma and restart HA Be sure to remove the existing Growatt integration first

Thank you that was the Problem. Now it works fine for me again :) image

I have also done everything according to the instructions and it has also worked, only the entities are now called differently than before. Is it possible to restore the original ones? Screenshot 2023-09-27 164133

Klumpen58 commented 11 months ago

Die Shine Phone App und das Wep Portal funktionieren bei mir ohne Probleme, das Web Portal auch mit https://server-api.growatt.com/. Will ich jedoch die Integration in HA wieder einrichten, kommt weiterhin "unbekannter Fehler".

Es wäre angebracht, wenn "Growatt Server" für alle so angepasst wird, dass die Integration über die URL server.growatt.com funktioniert. Denn anscheinend ist die Verwendung diese Url derzeit die einzige Möglichkeit, die Integration wieder zu installieren.

Vielen Dank an jene, die sich gerade um eine Lösung bemühen, auch wenn diese nicht Jedermanns Sache ist. Nicht jeder möchte oder kann die Dateien selbst manipulieren.

Die Bitte geht also an die/den Programmierer der Integration, diese entsprechend zu updaten.

afv13-15 commented 11 months ago

it looks like this adress has been blocked: https://server-api.growatt.com/

this server works fine, but i can't edit the server in the integration. https://server.growatt.com/

Jozziej commented 11 months ago

Use samba share to make changes, this files is hidden

If i do it, i only see config or addons or media etc, nothing looks like "growatt_server" :-(

I had the same issue, i also dont run HA on a Pi. Thanks to all the replies above, I combined the two solutions and got it working like this.

  1. Used github desktop and cloned the Home Assistant Core using URL 'https://github.com/home-assistant/core.git'
  2. Once its cloned locally , copy the 'growatt_server' folder
image
  1. connect from a mac/pc to your HA using Samba , copy the growatt_server contents into config -> custom_components ->
image
  1. Open const.py in VS Code , add "https://server.growatt.com/", to SERVER_URLS and remove "https://server.growatt.com/" from DEPRECATED_URLS , save the file
image
  1. Edit the manifest.json and add a version number e.g.
image

save it.

  1. restart HA
  2. Now re-add the Growatt Integration, except this time you should see a cloud icon and the local integration icon

image

This shows your local integration has been recognised

  1. Now the new URL should be selectable

image

  1. Login using your Shine Tool Creds
  2. Growatt works again.

Thanks everyone for commenting above to work out this solution.

I only performed till step 6 and after that the integration worked with the new (deprecated) url again. When you remove your existing integration and add it again, you will lose your sensors and also your database history. Therefore a empty Energy Dashboard of your Growatt Inverter.

jagdtigger commented 11 months ago

Any updates? Mine still refusing to work :S . (server.growatt.com accessible from browser)

trothe commented 11 months ago

Seeing the same problem here. Too bad we can't directly communicate with the inverter rather than relying on the cloud.

parad0xnasha commented 11 months ago

Any updates? Mine still refusing to work :S . (server.growatt.com accessible from browser)

Define "refusing to work", such that someone may point out what your doing wrong...?

Seeing the same problem here. Too bad we can't directly communicate with the inverter rather than relying on the cloud.

You too are simply saying "mines refusing to work also." Unfortunately maybe, but if you'd like to put your hand up to develop it, or until someone with the know-how finds cloud reliability for Growatt inverter data SO inconvenient to justify spending the time and skillset reinventing a working wheel, to realise that it may no longer be possible (up until about a week ago, I was still connected and talking to my Inverter, without a Growatt account (so it was at least possible), though I have a feeling that my Conversation with Growatt support lead to this little blip with addressing periodically, and this door now closed. Regardless, the answer to this question is, talk to the cloud, big deal.

MikePerth commented 11 months ago

Seeing the same problem here. Too bad we can't directly communicate with the inverter rather than relying on the cloud.

It is possible - https://github.com/johanmeijer/grott

MikePerth commented 11 months ago

Any updates? Mine still refusing to work :S . (server.growatt.com accessible from browser)

https://github.com/home-assistant/core/issues/100874#issuecomment-1736234793 - follow this fix and it will work.

parad0xnasha commented 11 months ago

Is my receipt of the following error because I don't have any YAML relating to the inverter in any dashboards yet? I assumed I'd previously seen, 'if default=none create said default'?

Logger: homeassistant.setup
Source: setup.py:283
First occurred: 11:58:51 AM (1 occurrences)
Last logged: 11:58:51 AM

Setup failed for custom integration growatt_server: No setup or config entry setup function defined.

But my understanding of the general flow of things may still be adapting - I don't know why but I've found it difficult to adjust - OOP still has PTSD hooks into me!

parad0xnasha commented 11 months ago

Seeing the same problem here. Too bad we can't directly communicate with the inverter rather than relying on the cloud.

It is possible - https://github.com/johanmeijer/grott

Well I'll be darned! I thought might be the case, but given that this integration is a native hacs integration, that it would be the most complete and effective solution, but ideally, the HA inclusion needs to ask the user for an online/offline deployment choice is made, then tumbles out into GROTT or growatt_server relevantly,

Right? I need to get a few thoughts from users before trying to make that happen though..

jagdtigger commented 11 months ago

Define "refusing to work", such that someone may point out what your doing wrong...?

Says unavailable while the credentials havent changed and server.growatt.com is accessible from same network....

Ragstaaf commented 11 months ago

I performed all the steps and have growatt local now. But It only shows 1 item and no devices or entities... Not sure what went wrong. 2023-09-28_09h19_27

birgerj commented 11 months ago

Any updates? Mine still refusing to work :S . (server.growatt.com accessible from browser)

#100874 (comment) - follow this fix and it will work.

Can it be that this doesn't work anymore? Just tried it and after I enter credentials and set server I get Unknown error occurred.