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

All sensors unavailable; validation error for ProductDetailsResponse #281

Open
squirtbrnr opened this issue Aug 2, 2023 · 13 comments
Open

Comments

@squirtbrnr
Copy link

Unless all relevant information is provided, I can't help you

Describe the bug
Sensors show as unavailable

Expected behavior
Sensors to be available with data

To Reproduce
update to latest HA and Grocy custom component

General information to help debugging:

all sensors are enabled but unavailable.

What is your installed versions of Home Assistant, Grocy and this integration?
HA Container 2023.8.0
Grocy custom component integration v4.10.0
Grocy installed in docker container from Linuxserver.io v4.0.0-ls205

How do you have Grocy installed? Add-on or external?
external container

Have you added debugging to the log, and what does the log say?
HA log shows this error:

This error originated from a custom integration.

Logger: custom_components.grocy.coordinator
Source: helpers/update_coordinator.py:262
Integration: Grocy (documentation, issues)
First occurred: 2:57:27 PM (3 occurrences)
Last logged: 3:02:31 PM

Error fetching grocy data: Update failed: 1 validation error for ProductDetailsResponse product -> qu_factor_purchase_to_stock field required (type=value_error.missing)

JSON service data (if related to using a service)

Additional context

@fedefreue
Copy link
Contributor

From my research, it seems that this is due to the breaking changes to the Grocy API in v4.0. Not sure if the fix will here or in pygrocy, but from what I understood it has to do with changes to the quantity units.

@squirtbrnr
Copy link
Author

I successfully reverted and restored my Grocy install back to v3.3.2 and can confirm the integration is working again.

@unresolved-contradictions
Copy link

unresolved-contradictions commented Aug 4, 2023

The issue seems to be with pygrocy and the breaking changes in the Grocy API. I got it working again by changing the 'requirements' in 'manifest.json' from "requirements": ["pygrocy==1.5.0"], to "requirements": ["git+https://github.com/fedefreue/pygrocy.git@develop#pygrocy"],

The above is a branch of pygrocy removing the offending issues.

@fedefreue
Copy link
Contributor

fedefreue commented Aug 4, 2023

That's great! I didn't realize I could cherry pick my branch to fix it in the interim... Seems like a good fix until it gets merged into the master for pygrocy.

@MelvinLoos
Copy link

Either edit the requirements or opt into the experimental releases. I did the latter and it all seems to work as well although I did have to (re)enable all sensors which seemed to have been disabled. Not sure if that was my own doing though.

@squirtbrnr
Copy link
Author

I was using the Grocy custom component v4.10.0 (enable beta in HACS) which uses the pygrocy v1.5.0 library and it was not working for me and still displayed the error I posted above.

@unresolved-contradictions

I was using the Grocy custom component v4.10.0 (enable beta in HACS) which uses the pygrocy v1.5.0 library and it was not working for me and still displayed the error I posted above.

Have you tried the fix I mentioned above, editing the 'requirements' in 'manifest.json'? I am running the same versions as you and this fixed the problem.

@fedefreue
Copy link
Contributor

The way it breaks down is as follows:

  • Grocy < v4.0: No issue but requires latest version of custom component (fixes for HASS 2023.08)
  • Grocy >= v4.0: Needs @sailseaplymouth 's fix to manifes.json above, since the issue is in pygrocy and not in the custom HASS component

I already submitted a pull request to pygrocy so I think it's a waiting game until that gets updated and then subsequently updating the requirement here so that the fix carries over.

@Caddyman68
Copy link

This question most closely matched my problem, but the solution must have changed. I have Grocy add on ver 4.0.3 and my manifest.json references pygrocy 2.0. I changed it to the code above -"git+https://github.com/fedefreue/pygrocy.git@develop#pygrocy" - and restarted HA (of course) but all sensors remain unavailable in the integration. What am I doing wrong? - because it always ends up being that LOL. If it helps, I had Grocy integration installed before and deleted it because of this same problem. The add on has been reliable (so far)

