custom-components / grocy

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

Old and Fresh Grocy install fail to get data #257

Open short-circuit opened 1 year ago

short-circuit commented 1 year ago

Describe the bug Tried with my current setup, fails to make entities available in home assistant. Thought my install was bad, made a fresh install of Grocy and HA component, fails on adding the entities or refreshing information

Expected behavior Grocy component adds (also empty) items to home assistant entities

To Reproduce Steps to reproduce the behavior:

  1. Start Grocy
  2. Add component in HA
  3. See error

General information to help debugging:

What sensors do you have enabled? Are they working and/or what state are they in? Do you have the corresponding functions enabled in Grocy? Any entity I enable is unable to get information and stays in unavailable state

What is your installed versions of Home Assistant, Grocy and this integration? Home Assistant - 2022.11.5 Grocy - 3.3.2 Integration - 4.7.1 Beta (Same error with stable)

How do you have Grocy installed? Add-on or external? External, Docker (using local on port 9192, Grocy itself works as intended)

Have you added debugging to the log, and what does the log say?

homeassistant    | 2022-12-05 14:59:39.548 ERROR (MainThread) [custom_components.grocy.coordinator] Error fetching grocy data: Update failed: 3 validation errors for CurrentVolatilStockResponse
homeassistant    | overdue_products -> 11 -> product -> qu_factor_purchase_to_stock
homeassistant    |   value is not a valid float (type=type_error.float)
homeassistant    | overdue_products -> 12 -> product -> qu_factor_purchase_to_stock
homeassistant    |   value is not a valid float (type=type_error.float)
homeassistant    | overdue_products -> 13 -> product -> qu_factor_purchase_to_stock
homeassistant    |   value is not a valid float (type=type_error.float)
homeassistant    | 2022-12-05 15:06:34.176 ERROR (MainThread) [custom_components.grocy.coordinator] Error fetching grocy data: Update failed: 3 validation errors for CurrentVolatilStockResponse
homeassistant    | overdue_products -> 11 -> product -> qu_factor_purchase_to_stock
homeassistant    |   value is not a valid float (type=type_error.float)
homeassistant    | overdue_products -> 12 -> product -> qu_factor_purchase_to_stock
homeassistant    |   value is not a valid float (type=type_error.float)
homeassistant    | overdue_products -> 13 -> product -> qu_factor_purchase_to_stock
homeassistant    |   value is not a valid float (type=type_error.float)
homeassistant    | 2022-12-05 15:45:51.003 ERROR (MainThread) [custom_components.grocy.coordinator] Error fetching grocy data: Update failed: HTTPConnectionPool(host='grocy.local', port=9192): Max retries exceeded with url: /api/stock/volatile (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7ff0860017e0>: Failed to establish a new connection: [Errno 111] Connection refused'))
homeassistant    | 2022-12-05 15:47:48.167 ERROR (MainThread) [frontend.js.latest.202211080] :0:0 ResizeObserver loop completed with undelivered notifications.
homeassistant    | 2022-12-05 15:58:37.799 ERROR (MainThread) [custom_components.grocy.coordinator] Error fetching grocy data: Update failed: 3 validation errors for CurrentVolatilStockResponse
homeassistant    | overdue_products -> 11 -> product -> qu_factor_purchase_to_stock
homeassistant    |   value is not a valid float (type=type_error.float)
homeassistant    | overdue_products -> 12 -> product -> qu_factor_purchase_to_stock
homeassistant    |   value is not a valid float (type=type_error.float)
homeassistant    | overdue_products -> 13 -> product -> qu_factor_purchase_to_stock
homeassistant    |   value is not a valid float (type=type_error.float)
homeassistant    | 2022-12-05 16:00:18.878 ERROR (MainThread) [custom_components.grocy.coordinator] Error fetching grocy data: Update failed: 3 validation errors for CurrentVolatilStockResponse
homeassistant    | overdue_products -> 11 -> product -> qu_factor_purchase_to_stock
homeassistant    |   value is not a valid float (type=type_error.float)
homeassistant    | overdue_products -> 12 -> product -> qu_factor_purchase_to_stock
homeassistant    |   value is not a valid float (type=type_error.float)
homeassistant    | overdue_products -> 13 -> product -> qu_factor_purchase_to_stock
homeassistant    |   value is not a valid float (type=type_error.float)
homeassistant    | 2022-12-05 16:01:15.349 ERROR (SyncWorker_2) [homeassistant] Error doing job: Task was destroyed but it is pending!

Addition information Grocy custom component spams the above messages constantly when it tries to update entities. Configuration finishes correctly.

profucius commented 1 year ago

I am also having this issue. Setting up Grocy from HACS in Integrations, it claims to have made a connection, but all entities are unavailable. Restarting everything does not fix it. Screenshots below:

image

image

short-circuit commented 1 year ago

@profucius Try to open Advanced settings and set the entity to enabled. AFAIK the component disables all entities by default. Although, my entities are unavailable also after a full day of being enabled in the advanced settings.

Bovive commented 1 year ago

Fresh install here. I receive this error as well:

2022-12-09 13:33:10.201 ERROR (MainThread) [custom_components.grocy.coordinator] Error fetching grocy data: Update failed: 1 validation error for ProductDetailsResponse product -> qu_factor_purchase_to_stock value is not a valid float (type=type_error.float) Everything works, but then after that error everything becomes unavailable. Not disabled, but a status of unavailable. I disabled "binary_sensor.grocy_missing_products" and the error went away. Everything else appears to be working.

Bovive commented 1 year ago

I tried enabling sensor.grocy_stock but I receive this error now: "Error fetching grocy data: Update failed: 1 validation error for CurrentStockResponse product -> qu_factor_purchase_to_stock value is not a valid float (type=type_error.float)"

Bovive commented 1 year ago

After upgrading HA recently to 2023.3.4 I received a similar error. This time I had to disable the Grocy Shopping List for this integration to work. The fix to pygrocy from the previous error worked. This error received was:

Error fetching grocy data: Update failed: 1 validation error for ShoppingListItem amount value is not a valid float (type=type_error.float)