custom-components / grocy

Custom Grocy integration for Home Assistant
Apache License 2.0
158 stars 48 forks source link

Grocy fails to create sensors/binary sensors: ' unexpected keyword argument 'software_version'' in HA beta 2023.8.0.0b #279

Closed ResteNarquois closed 1 year ago

ResteNarquois commented 1 year ago

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

Describe the bug Integration fails to set up sensors and binary sensors in HA 2023.8.0.0b beta due to unexpected key in entity.py

Issue appears to be with device registration section in entity.py.

Replacing line 40: software_version=VERSION, with sw_version=VERSION,

as per https://developers.home-assistant.io/docs/device_registry_index/

allows integration sensors to be created as per expectations.

Expected behavior That sensors should be created

To Reproduce Steps to reproduce the behavior:

  1. Start Home Assistant 2023.8.0b0

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? I currently only have the Shopping List and Stock sensors enabled, but both were showing as 'unavailable'. Corresponding functions are OK in Grocy.

What is your installed versions of Home Assistant, Grocy and this integration? HA Core 2023.8.0.0b HAOS 10.4 Supervisor 2023.07.2 Grocy Addon 0.19.1

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

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

JSON service data (if related to using a service)

{

}

Additional context Add any other context about the problem here. Log entries:

` Logger: homeassistant.components.sensor Source: helpers/entity_platform.py:619 Integration: Sensor (documentation, issues) First occurred: 09:02:42 (2 occurrences) Last logged: 09:02:42

Error adding entities for domain sensor with platform grocy
Error while setting up grocy platform for sensor

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 510, in async_add_entities await asyncio.gather(*tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 619, in _async_add_entity device = dev_reg.async_get(self.hass).async_get_or_create( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: DeviceRegistry.async_get_or_create() got an unexpected keyword argument 'software_version' `

` Logger: homeassistant.components.binary_sensor Source: helpers/entity_platform.py:619 Integration: Binary Sensor (documentation, issues) First occurred: 09:02:42 (2 occurrences) Last logged: 09:02:42

Error adding entities for domain binary_sensor with platform grocy Error while setting up grocy platform for binary_sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 510, in async_add_entities await asyncio.gather(*tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 619, in _async_add_entity device = dev_reg.async_get(self.hass).async_get_or_create( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: DeviceRegistry.async_get_or_create() got an unexpected keyword argument 'software_version' `

Intecpsp commented 1 year ago

HA 2023.8.0 is now public, this is still an issue.

itsamejoshab commented 1 year ago

This is an issue with 2023.8 (now GA) and >= 4.9.0 of this custom component.

Can't use latest stable 4.8.0 due to another issue already documented related to Unable to install package pygrocy==1.4.1

jpconfessor commented 1 year ago

ran into the same problem after upgrading to 2023.8 the workaround provided:

Replacing line 40: software_version=VERSION, with sw_version=VERSION,

works! Thank you.

excalbian commented 1 year ago

👍 for the suggestion to change software_version to sw_version. Note I did have to actually restart my HA (not just reloading the integration) before the change took effect.