home-assistant/core

Unable to add a new Gardena Water Computer

alistair23 opened this issue · 14 comments

The problem

When attempting to add a new computer I keep getting this error

2024-05-16 14:58:32.604 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Gardena 
Water Computer for gardena_bluetooth
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 575, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/gardena_bluetooth/__init__.py", line 55, in async
_setup_entry
    sw_version = await client.read_char(DeviceInformation.firmware_version, None)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/gardena_bluetooth/client.py", line 180, in read_char
    return char.decode(await self.read_char_raw(char.uuid))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/gardena_bluetooth/parse.py", line 82, in decode
    return data.decode("ASCII")
           ^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position 3: ordinal not in range(128)

What version of Home Assistant Core has the issue?

core-2024.5.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

gardena_bluetooth

Link to integration documentation on our website

https://www.home-assistant.io/integrations/gardena_bluetooth

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

Hey there @elupus, mind taking a look at this issue as it has been labeled with an integration (gardena_bluetooth) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of gardena_bluetooth can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign gardena_bluetooth Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


gardena_bluetooth documentation
gardena_bluetooth source
(message by IssueLinks)

Can you check with the official client what firmware that report (full string including any special characters)

This is what I get from manually running your Python scripts

Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 16): Gardena DeviceInformation
 -  00002a26-0000-1000-8000-00805f9b34fb (Handle: 21): Gardena DeviceInformation Firmware Version
 -  ['read']
 -  Data: bytearray(b'1.7.23.29')
 -  00002a29-0000-1000-8000-00805f9b34fb (Handle: 19): Gardena DeviceInformation Manufacturer Name
 -  ['read']
 -  Data: bytearray(b'Husqvarna AB')
 -  00002a24-0000-1000-8000-00805f9b34fb (Handle: 17): Gardena DeviceInformation Model Number
 -  ['read']
 -  Data: bytearray(b'Model Number TBD')

If I remove the default argument to read_char() I get this error

gardena_bluetooth.exceptions.CharacteristicNotFound: Unable to find characteristic CharacteristicString(u
uid='00002a26-0000-1000-8000-00805f9b34fb', name='Firmware Version')

So for some reason it can't read the characteristic and by default it returns None, which then can't be decoded

I cant make what you wrote above make sense. First it seems like it did read the firmware version, then you then say didnt.

Are you sure both those attempts are from the same device? Also its not showing same error as it did in HA, so further indicate a different device.

Ps. None would not be equal to the hex char 0xe4 mentioned in your initial log.

Are you sure both those attempts are from the same device? Also its not showing same error as it did in HA, so further indicate a different device.

It's possible the first error is from a Husqvarna mower. The integration doesn't print addresses or allow specifying one so it's hard to be sure

It should not list the mower, so aught to have been a watering computer.