home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.65k stars 30.41k forks source link

Gardena Bluetooth Irrigation Bluetooth connection is unreliable #103117

Closed alistair23 closed 3 months ago

alistair23 commented 11 months ago

The problem

This is somewhat similar to https://github.com/home-assistant/core/issues/98561 in that the Bluetooth connection disconnects when using an ESPHome Bluetooth proxy. The connection stays up for a few days, but eventually the Gardena device becomes unavailable.

Once the device has become unavailable it won't reappear until I remove and reinsert the battery from the device.

That doesn't always work though. The attached log in the issue is while I power cycle the Gardena device but it doesn't reconnect in the HA UI.

The ESPHome device is located very close to the Gardena Bluetooth controller, but it is a long distance from the WiFi access point. I am working on hard wiring it encase that is the issue.

What version of Home Assistant Core has the issue?

core-2023.10.5

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

logs_esp32-bluetooth-proxy_logs.txt

ha.log

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2023-10-27 10:07:48.474 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.esp32_bluetooth_proxy_front_soil_moisture (<class 'homeassistant.components.esphome.sensor.EsphomeSensor'>) is using native unit of measurement '%' which is not a valid unit for the device class ('voltage') it is using; expected one of ['mV', 'V']; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+esphome%22

2023-10-27 15:08:18.153 WARNING (MainThread) [aioesphomeapi.connection] esp32-bluetooth-proxy @ 172.16.2.8: Connection error occurred: [Errno 104] Connection reset by peer

2023-10-31 08:41:34.553 WARNING (Recorder) [homeassistant.components.esphome.bluetooth.client] Bluetooth 
Proxy 3daf64 [e0:e2:e6:3d:af:64]: None - E4:E1:12:FF:A3:E0: ESPHomeClient bleak client was not properly d
isconnected before destruction


### Additional information

_No response_
bdraco commented 4 months ago
  scan_parameters:
    interval: 1100ms
    window: 1100ms

Those are quite high. I would leave them as the defaults since that level of scanning can overwhelm the device, especially if its not ethernet connected.

frontside76 commented 4 months ago

Hi, i have the same problem. Have 4 Gardena bluetooth 9V valves. And sometimes they go offline. All of them have latest Firmware. ESPHome in Home Assistant is updated. 1 have 4 Bluetooth Proxys M5Stack Atom lite and all of them are Updates too. Home Assistant has the latent Updates installed. Log:

Logger: homeassistant.components.gardena_bluetooth Quelle: helpers/update_coordinator.py:344 Integration: Gardena Bluetooth (Dokumentation, Probleme) Erstmals aufgetreten: 08:20:35 (5 Vorkommnisse) Zuletzt protokolliert: 09:00:55

Error fetching Gardena Bluetooth Data Update Coordinator data: Unable to update data for 98bd2a19-0b0e-421a-84e5-ddbf75dc6de4 due to Communcation failed with device: Gardena Bluetooth - B0:D2:78:99:E1:80: Failed to connect after 9 attempt(s): Error ESP_GATT_CONN_FAIL_ESTABLISH while connecting: Connection failed to establish: Interference/range; External Bluetooth adapter w/extension may help; Extension cables reduce USB 3 port interference Error fetching Gardena Bluetooth Data Update Coordinator data: Unable to update data for 98bd2a19-0b0e-421a-84e5-ddbf75dc6de4 due to Communcation failed with device: Gardena Bluetooth - B0:D2:78:99:E3:DE: Failed to connect after 5 attempt(s): Timeout waiting for connect response while connecting to B0:D2:78:99:E3:DE after 20.0s, disconnect timed out: False, after 20.0s Error fetching Gardena Bluetooth Data Update Coordinator data: Unable to update data for 98bd2a19-0b0e-421a-84e5-ddbf75dc6de4 due to Communcation failed with device: Gardena Bluetooth - B0:D2:78:99:CC:2F: Failed to connect after 4 attempt(s): Timeout waiting for connect response while connecting to B0:D2:78:99:CC:2F after 20.0s, disconnect timed out: True, after 20.0s Error fetching Gardena Bluetooth Data Update Coordinator data: Unable to update data for 98bd2a19-0b0e-421a-84e5-ddbf75dc6de4 due to Communcation failed with device: Gardena Bluetooth - B0:D2:78:99:E1:80: Failed to connect after 12 attempt(s): Error ESP_GATT_CONN_FAIL_ESTABLISH while connecting: Connection failed to establish: Interference/range; External Bluetooth adapter w/extension may help; Extension cables reduce USB 3 port interference

Configuration Bluetooth Proxy:

substitutions: name: "bluetooth-proxy-gardena-1" friendly_name: Bluetooth Proxy Gardena 1

packages: esphome.bluetooth-proxy: github://esphome/firmware/bluetooth-proxy/m5stack-atom-lite.yaml@main

esphome: name: ${name} name_add_mac_suffix: false friendly_name: ${friendly_name}

api: encryption: key: ****

esp32_ble_tracker: scan_parameters: active: True

external_components:

bluetooth_proxy: active: True cache_services: True

wifi: ssid: !secret wifi_ssid password: !secret wifi_password

Screenshot_20240616_091801_Home Assistant

frontside76 commented 4 months ago

Another Log, now all 4 valves are offline.

Logger: homeassistant.components.gardena_bluetooth Quelle: helpers/update_coordinator.py:318 Integration: Gardena Bluetooth (Dokumentation, Probleme) Erstmals aufgetreten: 12:58:34 (2 Vorkommnisse) Zuletzt protokolliert: 14:34:34

Timeout fetching Gardena Bluetooth Data Update Coordinator data

When I do "Update All" in user interface of ESPHome Addon, all of them will be online again

elupus commented 4 months ago

When I do "Update All" in user interface of ESPHome Addon, all of them will be online again

Really?! That is a very important tidbit of information. That would indicate a bug in the esp gateways.

frontside76 commented 4 months ago

Yes. I can reproduce it again and again. Now all are online. Screenshot_20240616_203320_Home Assistant

elupus commented 4 months ago

Would be nice to get debug logs from the esps when you get the issues.

marithpl commented 4 months ago

After long time I suppose it's ESP or esp home bug. I see gardena valves are disconnected after few hours. Restart of ESP helps for some time.

Now I'm going to create an automation which restart ESP32 after gardena valves are offline for about 5 min.

I discovered that also other bluetooth devices are going to offline like switchbot curtain

Gardena:

image

Switchbot:

image
frontside76 commented 4 months ago

Which automation do you use?

frontside76 commented 4 months ago

Would be nice to get debug logs from the esps when you get the issues.

How can I do it, what do you need?

frontside76 commented 4 months ago

Another info: if I press "Safe Mode Boot", the valves are online again. It is a better and faster way instead of "Update all". Screenshot_20240617_151610_Home Assistant

frontside76 commented 4 months ago

So i made an automation to press Safe Mode Boot 15 minutes before the watering starts, and now I have no problems. But it is just a workaround, not a solution.

msa0311 commented 4 months ago

Interesting... I am seeing the same issues but "Safe Mode Boot" does not help in my case. Actually its making situation even worse because ESP node is not able to reconnect to ESP Home after that. After power reset of the ESP node it is back online again but still the Gardena Valve is not connecting.

The only way for me to bring back the Gardena Bluetooth valve once it was disconnected is to remove the battery for a few seconds, afterwards the Blue Bluetooth indication light is on and after few minutes without doing anything else the Gardena valve is connected again to ESP Node and available in Home Assistant.

frontside76 commented 4 months ago

Whats your proxy configuration? Here is mine:

Screenshot_20240620_102200_Signal

elupus commented 4 months ago

Safe mode is a really bad idea. Its for restarting esp in a safe mode where its not active for ble. You need to trigger a normal restart.

stefanogito commented 4 months ago

What helps on my end is adapting the intervals times (or probably anything else in the configuration) and reinstalling the esp32 with those changes.Am 20.06.2024 um 11:41 schrieb Joakim Plate @.***>: Safe mode is a really bad idea. Its for restarting esp in a safe mode where its not active for ble. You need to trigger a normal restart.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

msa0311 commented 4 months ago

@frontside76 here is my configuration, pretty much default:

substitutions:
  name: atom-bluetooth-proxy-a05904
  friendly_name: Bluetooth Proxy a05904
packages:
  esphome.bluetooth-proxy: github://esphome/firmware/bluetooth-proxy/m5stack-atom-lite.yaml@main
esphome:
  name: ${name}
  name_add_mac_suffix: false
  friendly_name: ${friendly_name}
api:
  encryption:
    key: xyz
wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

@stefanogito @elupus tried normal restart or modifying the config and install it, nothing helps - in my case the only way to bring back the Gardena Valve is not power cycle it by removing the battery for a moment.

frontside76 commented 4 months ago

@msa0311

Try to add following, this works for me:

esp32_ble_tracker:
  scan_parameters: 
    active: True

external_components:
  - source: github://pr#6596
    components: [ bluetooth_proxy, esp32_ble_client ]

bluetooth_proxy:
  active: True
  cache_services: True
alistair23 commented 3 months ago

I'm going to close this as it seems to be fixed with the latest device firmware. See https://github.com/home-assistant/core/issues/103117#issuecomment-2109815342 for details

frontside76 commented 3 months ago

@alistair23 no it is not solved! I have the latest firmware and the Problems are still there.

marithpl commented 3 months ago

I'm going to close this as it seems to be fixed with the latest device firmware. See #103117 (comment) for details

I've still have a problem with the latest firmware - so it's not a solution.

alistair23 commented 3 months ago

Maybe at this point it's worth opening a new issue with the logs? The information here is getting a bit stale

elupus commented 3 months ago

Agree. Lets restart a new issue. Restating the issue, with new logs.

msa0311 commented 3 months ago

I'm going to close this as it seems to be fixed with the latest device firmware. See #103117 (comment) for details

Confirmed what @alistair23 said earlier.

I have updated my device to the latest firmware 1.7.23.29 last week and at least for a few days the connection is stable now. Have not seen any further disconnects so far.

frontside76 commented 3 months ago

@msa0311 What configuration for the proxy do u use?

marithpl commented 3 months ago

My configuration, and I have connection troubles

esp32_ble_tracker:
  scan_parameters:
    interval: 1100ms
    window: 1100ms
    active: true

bluetooth_proxy:
  active: true
lucaobermaier commented 3 months ago

I have the same issue:

Two devices - next to each other. No BT proxy in use. Connection is established by a discontinued BT transmitter which is only 5 meters away.

Logger: homeassistant.components.gardena_bluetooth

Quelle: helpers/update_coordinator.py:344
Integration: Gardena Bluetooth (Dokumentation, Probleme)
Erstmals aufgetreten: 20:24:38 (8 Vorkommnisse)
Zuletzt protokolliert: 22:39:53

Error fetching Gardena Bluetooth Data Update Coordinator data: Unable to update data for 98bd0f14-0b0e-421a-84e5-ddbf75dc6de4 due to Communcation failed with device: Gardena Bluetooth - 70:B9:50:5F:F0:E5: Failed to connect after 9 attempt(s): No backend with an available connection slot that can reach address 70:B9:50:5F:F0:E5 was found: The proxy/adapter is out of connection slots or the device is no longer reachable; Add additional proxies (https://esphome.github.io/bluetooth-proxies/) near this device
Error fetching Gardena Bluetooth Data Update Coordinator data: Unable to update data for 98bd0f14-0b0e-421a-84e5-ddbf75dc6de4 due to Communcation failed with device: Gardena Bluetooth - D8:71:4D:02:03:C9: Failed to connect after 9 attempt(s): No backend with an available connection slot that can reach address D8:71:4D:02:03:C9 was found: The proxy/adapter is out of connection slots or the device is no longer reachable; Add additional proxies (https://esphome.github.io/bluetooth-proxies/) near this device
Error fetching Gardena Bluetooth Data Update Coordinator data: Unable to update data for 98bd0f14-0b0e-421a-84e5-ddbf75dc6de4 due to Unable to find device