@fedefreue
Copy link
Contributor

I'm running the latest stable version for both the HA add-on and for Grocy and am not experiencing this - could be due to something different? Want to share your logs - I can take a look

@Caddyman68
Copy link

I'm running the latest stable version for both the HA add-on and for Grocy and am not experiencing this - could be due to something different? Want to share your logs - I can take a look

Not sure if this is the log info you need. I got it after enabling "debug logging" in the integration:
This error originated from a custom integration.

Logger: custom_components.grocy.coordinator
Source: helpers/update_coordinator.py:347
integration: Grocy (documentation, issues)
First occurred: May 5, 2024 at 8:45:23 AM (3 occurrences)
Last logged: 3:41:32 PM

Error fetching grocy data: Update failed: 2 validation errors for ProductDetailsResponse quantity_unit_stock -> name_plural none is not an allowed value (type=type_error.none.not_allowed) default_quantity_unit_purchase -> name_plural none is not an allowed value (type=type_error.none.not_allowed)

I changed log level in the yaml for the add on to debug and get:
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service nginx: stopping
[15:45:13] INFO: Service NGINX exited with code 0 (by signal 0)
s6-rc: info: service nginx successfully stopped
s6-rc: info: service init-nginx: stopping
s6-rc: info: service php-fpm: stopping
s6-rc: info: service init-nginx successfully stopped
[15:45:13] INFO: Service PHP-FPM exited with code 0 (by signal 0)
s6-rc: info: service php-fpm successfully stopped
s6-rc: info: service init-php-fpm: stopping
s6-rc: info: service init-grocy: stopping
s6-rc: info: service init-php-fpm successfully stopped
s6-rc: info: service init-grocy successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service base-addon-log-level: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service base-addon-log-level successfully stopped
s6-rc: info: service base-addon-banner: stopping
s6-rc: info: service base-addon-banner successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service base-addon-banner: starting


Add-on: Grocy
ERP beyond your fridge! A groceries & household management solution for your home

Add-on version: 0.21.0
You are running the latest version of this add-on.
System: Home Assistant OS 12.2 (amd64 / generic-x86-64)
Home Assistant Core: 2024.4.3
Home Assistant Supervisor: 2024.04.4

Please, share the above information when looking for help
or support in, e.g., GitHub, forums or the Discord chat.

s6-rc: info: service base-addon-banner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service base-addon-log-level: starting
s6-rc: info: service fix-attrs successfully started
Log level is set to DEBUG
s6-rc: info: service base-addon-log-level successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service init-php-fpm: starting
s6-rc: info: service init-nginx: starting
s6-rc: info: service init-grocy: starting
[15:55:12] DEBUG: Symlinking data directory to persistent storage location...
[15:55:12] INFO: Patching Grocy to fix relative URL handling...
patching file views/layout/default.blade.php
s6-rc: info: service init-grocy successfully started
s6-rc: info: service init-php-fpm successfully started
s6-rc: info: service php-fpm: starting
s6-rc: info: service php-fpm successfully started
[15:55:12] INFO: Starting PHP-FPM...
s6-rc: info: service init-nginx successfully started
s6-rc: info: service nginx: starting
s6-rc: info: service nginx successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
[15:55:12] INFO: Starting NGinx....

Thanks

@fedefreue
Copy link
Contributor

From what I can see above, it seems it's failing when updating the add-on? What's challenging is I can't reproduce (and am also on the latest for both)

@jdrusso
Copy link

jdrusso commented Jul 11, 2024

@Caddyman68 I appreciate finding the apparently single other person in the world with the same niche problem as me!

Found a solution that fixed it for me, and might help you -- update pygrocy to 2.1.0. This fixes it for shopping lists and stock, but doesn't seem like for meal plans.

I found SebRut/pygrocy#272 in 2.1.0, looks like one of the last changes in pygrocy before being archived was fixing exactly this.

Edit: PR up #311

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

6 participants