custom-components / grocy

Custom Grocy integration for Home Assistant
Apache License 2.0
156 stars 47 forks source link

Integration doesn't work after grocy addon update to 0.18.2 #238

Closed grossqx closed 1 year ago

grossqx commented 2 years ago

Describe the bug All entities provided by the integration became unavaliable.

To Reproduce Update the Grocty addon to 0.18.2

Versions of custom component also tried with no luck: 4.3.4 4.4.0 4.5.0 (beta, currently installed)

I have also tried deleting and adding back the integration, re-enabling all entities, restarting multiple times, creating a new grocy API key.

Log:

This error originated from a custom integration.

Logger: custom_components.grocy.coordinator
Source: helpers/update_coordinator.py:237
Integration: Grocy (documentation, issues)
First occurred: 12:46:37 PM (4 occurrences)
Last logged: 12:50:40 PM

Error fetching grocy data: Update failed: 1 validation error for TaskResponse due_date invalid date format (type=value_error.date)
grossqx commented 2 years ago

Not sure is this is relevant, but services still work. Just checked.

ainetaki commented 2 years ago

I have this same issue. Grocy is running normally. Error came after newest update 0.18.2. I can see this error from logs -> "Error setting up entry Grocy for grocy"

marcelvriend commented 2 years ago

Have no issues with add-on 0.18.2 (Grocy 3.3.1) and integration 4.5.0.

@grossqx Check the due date for the tasks in Grocy, there is an invalid date somewhere. Grocy does some validation but you can bypass it.

@ainetaki Can you open a new issue and fill out the template? We need more information to help.

grossqx commented 2 years ago

@marcelvriend It helped! I had some tasks in my grocy that were created from hass interface via lovelace-grocy-chores-card. Those were created a while ago,while on a previous version of both grocy and the integration. After I deleted those tasks, it immediately started working. Thank you! Hope this information helps to pinpoint where the wrong date format originated.

grossqx commented 2 years ago

The issue appeared again after update of hass supervisor to 2022.08.5. Everything else is also in the latest version. Component v.4.5.2

All entities are unavailable and the log throws a: Error fetching grocy data: Update failed: 1 validation error for CurrentChoreResponse next_estimated_execution_time invalid datetime format (type=value_error.datetime)

I tried removing the latest actions that were taken through the integration right before it broke. This time it doesn't help

marcelvriend commented 2 years ago

Apparently there is incorrect data in your Grocy db (coming from the Android app you mentioned). Grocy and also this integration require valid data. To fix it, you need to find and correct the invalid chore(s) in Grocy.

grossqx commented 1 year ago

@marcelvriend yes, you are absolutely right. But there might be also other grocy integrations or apps that cause this error because, as you have said, grocy apparently allows to bypass the validation. And even with these incorrect data, grocy itself works without any errors and displays all fields correctly. Would it be possible to ignore the errors in a particular chore or a particular product? I would expect it to show null values instead of disabling the whole integration. Or at least if there's, for example, a chore data error, would it be possible to keep stock and shopping list working? Because right now all entities go to unavailable if there's incorrect data in at least one of grocy objects. And unless you spot the problem right away and know what to look for, it is hard to pinpoint.

marcelvriend commented 1 year ago

The linked PR will ensure that not all entities become unavailable.