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

fix: don't error on shorter days when entering DST #10

Merged
merged 1 commit into from Mar 26, 2023

Conversation

luuuis
Copy link
Owner

@luuuis luuuis commented Mar 26, 2023

Fixes a bug on 23-hour days, which occurs when entering DST. This causes the sensor values to become unknown.

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 239, in _async_refresh
    self.data = await self._async_update_data()
  File "/config/custom_components/omie/coordinator.py", line 82, in _async_update_data
    return await super()._async_update_data()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 195, in _async_update_data
    return await self.update_method()
  File "/config/custom_components/omie/coordinator.py", line 186, in fetch
    return await fetch_to_dict(client_session, source, dc.date, {
  File "/config/custom_components/omie/coordinator.py", line 134, in fetch_to_dict
    rows = {row[0]: [float(row[i + 1].replace(',', '.')) for i in list(range(24))] for row in reader if row[0] != ''}
  File "/config/custom_components/omie/coordinator.py", line 134, in <dictcomp>
    rows = {row[0]: [float(row[i + 1].replace(',', '.')) for i in list(range(24))] for row in reader if row[0] != ''}
  File "/config/custom_components/omie/coordinator.py", line 134, in <listcomp>
    rows = {row[0]: [float(row[i + 1].replace(',', '.')) for i in list(range(24))] for row in reader if row[0] != ''}
ValueError: could not convert string to float: ''

@luuuis luuuis merged commit 58d8a69 into master Mar 26, 2023
4 checks passed
@luuuis luuuis deleted the fix-dst-start-bug branch March 26, 2023 10:04
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

Successfully merging this pull request may close these issues.

None yet

1 participant