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

Update for number.luxtronik2_domestic_water_thermal_desinfection_target fails #82

Closed
rhammen opened this issue Jan 30, 2023 · 8 comments

Comments

@rhammen
Copy link
Contributor

rhammen commented Jan 30, 2023

This error originated from a custom integration.

Logger: homeassistant.helpers.entity
Source: custom_components/luxtronik2/number.py:397
Integration: Luxtronik
First occurred: 00:16:13 (147 occurrences)
Last logged: 01:29:13

Update for number.luxtronik2_domestic_water_thermal_desinfection_target fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 538, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 736, in async_device_update
raise exc
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/luxtronik2/number.py", line 397, in update
if domesticWaterCurrent >= float(self.native_value) and (self._last_thermal_desinfection is None or self._last_thermal_desinfection < datetime.now().date):
TypeError: '<' not supported between instances of 'str' and 'builtin_function_or_method'

@BenPru
Copy link
Owner

BenPru commented Feb 2, 2023

Please try the last pre-release 2022.02.02

@rhammen
Copy link
Contributor Author

rhammen commented Feb 5, 2023

With 2022.02.02 I didn't see any such errors anymore, so I will close the issue.

@rhammen rhammen closed this as completed Feb 5, 2023
@rhammen
Copy link
Contributor Author

rhammen commented Feb 9, 2023

This error originated from a custom integration.

Logger: homeassistant.helpers.entity
Source: custom_components/luxtronik2/number.py:397
Integration: Luxtronik
First occurred: February 6, 2023 at 00:21:47 (1071 occurrences)
Last logged: February 6, 2023 at 18:17:51

Update for number.luxtronik2_domestic_water_thermal_desinfection_target fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 538, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 736, in async_device_update
raise exc
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/luxtronik2/number.py", line 397, in update
if domesticWaterCurrent >= float(self.native_value) and (self._last_thermal_desinfection is None or self._last_thermal_desinfection == "" or self._last_thermal_desinfection < datetime.now().date()):
TypeError: '<' not supported between instances of 'str' and 'datetime.date'


After HA starts up, everything is OK: no error.
The errors occurs from the moment the Thermal desinfection took place
I'd say the problem is self._last_thermal_desinfection is a string, and is being compared to datetime.now().date() which is a datetime.date

@rhammen rhammen reopened this Feb 9, 2023
@BenPru
Copy link
Owner

BenPru commented Feb 9, 2023

@rhammen Please try the current main draft. I'm have currently installed the new core-preview and can not test this.

@rhammen
Copy link
Contributor Author

rhammen commented Feb 9, 2023

@BenPru Ok, I have updated my local install with these changes. My next Thermal desinfection run is on Monday, I'll report back afterwards.
I do have 1 question regarding this check:
cast(date, self._last_thermal_desinfection) < datetime.now().date()
This basically says you only want to update the last thermal desinfection date, if the current last_thermal_desinfection date is "in the past".

What is the reason you don't want to update self._last_thermal_desinfection when self._last_thermal_desinfection is "in the future"?
I can quickly think of 2 reasons why the last_thermal_desinfection date could be "in the future":

  1. User made an error with entering the the date/time of the system then is running HA, e.g. entered month = 09 instead of 08. or the wrong year. When the user corrects the error, you do not want to update the last_thermal_desinfection date?
  2. The weekend when the clock is returning to winter-time, the clock is set back from 03:00 --> 02:00. So last_thermal_desinfection date could then be somewhere between 02:00 and 03:00. In this case you also do not want to update the last_thermal_desinfection date/time?

@rhammen
Copy link
Contributor Author

rhammen commented Feb 13, 2023

New error with the latest version, after my thermal desinfection ran last night:

This error originated from a custom integration.

Logger: homeassistant.helpers.entity
Source: custom_components/luxtronik2/number.py:397
Integration: Luxtronik
First occurred: 00:17:39 (512 occurrences)
Last logged: 04:33:10

Update for number.luxtronik2_domestic_water_thermal_desinfection_target fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 538, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 736, in async_device_update
raise exc
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/luxtronik2/number.py", line 397, in update
if domesticWaterCurrent >= float(self.native_value) and (self._last_thermal_desinfection is None or self._last_thermal_desinfection == "" or (isinstance(self._last_thermal_desinfection, date) and cast(date, self._last_thermal_desinfection) < datetime.now().date())):
NameError: name 'date' is not defined

@BenPru
Copy link
Owner

BenPru commented Feb 15, 2023

Sorry, missing import. Should be fixed.

@rhammen
Copy link
Contributor Author

rhammen commented Apr 17, 2023

Did not see this error recently, so confirm it is fixed.

@rhammen rhammen closed this as completed Apr 17, 2023
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

2 participants