Closed MrBurnst closed 3 months ago
Weird, your last updated is null. Not sure why, I'll take a look at it ASAP.
I think I found it. I have all my data coming from sensors, if I use OWM for for example pressure, the error disappears.
... nope, still not working. Now I'm getting
Logger: aiohttp.server
Source: /usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py:421
First occurred: June 8, 2024 at 6:57:43 AM (2 occurrences)
Last logged: 7:19:14 AM
Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.12/statistics.py", line 327, in _exact_ratio
return (x.numerator, x.denominator)
^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'numerator'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request
resp = await request_handler(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 543, in _handle
resp = await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, in impl
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 83, in forwarded_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 85, in ban_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 32, in headers_middleware
response = await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
result = await handler(request, **request.match_info)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 70, in wrapper
return await method(view, request, data, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/smart_irrigation/websockets.py", line 197, in post
await coordinator.async_update_zone_config(zone, data)
File "/config/custom_components/smart_irrigation/__init__.py", line 1343, in async_update_zone_config
await self._async_calculate_all()
File "/config/custom_components/smart_irrigation/__init__.py", line 795, in _async_calculate_all
sensor_values = await self.apply_aggregates_to_mapping_data(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/smart_irrigation/__init__.py", line 722, in apply_aggregates_to_mapping_data
resultdata[key] = statistics.mean(d)
^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/statistics.py", line 484, in mean
T, total, n = _sum(data)
^^^^^^^^^^
File "/usr/local/lib/python3.12/statistics.py", line 193, in _sum
for n, d in map(_exact_ratio, values):
File "/usr/local/lib/python3.12/statistics.py", line 330, in _exact_ratio
raise TypeError(msg)
TypeError: can't convert type 'str' to numerator/denominator
Same problem here.
I "fixed" it by casting the values of "d" in init.py to float, but I have no idea why some sensor readings are str and some float ...
I "fixed" it by casting the values of "d" in init.py to float, but I have no idea why some sensor readings are str and some float ...
Would you mind sharing exactly what you changed where? I would love to get it to work again until an "official" fix has been released. 😉
Thanks a lot!
a probably cleaner solution is given in issue https://github.com/jeroenterheerdt/HAsmartirrigation/issues/398 , but I added
d = [float(dd) if isinstance(dd, str) and dd.replace('.', '', 1).isdigit() else dd for dd in d if isinstance(dd, (int, float)) or (isinstance(dd, str) and dd.replace('.', '', 1).isdigit())]
after that, only numeric values remain in list d .
I am going to implement the solution in #398, so closing this as duplicate. please reopen if the fix doesn't fix it when released.
What happened?
Updating to the latest version broke SmartIrrigation.
It seems that "const" is None (see below). I tried restarting HA, clearing all weather data, recalculating everything, did not help.
How to reproduce
Maybe it's just me?
Relevant log output
Which version are you running?
2024.6.1
Diagnostics file
Additional information
here's my diagnostics file: