Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

Support for Grocy 3.x api #145

Closed
isabellaalstrom opened this issue Feb 10, 2021 · 8 comments
Closed

Support for Grocy 3.x api #145

isabellaalstrom opened this issue Feb 10, 2021 · 8 comments

Comments

@isabellaalstrom
Copy link
Contributor

There are a lot of changes in the 3.x version. Some things seems to have broken.

@SebRut
Copy link
Owner

SebRut commented Feb 10, 2021

Hey! Do you know what things are broken? It seems like the chores are still working, so stock and products?

@isabellaalstrom
Copy link
Contributor Author

isabellaalstrom commented Feb 10, 2021

Stock seems to work, but I would say products have issues.
See this: custom-components/grocy#114

Edit: Yeah, my stock-sensor is working correctly, so it seems to be the binary sensors.

@SebRut
Copy link
Owner

SebRut commented Feb 10, 2021

@isabellaalstrom i published a new release v0.25.0 which made the lib compatible to grocy 3.0.0+ as far as I know, could you check it out maybe?
Also it might make sense to add some sort of information text about the "new" incompability with grocy < 3.0.0 to the integration.

@isabellaalstrom
Copy link
Contributor Author

Yeah! I will look at this tomorrow. 👌

@isabellaalstrom
Copy link
Contributor Author

isabellaalstrom commented Feb 15, 2021

Updated to 0.26.0 in my local env and now I get this error. I don't use barcodes, and it seems it expects them? Nothing is updating as it is now.

Source: custom_components/grocy/entity.py:133
First occurred: 1:07:09 PM (21 occurrences)
Last logged: 1:21:10 PM

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 124, in _handle_refresh_interval
    await self.async_refresh()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 198, in async_refresh
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 296, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 323, in _async_write_ha_state
    attr.update(self.device_state_attributes or {})
  File "/config/custom_components/grocy/entity.py", line 133, in device_state_attributes
    return {"products": [x.as_dict() for x in self.entity_data]}
  File "/config/custom_components/grocy/entity.py", line 133, in <listcomp>
    return {"products": [x.as_dict() for x in self.entity_data]}
  File "/usr/local/lib/python3.8/site-packages/pygrocy/base.py", line 10, in as_dict
    return {k: get_val(getattr(self, k)) for k, v in self.__class__.__dict__.items() if isinstance(v, property)}
  File "/usr/local/lib/python3.8/site-packages/pygrocy/base.py", line 10, in <dictcomp>
    return {k: get_val(getattr(self, k)) for k, v in self.__class__.__dict__.items() if isinstance(v, property)}
  File "/usr/local/lib/python3.8/site-packages/pygrocy/data_models/product.py", line 89, in barcodes
    return [barcode.barcode for barcode in self.product_barcodes]
TypeError: 'NoneType' object is not iterable

@SebRut
Copy link
Owner

SebRut commented Feb 15, 2021

@isabellaalstrom I (hopefully) fixed your issue and another one in a new 0.27.0 version :)

@isabellaalstrom
Copy link
Contributor Author

Will check at once!

@isabellaalstrom
Copy link
Contributor Author

All sensors and binary sensors are now working! 🎉

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants