Coder Social home page Coder Social logo

Comments (21)

elupus avatar elupus commented on July 2, 2024 1

Because the client object is not shared. It will construct a new object when the entry is setup. So now there are two clients active, one that will potentially disconnect at some random time in the future.

Did you try the suggested esp idf upgrade that bdraco suggested in the other thread.

from core.

home-assistant avatar home-assistant commented on July 2, 2024

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)

from core.

elupus avatar elupus commented on July 2, 2024

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

from core.

alistair23 avatar alistair23 commented on July 2, 2024

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

from core.

elupus avatar elupus commented on July 2, 2024

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.

from core.

elupus avatar elupus commented on July 2, 2024

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

from core.

alistair23 avatar alistair23 commented on July 2, 2024

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

from core.

elupus avatar elupus commented on July 2, 2024

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

from core.

alistair23 avatar alistair23 commented on July 2, 2024

This diff fixes the issue

diff --git a/homeassistant/components/gardena_bluetooth/config_flow.py b/homeassistant/components/gardena_bluetooth/config_flow.py
index c7631b62f4..cd6070bc41 100644
--- a/homeassistant/components/gardena_bluetooth/config_flow.py
+++ b/homeassistant/components/gardena_bluetooth/config_flow.py
@@ -76,8 +76,6 @@ class GardenaBluetoothConfigFlow(ConfigFlow, domain=DOMAIN):
             raise AbortFlow(
                 "cannot_connect", description_placeholders={"error": str(exception)}
             ) from exception
-        finally:
-            await client.disconnect()
 
         return {CONF_ADDRESS: self.address}

It looks like the disconnect and connect are too quick for ESPHome, so the setup fails. Running firmware 1.7.23.29 on a Gardena device

from core.

elupus avatar elupus commented on July 2, 2024

That is the old change of never disconnecting which is not acceptable.

What espproxy version are you using?

from core.

elupus avatar elupus commented on July 2, 2024

For the original issue here. A change in the library to ignore unknown chars on decode would be acceptable.

from core.

elupus avatar elupus commented on July 2, 2024

The fast reconnect we could solve with some explicit delay after disconnect.

from core.

alistair23 avatar alistair23 commented on July 2, 2024

That is the old change of never disconnecting which is not acceptable.

It's just not disconnecting during initial setup. I really never understood why you think it's not a good idea

What espproxy version are you using?

2024.5.0

from core.

alistair23 avatar alistair23 commented on July 2, 2024

ESPHome 2024.5.0 uses esp idf 4.4.7, it's the latest and greatest

from core.

alistair23 avatar alistair23 commented on July 2, 2024

With #119010 I now see this

2024-06-10 14:48:59.997 DEBUG (MainThread) [gardena_bluetooth.client] Connected to F0:5E:CD:2D:C2:F9
2024-06-10 14:49:00.177 DEBUG (MainThread) [gardena_bluetooth.client] Characteristics: {'00002a27-0000-10
00-8000-00805f9b34fb', '00002a24-0000-1000-8000-00805f9b34fb', '00002a50-0000-1000-8000-00805f9b34fb', '0
0002aa6-0000-1000-8000-00805f9b34fb', '00002a05-0000-1000-8000-00805f9b34fb', '00002a2a-0000-1000-8000-00
805f9b34fb', '00002a01-0000-1000-8000-00805f9b34fb', '00002a29-0000-1000-8000-00805f9b34fb', '00002a26-00
00-1000-8000-00805f9b34fb', '00002a25-0000-1000-8000-00805f9b34fb', 'f000ffc1-0451-4000-b000-000000000000
', 'f000ffc5-0451-4000-b000-000000000000', '00002a23-0000-1000-8000-00805f9b34fb', 'f000ffc2-0451-4000-b0
00-000000000000', '00002ac9-0000-1000-8000-00805f9b34fb', '00002a28-0000-1000-8000-00805f9b34fb', '00002a
04-0000-1000-8000-00805f9b34fb', '00002a00-0000-1000-8000-00805f9b34fb'}
2024-06-10 14:49:00.182 DEBUG (MainThread) [gardena_bluetooth.client] No timestamp defined for device
2024-06-10 14:49:00.235 DEBUG (MainThread) [custom_components.gardena_bluetooth] Finished fetching Garden
a Bluetooth Data Update Coordinator data in 0.000 seconds (success: True)

No errors, but I get No devices or entities in HA and am unable to control or see any activity from the device

from core.

elupus avatar elupus commented on July 2, 2024

Interesting! The characteristics listed indicate the device is in firmware update mode. Either the firmware update wasn't finished in the official client or something has triggered it to enter firmware update mode.

from core.

alistair23 avatar alistair23 commented on July 2, 2024

Weird. The device works fine with the official client though. I can start and stop the water and everything

from core.

alistair23 avatar alistair23 commented on July 2, 2024

I reset the device and same issue

from core.

alistair23 avatar alistair23 commented on July 2, 2024

This the ESPHome log

[09:12:06][I][bluetooth_proxy:278]: [0] [F0:5E:CD:2D:C2:F9] Connecting v3 with cache
[09:12:06][D][esp32_ble_tracker:215]: Pausing scan to make connection...
[09:12:06][I][esp32_ble_client:067]: [0] [F0:5E:CD:2D:C2:F9] 0x00 Attempting BLE connection
[09:12:06][D][esp32_ble_client:110]: [0] [F0:5E:CD:2D:C2:F9] ESP_GATTC_CONNECT_EVT
[09:12:06][D][esp32_ble_client:110]: [0] [F0:5E:CD:2D:C2:F9] ESP_GATTC_OPEN_EVT
[09:12:06][I][esp32_ble_client:154]: [0] [F0:5E:CD:2D:C2:F9] Connected
[09:12:06][D][esp32_ble_tracker:266]: Starting scan...
[09:12:09][D][esp32_ble_client:306]: [0] [F0:5E:CD:2D:C2:F9] Event 46
[09:12:09][D][esp32_ble_client:188]: [0] [F0:5E:CD:2D:C2:F9] cfg_mtu status 0, mtu 247
[09:12:09][D][esp32_ble_client:110]: [0] [F0:5E:CD:2D:C2:F9] ESP_GATTC_READ_CHAR_EVT
[09:12:09][D][esp32_ble_client:110]: [0] [F0:5E:CD:2D:C2:F9] ESP_GATTC_READ_CHAR_EVT
[09:12:09][D][esp32_ble_client:110]: [0] [F0:5E:CD:2D:C2:F9] ESP_GATTC_READ_CHAR_EVT

from core.

alistair23 avatar alistair23 commented on July 2, 2024

And manually running it from a PC

python -m gardena_bluetooth connect F0:5E:CD:2D:C2:F9
Connecting to: F0:5E:CD:2D:C2:F9
Service: 98bd0010-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 23): Gardena Sensor
 -  98bd0016-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 36): Gardena Sensor Measurement Timestamp
 -  ['read', 'notify']
 -  Data: 1970-01-01 10:00:00
 -  98bd0012-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 27): Gardena Sensor Connected State
 -  ['read', 'notify']
 -  Data: False
 -  98bd0017-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 39): Gardena Sensor Force Measurement
 -  ['read', 'write', 'notify']
 -  Data: 0
 -  98bd0014-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 32): Gardena Sensor Threshold
 -  ['read', 'write']
 -  Data: 80
 -  98bd0011-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 24): Gardena Sensor Value
 -  ['read', 'notify']
 -  Data: 0
 -  98bd0015-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 34): Gardena Sensor Battery Level
 -  ['read']
 -  Data: 0
 -  98bd0013-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 30): Gardena Sensor Type
 -  ['read']
 -  Data: 
Service: 00001801-0000-1000-8000-00805f9b34fb (Handle: 12): Generic Attribute Profile
 -  00002a05-0000-1000-8000-00805f9b34fb (Handle: 13): Service Changed
 -  ['indicate']
Service: 98bd0c30-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 95): Unknown
 -  98bd0c36-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 106): Unknown
 -  ['read', 'write']
 -  98bd0c33-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 100): Unknown
 -  ['read', 'write']
 -  98bd0c34-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 102): Unknown
 -  ['read', 'write']
 -  98bd0c31-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 96): Unknown
 -  ['read', 'write']
 -  98bd0c32-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 98): Unknown
 -  ['read', 'write']
 -  98bd0c35-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 104): Unknown
 -  ['read', 'write']
Service: 0000180a-0000-1000-8000-00805f9b34fb (Handle: 16): Gardena DeviceInformation
 -  00002a24-0000-1000-8000-00805f9b34fb (Handle: 17): Gardena DeviceInformation Model Number
 -  ['read']
 -  Data: Model Number TBD
 -  00002a26-0000-1000-8000-00805f9b34fb (Handle: 21): Gardena DeviceInformation Firmware Version
 -  ['read']
 -  Data: 1.7.23.29
 -  00002a29-0000-1000-8000-00805f9b34fb (Handle: 19): Gardena DeviceInformation Manufacturer Name
 -  ['read']
 -  Data: Husqvarna AB
Service: 98bd0c10-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 69): Unknown
 -  98bd0c13-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 74): Unknown
 -  ['read', 'write']
 -  98bd0c11-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 70): Unknown
 -  ['read', 'write']
 -  98bd0c12-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 72): Unknown
 -  ['read', 'write']
 -  98bd0c15-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 78): Unknown
 -  ['read', 'write']
 -  98bd0c16-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 80): Unknown
 -  ['read', 'write']
 -  98bd0c14-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 76): Unknown
 -  ['read', 'write']
Service: 98bdeeee-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 53): Gardena ErrorHistory
 -  98bdeeef-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 54): Gardena ErrorHistory Error Id
 -  ['read']
 -  Data: bytearray(b'\x01\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04')
 -  98bdeef0-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 56): Gardena ErrorHistory Error Count
 -  ['read', 'notify']
 -  Data: 13
Service: f000ffd0-0451-4000-b000-000000000000 (Handle: 121): Gardena Oad
 -  f000ffd1-0451-4000-b000-000000000000 (Handle: 122): Gardena Oad Enable Oad
 -  ['write-without-response', 'write']
Service: 98bd0f10-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 108): Gardena Valve
 -  98bd0f14-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 117): Gardena Valve Manual Watering Time
 -  ['read', 'write']
 -  Data: 1800
 -  98bd0f12-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 112): Gardena Valve Connected State
 -  ['read', 'notify']
 -  Data: True
 -  98bd0f11-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 109): Gardena Valve State
 -  ['read', 'notify']
 -  Data: False
 -  98bd0f13-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 115): Gardena Valve Remaining Open Time
 -  ['read', 'write']
 -  Data: 0
 -  98bd0f15-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 119): Gardena Valve Activation Reason
 -  ['read']
 -  Data: 0
Service: 98bd0d10-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 59): Gardena WateringHistory
 -  98bd0d11-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 60): Gardena WateringHistory Timestamp Array
 -  ['read']
 -  Data: [datetime.datetime(2024, 6, 15, 0, 0), datetime.datetime(2024, 6, 15, 0, 30, 2), datetime.datetime(2024, 6, 15, 1, 17, 22), datetime.datetime(2024, 6, 15, 1, 53), datetime.datetime(2024, 6, 15, 1, 53, 5), datetime.datetime(2024, 6, 15, 17, 38, 52), datetime.datetime(2024, 6, 15, 18, 13, 54), datetime.datetime(2024, 6, 15, 19, 28, 20), datetime.datetime(2024, 6, 15, 20, 3, 17), datetime.datetime(2024, 6, 15, 20, 33, 19), datetime.datetime(2024, 6, 15, 21, 18, 7)]
 -  98bd0d13-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 65): Gardena WateringHistory Skip Reason
 -  ['read']
 -  Data: bytearray(b'"\x00\x00\x02\x02\x00\x00\x00\x02\x00\x00')
 -  98bd0d12-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 62): Gardena WateringHistory Timestamp Count
 -  ['read', 'notify']
 -  Data: 11
 -  98bd0d14-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 67): Gardena WateringHistory Watering Duration
 -  ['read']
 -  Data: [0, 1800, 1800, 62, 4, 1800, 1800, 1800, 6, 1801, 1801]
Service: 98bd180f-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 42): Gardena Battery
 -  98bd2a19-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 43): Gardena Battery Battery Level
 -  ['read', 'notify']
 -  Data: 33
Service: 98bd0b10-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 46): Gardena DeviceConfiguration
 -  98bd0b13-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 51): Gardena DeviceConfiguration Unix Timestamp
 -  ['read', 'write']
 -  Data: 2024-06-17 18:59:03
 -  98bd0b12-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 49): Gardena DeviceConfiguration Seasonal Adjust
 -  ['read', 'write']
 -  Data: 100
 -  98bd0b11-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 47): Gardena DeviceConfiguration Rain Pause
 -  ['read', 'write']
 -  Data: 0
Service: 98bd0c20-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 82): Unknown
 -  98bd0c24-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 89): Unknown
 -  ['read', 'write']
 -  98bd0c23-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 87): Unknown
 -  ['read', 'write']
 -  98bd0c25-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 91): Unknown
 -  ['read', 'write']
 -  98bd0c21-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 83): Unknown
 -  ['read', 'write']
 -  98bd0c22-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 85): Unknown
 -  ['read', 'write']
 -  98bd0c26-0b0e-421a-84e5-ddbf75dc6de4 (Handle: 93): Unknown
 -  ['read', 'write']

from core.

alistair23 avatar alistair23 commented on July 2, 2024

This seems to be fixed with the latest ESPHome release

from core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.