ha-solcast-solar: Setup fails after update from 4.2.7 to 4.3.0 or 4.3.2
Help us help you.
This bug report requests debug logs. If you don’t provide them don’t expect any help, unless you are an expert developer and know why they’re not required. And, if you’re an expert developer, know that they’re not required, and you’re wrong, don’t expect any help.
Note the instructions for getting debug logs, and follow them.
Fill in all of the data requested.
By failing to provide debug logs, you’re providing us with permission to ignore you, or, at best, say debug logs required, and then ignore you. By being lazy and not bothering to fill in data, you’re encouraging us to be lazy and not bother responding.
Describe the bug
A clear and concise description of what the bug is.
After updating from 4.2.7 to 4.3.2 the setup fails with following error:
Logger: homeassistant.config_entries
Source: config_entries.py:753
First occurred: 11:49:23 (2 occurrences)
Last logged: 11:49:56
Error setting up entry Solcast Solar for solcast_solar
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 753, in __async_setup_with_context
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/solcast_solar/__init__.py", line 287, in async_setup_entry
await solcast.get_sites_and_usage()
File "/config/custom_components/solcast_solar/solcastapi.py", line 888, in get_sites_and_usage
remove_orphans(multi_key_sites, multi_sites)
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/solcast_solar/solcastapi.py", line 829, in remove_orphans
component_parts.group(1) + "******" + component_parts.group(2)[:6] + component_parts.group(3),
^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'group'
Logs
2025-04-02 11:58:01.061 DEBUG (MainThread) [custom_components.solcast_solar] Auto-update options: {'auto_update': 1}
2025-04-02 11:58:01.061 DEBUG (MainThread) [custom_components.solcast_solar] Estimate to use options: {'key_estimate': 'estimate'}
2025-04-02 11:58:01.061 DEBUG (MainThread) [custom_components.solcast_solar] Attribute options: {'attr_brk_detailed': False, 'attr_brk_estimate': False, 'attr_brk_estimate10': True, 'attr_brk_estimate90': True, 'attr_brk_halfhourly': True, 'attr_brk_hourly': True, 'attr_brk_site': True}
2025-04-02 11:58:01.061 DEBUG (MainThread) [custom_components.solcast_solar] Custom sensor options: {'customhoursensor': 1}
2025-04-02 11:58:01.061 DEBUG (MainThread) [custom_components.solcast_solar] Hard limit: {'hard_limit_api': '100.0'}
2025-04-02 11:58:01.063 DEBUG (MainThread) [custom_components.solcast_solar.solcastapi] Configuration directory is /config
2025-04-02 11:58:01.063 DEBUG (MainThread) [custom_components.solcast_solar] Session headers: {'Accept': 'application/json', 'User-Agent': 'ha-solcast-solar-integration/4.3'}
2025-04-02 11:58:01.111 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Solcast Solar for solcast_solar
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 753, in __async_setup_with_context
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/solcast_solar/__init__.py", line 287, in async_setup_entry
await solcast.get_sites_and_usage()
File "/config/custom_components/solcast_solar/solcastapi.py", line 888, in get_sites_and_usage
remove_orphans(multi_key_sites, multi_sites)
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/solcast_solar/solcastapi.py", line 829, in remove_orphans
component_parts.group(1) + "******" + component_parts.group(2)[:6] + component_parts.group(3),
^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'group'
To Reproduce
Steps to reproduce the behavior:
Updated, restart as requested from Homeassistant and then it failed
I confirm:
- [✅] I have attached debug logs
- [✅] I have embedded debug logs in the issue description (enclosed in tick marks ``` for proper formatting)
- Confirmed debug logs are not required for this issue
Make sure you include logs from HA listing the output from the Solcast integration showing the error - this is particularly useful in debugging issues and helping to determine whether the issue is with the integration or the Solcast service
Solcast Integration Version
- Integration Version [4.3.2]
Additional context
Add any other context about the problem here.
I did a rolback to 4.3.0 add it happens there too, same error, a rollback to 4.2.7 works for me. Have i done anything wrong in the setup?
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15
Thank you very much that did it! I had a third solcast-sites-third-api-key.json and solcast-usage-third-api-key.json file that i didnt use anymore, so after removing them and updating to 4.3.2 all is working now.
Thank you for the very fast and precise help from you and also a big THANKS for such an awesome Integration 😄
Thanks ill try tonight and report back if i see the any meaningful accuracy. Also here is the old api key, i regenerated it, so that should be fine:
TuWp12pVZ2yy8bB33BqrCb7pgk--_n6Xhopefully that helps and confirms your findings.
More forecast updates doesn’t generally equal more quality, but I get your motivation. Ten API calls per day per site for free is pretty stingy, but Soldast do make their brilliant services free for hobbyists, and that is most welcome. They are usually great, and far better than forecast.solar. No forecast is 100%, or we’d all be winning the football tips and raking in much money…
Site set-up is most significant. With azimuth/tilt key. It may be that you got that wrong, or it may be that Solcast did get it wrong. 🫢 But that is by the by. It’s a forecast.
Thanks for the brilliant feedback, which will ensure that this forecasting integration works better in future!
Just a quick follow up, the upper three are from forecast solar and the next three from solcast and the last the actual production from today.
Yesterday and today solcast was more accurate than the base forecast solar from Homeassistant so I would say I’ll switch to solcast completely. I’m also very excited about the new site exclusion feature for the energy dashboard.
Great work 👍🏻
This is absolutely confirmed, however it has exposed another weakness, so thanks for sharing the actual old key. Logging must obfuscate any API keys, yet this one gets shown clear as day. More to do…
Yep. Thurrs ya problem! Hyphens and underscores, so the linked PR will fix the issue for any who would have hit this again in future.
A theory that I have is that these code lines have “always” been erroring for you in the past (even using v4.2.7), but just being logged. One of the changes that occurred in v4.3.0 was the removal of several
try/exceptblocks that catch and deal with code errors.The reason for removal is that I basically wanted to expose any of these “passive” errors that didn’t kill the integration so that they might be properly dealt with. The PyTest code developed caught many, but PyTest is only as good as the tests it is instructed to do. I may have missed something.
I believe that you’ve just earned a spotters award for finding a latent issue that I’ve missed.
Sadly there is no prize.