Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: min() iterable argument is empty #158

Closed
olafz opened this issue Jun 8, 2024 · 8 comments
Closed

ValueError: min() iterable argument is empty #158

olafz opened this issue Jun 8, 2024 · 8 comments

Comments

@olafz
Copy link

olafz commented Jun 8, 2024

Since two days, the update for the ENTSO-E day-ahead prices fails with a ValueError: min() iterable argument is empty. See the stack-trace below for the full error.

Logger: homeassistant.helpers.entity
Source: helpers/entity.py:941

Update for sensor.entso_e_average_electricity_price_today fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 941, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1289, in async_device_update
    await self.async_update()
  File "/config/custom_components/entsoe/sensor.py", line 134, in async_update
    self._attr_extra_state_attributes = {x: self.coordinator.processed_data()[x] for x in self.coordinator.processed_data() if x not in invalid_keys and x not in existing_entities}
                                                                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/entsoe/coordinator.py", line 171, in processed_data
    "min_price": self.get_min_price(filtered_hourprices),
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/entsoe/coordinator.py", line 213, in get_min_price
    return min(hourprices.values())
           ^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: min() iterable argument is empty
@olafz
Copy link
Author

olafz commented Jun 9, 2024

Some extra debugging info:

WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to open inside the event loop by custom integration 'entsoe' at custom_components/entsoe/coordinator.py, line 97: yesterday = pd.Timestamp.now(tz=str(time_zone)).replace(hour=0, minute=0, second=0) - pd.Timedelta(days = 1) (offender: /usr/local/lib/python3.12/site-packages/pytz/__init__.py, line 108: return open(filename, 'rb')), please create a bug report at https://github.com/JaccoR/hass-entso-e/issues

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 223, in <module>
    sys.exit(main())
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 209, in main
    exit_code = runner.run(runtime_conf)
  File "/usr/src/homeassistant/homeassistant/runner.py", line 190, in run
    return loop.run_until_complete(setup_and_run_hass(runtime_config))
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 672, in run_until_complete
    self.run_forever()
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 639, in run_forever
    self._run_once()
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1988, in _run_once
    handle._run()
  File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/src/homeassistant/homeassistant/setup.py", line 165, in async_setup_component
    result = await _async_setup_component(hass, domain, config)
  File "/usr/src/homeassistant/homeassistant/setup.py", line 447, in _async_setup_component
    await asyncio.gather(
  File "/usr/src/homeassistant/homeassistant/setup.py", line 449, in <genexpr>
    create_eager_task(
  File "/usr/src/homeassistant/homeassistant/util/async_.py", line 37, in create_eager_task
    return Task(coro, loop=loop, name=name, eager_start=True)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 742, in async_setup_locked
    await self.async_setup(hass, integration=integration)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 594, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/config/custom_components/entsoe/__init__.py", line 33, in async_setup_entry
    await entsoe_coordinator.async_config_entry_first_refresh()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 277, in async_config_entry_first_refresh
    await self._async_refresh(
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 312, in _async_refresh
    self.data = await self._async_update_data()
  File "/config/custom_components/entsoe/coordinator.py", line 97, in _async_update_data
    yesterday = pd.Timestamp.now(tz=str(time_zone)).replace(hour=0, minute=0, second=0) - pd.Timedelta(days = 1)

@qwerk
Copy link

qwerk commented Jun 9, 2024

Just to inform, I have the same issue. Also since two days.

@AJKoster
Copy link

AJKoster commented Jun 9, 2024

Same error here...

@Fidelity88
Copy link

Fidelity88 commented Jun 9, 2024

Same here since about 2 or 3 days. It works if I completely add it again. But then reappears a day later

@SjaakPeer
Copy link

Same here, with fully updated HA: Attributes of "Average electricity price today" appear to be stuck on the data of a few day's back.

@Fidelity88
Copy link

This workaround fixed my issue for now:
#155 (comment)

@SjaakPeer
Copy link

This workaround fixed my issue for now: #155 (comment)

Yes, fixed the issue..... for now.....

@Roeland54
Copy link
Collaborator

v0.4.0 is released this version contains fixes that solve a lot of warnings and known issues. This issue is probably also solved.
Please update to the latest version.
Closing this issue for now. If you still have issue please feel free to open a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants