BJReplay / ha-solcast-solar

Solcast Integration for Home Assistant
Apache License 2.0
177 stars 34 forks source link

Solcast Integration doesn't load any values #86

Closed lucode closed 3 months ago

lucode commented 3 months ago

The problem

I did install the integration yesterday including the call automation, but I don't get any data from Solcast, image

What version of Solcast Integration has the issue?

v4.0.31

What version of Home Assistant are you using?

2024.7.2

Diagnostics information

config_entry-solcast_solar-01J2PG0CF7HB0EC7G4J3RKZZ57.json

Logs debug/info/error output

I guess the answer lies down in this log section:

  "data": {
    "tz_conversion": {
      "__type": "<class 'zoneinfo.ZoneInfo'>",
      "repr": "zoneinfo.ZoneInfo(key='Europe/Paris')"
    },
    "used_api_requests": 0,
    "api_request_limit": 10,
    "rooftop_site_count": 0,
    "forecast_hard_limit_set": false,
    "data": [
      {
        "siteinfo": {},
        "last_updated": "2024-07-15T12:04:30.009160+00:00",
        "version": 4
      },

Additional information

I did setup one Home PV System in Solcast.

autoSteve commented 3 months ago

The forecast data has definitely not loaded, @lucode. This: "siteinfo": {}. I am guessing that your Solcast sites have not loaded correctly, and the integration needs this to function.

What is in the HA logs? (Debug logs would be preferable, but have a look without. https://github.com/BJReplay/ha-solcast-solar/discussions/38#discussioncomment-9792389)

Santé.

autoSteve commented 3 months ago

Further, "rooftop_site_count": 0 is a definite indicator.

This could be caused because of an API call to get the rooftop sites has failed. Solcast are returning more and more "429/Too busy" messages of late, and you may have hit this.

It looks like the api_request_limit has been successfully received, so that call might have worked (the default for the integration is ten).

The API usage, and also the sites are cached after one successful 'get', so recurrence should be less non-existant for future starts as long as you can get the sites cached too.

A suggestion? Per the readme, restart the integration (or HA) multiple times if necessary and see if this goes away.

autoSteve commented 3 months ago

I also wonder whether you are getting timeouts when connecting to Solcast, and these would be shown in the HA log.

I had another user with IPv6 issues the other day, and disabling IPv6 (because it was misconfigured) solved connection issues that were getting a timeout.

All of this is in the troubleshooting discussion, and readme. https://github.com/BJReplay/ha-solcast-solar/discussions/38.

lucode commented 3 months ago

Ok thanks for your suggestion. According to the HA logs the API calls are having problems. Cache is involved, but I did restart HA several time since yesterday.

image

I don't use IPv6.

autoSteve commented 3 months ago

I don't use IPv6

You don't use it, but is it turned on in the Home Assistant network settings? (IPv6 may not be anything to do with this, but it's the only thing I can think of without much more detail.) These timeouts are clearly indicating a network issue preventing connection, and not an integration fault.

Your install looks like HAOS inside a Proxmox virtual machine on Intel or AMD. This very closely mirrors my setup.

You likely installed the integration manually using HACS, which would have to involve good network to the Internet. This makes me think it is possibly a DNS lookup issue once the integration is running.

From the HAOS command line, I am guessing that running this will produce the sites configured, and this is the call that the integration makes:

curl -X GET -H 'content-type: application/json' https://api.solcast.com.au/rooftop_sites?api_key=YOURAPIKEYHERE

From the command line this will likely use an IPv4 DNS lookup, and succeed. ping solcast.com.au will also likely give an IPv4 address as an answer.

I have seen oddities very recently involving IPv6, which I'm fairly certain uses a different DNS call to resolve the name to an address. If DNS is giving a bad answer, then a connection won't work, so I'd double check your network settings in HA.

I do have IPv6 enabled, because my network is correctly set up to use it via my Internet provider. I also run my own DNS servers. Confirm that it is disabled for you.

image

Here you can see the IPv6 and IPv4 addresses in Proxmox:

image
lucode commented 3 months ago

Thank you very much for your detailed answer. I did try the curl get command in my laptop and it works. In HAOS (Proxmox VM) I can't do it, because HAOS doesn't allow to install apps.

But there is an issue with my IPv6 setup. My router Fritxbox has a disabled IPv6 my Internet Router also and I did deactivate it in HA. But I still see an IPv6 address in the Proxmox VM. Strange no idea what happened and if try to SSH into HAOS I get an Error Couldn't resolve Hostname in IPv6. But all other stuff in HA works fine. Here the last logs.

Logger: custom_components.solcast_solar.solcastapi
Source: custom_components/solcast_solar/solcastapi.py:192
integration: Solcast PV Forecast (documentation, issues)
First occurred: 15 July 2024 at 13:57:35 (2 occurrences)
Last logged: 09:29:36

SOLCAST - sites_data Exception error: Traceback (most recent call last): File "/config/custom_components/solcast_solar/solcastapi.py", line 167, in sites_data LOGGER.error(f"SOLCAST - cached sites data is not yet available to cope with Solcast API being too busy - at least one successful API call is needed") ^^^^^^ NameError: name 'LOGGER' is not defined. Did you mean: '_LOGGER'?

Logger: custom_components.solcast_solar.solcastapi
Source: custom_components/solcast_solar/solcastapi.py:250
integration: Solcast PV Forecast (documentation, issues)
First occurred: 15 July 2024 at 13:57:51 (3 occurrences)
Last logged: 12:00:04
SOLCAST - sites_usage error: Traceback (most recent call last): File "/config/custom_components/solcast_solar/solcastapi.py", line 239, in sites_usage raise Exception(f"SOLCAST - sites_usage: gathering site data failed. Request returned Status code: {status} - Response: {resp_json}.") Exception: SOLCAST - sites_usage: gathering site data failed. Request returned Status code: 404 - Response: {'response_status': {'error_code': 'NotFound', 'message': 'ApiKey does not exist', 'errors': []}}.
autoSteve commented 3 months ago

This is super weird in the log...

(The other one about 'LOGGER' not existing is me. Sorry... 🤦🏻)

'ApiKey does not exist'. Whaaat? Is Your API key correct?

But then IPv6 stuff? Super confused.

lucode commented 3 months ago

I did just delete the integration and after reinstallation it works now. ;) I'm pretty sure that I used the correct API key, but sometime a blank character sneaks in. Would be helpfull to have a check routine in the setup to ensure that the communication works. Again thank you very much.