nelbs / solaredge-forecast

Home assistant component that forecasts the total solar energy generation for a specified time period.
MIT License
2 stars 1 forks source link

Cannot connect to API #1

Open markuswesterberg opened 2 months ago

markuswesterberg commented 2 months ago

I have installed the integration successfully and configuration goes smoothly but the integration fails to connect via the API. What am I doing wrong? Says failed and no entities or units. Home_Assistant-fail-solaredge-forecast-screenshot

nelbs commented 2 months ago

Have you enabled API access in the Solaredge web portal? And do you have at least 1 year of historical data?

You could try if the api works with the example from the solaredge python package. https://pypi.org/project/solaredge/

markuswesterberg commented 2 months ago

Looks like this in admin in SolarEdge. API-key greyed out.

Administration_screen

Not sure how to use the python package you provided, sorry.

nelbs commented 2 months ago

For me it is not greyed out but that shouldn't be a problem i think.

Are there any warnings or errors in the logs?

markuswesterberg commented 2 months ago

No, I meant that I have mysself greyed out the sensitive data (key etc.) :)

I don't know if you can help and see something from below from the log:

2024-09-05 14:48:16.543 DEBUG (MainThread) [custom_components.solaredge_forecast] Finished fetching Solaredge Forecast data in 0.304 seconds (success: False) 2024-09-05 14:48:18.061 WARNING (MainThread) [custom_components.localtuya.common] Missing device configuration for device_id 1615871624a1602a5875 2024-09-05 14:48:18.067 WARNING (MainThread) [custom_components.localtuya.common] [511...3d1] Failed to connect to 10.0.0.23: [Errno 113] Connect call failed ('10.0.0.23', 6668) 2024-09-05 14:48:18.068 WARNING (MainThread) [custom_components.localtuya.common] [511...0f3] Failed to connect to 10.0.0.54: [Errno 113] Connect call failed ('10.0.0.54', 6668) 2024-09-05 14:48:21.515 WARNING (MainThread) [custom_components.localtuya.common] Missing device configuration for device_id 65035601ecfabc6689da 2024-09-05 14:48:22.794 WARNING (MainThread) [custom_components.localtuya.common] Missing device configuration for device_id 1615871624a1602a5875 2024-09-05 14:48:24.386 WARNING (MainThread) [custom_components.localtuya.common] [bfc...hpl] Failed to connect to 10.0.0.44: [Errno 110] Connect call failed ('10.0.0.44', 6668) 2024-09-05 14:48:25.860 WARNING (MainThread) [custom_components.localtuya.common] Missing device configuration for device_id 65035601ecfabc6689da 2024-09-05 14:48:28.528 WARNING (MainThread) [custom_components.localtuya.common] Missing device configuration for device_id 1615871624a1602a5875 2024-09-05 14:48:30.890 WARNING (MainThread) [custom_components.localtuya.common] Missing device configuration for device_id 65035601ecfabc6689da 2024-09-05 14:48:32.783 WARNING (MainThread) [custom_components.localtuya.common] Missing device configuration for device_id 1615871624a1602a5875 2024-09-05 14:48:36.170 WARNING (MainThread) [custom_components.localtuya.common] Missing device configuration for device_id 65035601ecfabc6689da 2024-09-05 14:48:37.717 WARNING (MainThread) [custom_components.localtuya.common] Missing device configuration for device_id 1615871624a1602a5875 2024-09-05 14:48:37.931 ERROR (MainThread) [custom_components.solaredge_forecast] Unexpected error fetching Solaredge Forecast data Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/pandas/core/indexes/base.py", line 3791, in get_loc return self._engine.get_loc(casted_key) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "index.pyx", line 152, in pandas._libs.index.IndexEngine.get_loc File "index.pyx", line 181, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/hashtable_class_helper.pxi", line 4484, in pandas._libs.hashtable.Int32HashTable.get_item File "pandas/_libs/hashtable_class_helper.pxi", line 4508, in pandas._libs.hashtable.Int32HashTable.get_item KeyError: 12

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 354, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/solaredge_forecast/init.py", line 126, in _async_update_data data = await self.hass.async_add_executor_job( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, *self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/solaredge_forecast/solaredgeforecast/init.py", line 22, in init data = self.get_solar_forecast() ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/solaredge_forecast/solaredgeforecast/init.py", line 77, in get_solar_forecast daily['energy'] = daily.apply(average, axis=1) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pandas/core/frame.py", line 10034, in apply return op.apply().finalize(self, method="apply") ^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pandas/core/apply.py", line 837, in apply return self.apply_standard() ^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pandas/core/apply.py", line 965, in apply_standard results, res_index = self.apply_series_generator() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pandas/core/apply.py", line 981, in apply_series_generator results[i] = self.func(v, self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/solaredge_forecast/solaredgeforecast/init.py", line 76, in average return averages[row["month"]]


  File "/usr/local/lib/python3.12/site-packages/pandas/core/series.py", line 1040, in __getitem__
    return self._get_value(key)
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pandas/core/series.py", line 1156, in _get_value
    loc = self.index.get_loc(label)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pandas/core/indexes/base.py", line 3798, in get_loc
    raise KeyError(key) from err
KeyError: 12
2024-09-05 14:48:37.934 DEBUG (MainThread) [custom_components.solaredge_forecast] Finished fetching Solaredge Forecast data in 0.292 seconds (success: False)
2024-09-05 14:48:40.868 WARNING (MainThread) [custom_components.localtuya.common] Missing device configuration for device_id 65035601ecfabc6689da
2024-09-05 14:48:42.709 WARNING (MainThread) [custom_components.localtuya.common] Missing device configuration for device_id 1615871624a1602a5875
2024-09-05 14:48:45.888 WARNING (MainThread) [custom_components.localtuya.common] Missing device configuration for device_id 65035601ecfabc6689da
nelbs commented 2 months ago

seems something went wrong with the calculation. Do you have at least 1 year of data from solaredge? And could you share your configuration (without the id and api)?

markuswesterberg commented 2 months ago

Yes, I believe I should have about 14 months of data.

Which file do you need? See below:

Cursor_och_Studio_Code_Server_–_Home_Assistant

nelbs commented 2 months ago

I mean the configuration variables from the integration, like these...

image

markuswesterberg commented 2 months ago

Ah, yes I used the same as you except I didn't put anything in the OPTIONAL last box.

nelbs commented 2 months ago

Unfortunately i cant reproduce your issue. I removed my input in the last field but everything keeps working. You could try to change config parameters or add the start date in the last box.

markuswesterberg commented 2 months ago

I have no issue connecting to the API with SolarEdges own integration so this definitely is an issue specific to this integration. Could it have something to do with the fact that I changed hardware for the inline meter when I upgraded the system last month to backup-ready with the backup-unit with built-in meter you think?

nelbs commented 2 months ago

The only thing I can think of is that the integration does not have enough data to make the forecast. Based on this line

File “/usr/local/lib/python3.12/site-packages/pandas/core/indexes/base.py”, line 3798, in get_loc raise KeyError(key) from err KeyError: 12.

I suspect it cannot retrieve the data for the 12th month. If you look in the SolarEdge app, do you see data for more than a year?”

markuswesterberg commented 2 months ago

I have data starting July 2023. See below from the app:

IMG_1747

markuswesterberg commented 1 month ago

Any more ideas? :)

nelbs commented 1 month ago

Well I noticed that your app looks different than mine. I also dont have a battery. Maybe the structure of the data you receive from the api is also different. Because I cannot debug the errors you get I is hard for me to solve it.

markuswesterberg commented 1 month ago

OK, sure I understand. It's a pity because I fail to get good enough forecasts with other integrations it seems and I would really like to get this integration to work!

markuswesterberg commented 1 month ago

Attaching the debug log here if you can see something from that?

home-assistant_solaredge_forecast_2024-09-10T14-14-57.954Z.log

markuswesterberg commented 3 weeks ago

Tried that as well but won't work with the field filled out either. May be something wrong with the data from my system, even though I can see history in the monitoring from more than a year ago.

--

Markus Westerberg

Den ons 9 okt. 2024 kl 15:53 skrev Anthony @.***>:

I just installed and was seeing exact same problem. During setup, I left the last optional field empty. I then noticed in the failing query string that it had defaulted to looking for data since 2017! I re-ran the integration configuration and added a date into the optional field (I have about 5 years of data so just went with 01012020) and then the integration started to work.

— Reply to this email directly, view it on GitHub https://github.com/nelbs/solaredge-forecast/issues/1#issuecomment-2402415589, or unsubscribe https://github.com/notifications/unsubscribe-auth/BCOLLL25KQJEIPLRR2CZDJTZ2UYONAVCNFSM6AAAAABNV6WBG2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMBSGQYTKNJYHE . You are receiving this because you authored the thread.Message ID: @.***>