dreautall / ha-stromnetzgraz

Home Assistant Custom Component for Stromnetz Graz
MIT License
17 stars 1 forks source link

'dict' object has no attribute 'discard' #6

Closed wieluk closed 1 year ago

wieluk commented 1 year ago

On lastest homeassitant version (2023.6.2) I am getting this error:

Unexpected error fetching Stromnetz Graz Sensor data: 'dict' object has no attribute 'discard'

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 283, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/stromnetzgraz/sensor.py", line 166, in _async_update_data
    await self._insert_statistics()
  File "/config/custom_components/stromnetzgraz/sensor.py", line 185, in _insert_statistics
    last_stats = await get_instance(self.hass).async_add_executor_job(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  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/recorder/statistics.py", line 1806, in get_last_statistics
    return _get_last_statistics(
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/recorder/statistics.py", line 1770, in _get_last_statistics
    metadata_ids = _extract_metadata_and_discard_impossible_columns(metadata, types)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/recorder/statistics.py", line 1526, in _extract_metadata_and_discard_impossible_columns
    types.discard("mean")
    ^^^^^^^^^^^^^
AttributeError: 'dict' object has no attribute 'discard'
dreautall commented 1 year ago

Thanks for bringing it up, I'm always a bit behind on HomeAssistant updates 😄