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

Intermittent error: "Unexpected error fetching luxtronik2 data: TypeError: 'datetime.time' object is not iterable" #287

Closed
DrBlokmeister opened this issue Oct 27, 2024 · 3 comments

Comments

@DrBlokmeister
Copy link

After updating to the latest 2024.10.5-Beta, I sometimes get errors in my HA logs that point towards datatime.time object not being iterable:

2024-10-26 22:06:59.645 ERROR (MainThread) [custom_components.luxtronik2] Unexpected error fetching luxtronik2 data
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/luxtronik2/coordinator.py", line 99, in _async_update_data
    self.data = await self._async_read_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/luxtronik2/coordinator.py", line 103, in _async_read_data
    return await self._async_read_or_write(False, None, None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/luxtronik2/coordinator.py", line 126, in _async_read_or_write
    self.async_set_updated_data(data)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 489, in async_set_updated_data
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in async_update_listeners
    update_callback()
  File "/config/custom_components/luxtronik2/sensor.py", line 328, in _handle_coordinator_update
    attr[SA.EVU_DAYS] = self._wd_txt(
                        ^^^^^^^^^^^^^
  File "/config/custom_components/luxtronik2/sensor.py", line 443, in _wd_txt
    for i in value:
TypeError: 'datetime.time' object is not iterable

In less than 24 hours, this error appeared over 800 times.

Likely as a result of this, the majority of tapwater sensors are unavailable. Sensors that are unavailable are:

  • switch.heatpump_domestic_water (0004 parameters.ID_Ba_Bw_akt)
  • number.heatpump_tapwater_target_temperature ()
  • binary_sensor.heatpump_dhw_charging_pump (0046 calculations.ID_WEB_ZIPout)
  • binary_sensor.heatpump_tapwater_circulation_pump (0046 calculations.ID_WEB_ZIPout)
  • binary_sensor.heatpump_tapwater_recirculation_pump (0038 calculations.ID_WEB_BUPout)
  • number.heatpump_tapwater_hysteresis
  • number.heatpump_tapwater_thermal_desinfection_target

The following entities stay available:

  • water_heater.heatpump_domestic_water
  • sensor.heatpump_tapwater_heat_amount (0152 calculations.ID_WEB_WMZ_Brauchwasser)
  • sensor.heatpump_tapwater_operation_hours (0065 calculations.ID_WEB_Zaehler_BetrZeitBW)

I did not check for other unavailable sensors in this integration.

I restarted home assistant multiple times but that did not solve the issue.

I added some logging statements to the integration to try to pinpoint the issue, an example of such a logging entry is below:

    def _wd_txt(self, value: list) -> str:
        if not isinstance(value, list):
            LOGGER.error(f"SA.EVU_DAYS expected to be a list, but got {type(value).__name__}: {value}")
            return ""
        if not value:
            return ""
        days = [calendar.day_name[i] for i in value]

Note that no error handling is done. If there is an issue, it should at least result in an Error statement in the HA logs.

I then restarted Home Assistant, and the issue was gone. All tapwater controls came back and everything functions as normal. No errors were found in the logs that point to this component or specific issue.

So I'm at a loss. I cannot debug at the moment, as everything is working fine. That being said, my tapwater controls sometimes being unavailable is a big pain.

I am open to suggestions to see if we can pinpoint the issue.

Also I could share my code modifications and try to see if I can make a pull request with the error handling.

@Gifford47
Copy link

Gifford47 commented Oct 27, 2024

It's already solved in #283.

@DrBlokmeister
Copy link
Author

Oops! Thanks for the quick response!

I'll close the issue assuming that the relevant issues are solved with the PR you mentioned.

For completeness I'll mention the issues here to make sure they are properly linked:
#249
#281

@steffenweber
Copy link
Contributor

Was just about to report the same issue. It went away after a Home Assistant restart but still. Thank your for reporting it, I probably would not have found the pull request without it.

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

3 participants