Closed Johan1990 closed 1 year ago
Same issue here. Latest versions of everything
Waits for upstream PR https://github.com/SebRut/pygrocy/pull/250.
Updated Grocy (docker) and Home Assistant and integrations to the latest version. This did not solve the issue. Same issue is still occuring when tracking a chore.
As mentioned before, it waits for upstream PR.
I released pygrocy v1.5.0 which includes in the upstream PR mentioned here :)
I'm not experiencing this error (integration version 4.7.1 with pygrocy 1.4.1 is working for me) but note that while testing around an issue with timezone support for tracking chores (see #252) I found that pygrocy 1.5.0 broke the timezone support that is working in integration 4.7.1 (at least for me).
Update: I was mistaken - the time zone behavior does change between pygrocy 1.4.1 and 1.5.0 but the issue (chores are not executed in local time) is still present in both versions.
Fixed by upgrading to v1.5.0
When tracking a chore using the home assistant Chores view an error occurs when calling the web api. Home Assistant version is 2022.7.7 (2022.8.1 also), Grocy component 3.2, Grocy card 4.4.
Full error log: Logger: homeassistant.components.websocket_api.http.connection Source: custom_components/grocy/services.py:171 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 10:32:34 AM (5 occurrences) Last logged: 10:43:37 AM
[140237094295664] 'datetime.timezone' object has no attribute 'localize' [140236378552208] 'datetime.timezone' object has no attribute 'localize' [140236911339856] 'datetime.timezone' object has no attribute 'localize' [140236351267088] 'datetime.timezone' object has no attribute 'localize' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 193, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1713, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1750, in _execute_service await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)( File "/config/custom_components/grocy/services.py", line 107, in async_call_grocy_service await async_execute_chore_service(hass, coordinator, service_data) File "/config/custom_components/grocy/services.py", line 173, in async_execute_chore_service await hass.async_add_executor_job(wrapper) 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/grocy/services.py", line 171, in wrapper coordinator.grocy_api.execute_chore(chore_id, done_by) File "/usr/local/lib/python3.10/site-packages/pygrocy/grocy.py", line 127, in execute_chore return self._api_client.execute_chore(chore_id, done_by, tracked_time) File "/usr/local/lib/python3.10/site-packages/pygrocy/grocy_api_client.py", line 398, in execute_chore localized_tracked_time = localize_datetime(tracked_time) File "/usr/local/lib/python3.10/site-packages/pygrocy/utils.py", line 47, in localize_datetime return local_tz.localize(timestamp).astimezone(pytz.utc) AttributeError: 'datetime.timezone' object has no attribute 'localize'