dknowles2 / ha-pitboss

Home Assistant Custom Integration for PitBoss smokers and grills
MIT License
27 stars 4 forks source link

Integration fails to keep a connection with the grill. #61

Open Flameancer opened 2 months ago

Flameancer commented 2 months ago

System Health details

System Information

version core-2024.7.0
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.12.4
os_name Linux
os_version 6.6.33-haos
arch x86_64
timezone America/New_York
config_dir /config
Home Assistant Community Store GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok GitHub API Calls Remaining | 5000 Installed Version | 1.34.0 Stage | running Available Repositories | 1392 Downloaded Repositories | 4 HACS Data | ok
Home Assistant Cloud logged_in | false -- | -- can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Home Assistant Supervisor host_os | Home Assistant OS 12.4 -- | -- update_channel | stable supervisor_version | supervisor-2024.06.2 agent_version | 1.6.0 docker_version | 26.1.4 disk_total | 30.8 GB disk_used | 6.7 GB healthy | true supported | true host_connectivity | true supervisor_connectivity | true ntp_synchronized | true virtualization | vmware board | ova supervisor_api | ok version_api | ok installed_addons | Advanced SSH & Web Terminal (18.0.0), Studio Code Server (5.15.0), Matter Server (6.2.1)
Dashboards dashboards | 2 -- | -- resources | 0 views | 1 mode | storage
Recorder oldest_recorder_run | June 24, 2024 at 2:02 PM -- | -- current_recorder_run | July 4, 2024 at 3:00 AM estimated_db_size | 105.36 MiB database_engine | sqlite database_version | 3.45.3

Checklist

Describe the issue

Hello I have a PB1100PSC2, this integration can see my grill and add it to HA, but all of the sensors are unavailable. I am running HA through a VM on Windows via VMware. I have tried using the onboard BLE devices with the passthrough and I have even setup a BLE proxy. While HA can at first see the grill, it cannot seems to keep the connection. Meanwhile my phone that is sitting in the same location can connect to the grill via BLE without issues.

Reproduction steps

  1. Add the grill to the Pitboss Integration
  2. Attempt to view any sensors while the grill is turned on and running.

Debug logs

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aioesphomeapi/client.py", line 578, in bluetooth_device_connect
    await connect_future
TimeoutError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/bleak_esphome/backend/client.py", line 77, in _async_wrap_bluetooth_operation
    return await func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/bleak_esphome/backend/client.py", line 297, in connect
    await self._client.bluetooth_device_connect(
  File "/usr/local/lib/python3.12/site-packages/aioesphomeapi/client.py", line 598, in bluetooth_device_connect
    raise TimeoutAPIError(
aioesphomeapi.core.TimeoutAPIError: Timeout waiting for connect response while connecting to 6E:79:0F:49:E8:26 after 20.0s, disconnect timed out: False,  after 20.0s

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/bleak_retry_connector/__init__.py", line 363, in establish_connection
    await client.connect(
  File "/usr/local/lib/python3.12/site-packages/habluetooth/wrappers.py", line 310, in connect
    connected = await super().connect(**kwargs)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/bleak/__init__.py", line 615, in connect
    return await self._backend.connect(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/bleak_esphome/backend/client.py", line 79, in _async_wrap_bluetooth_operation
    raise asyncio.TimeoutError(str(err)) from err
TimeoutError: Timeout waiting for connect response while connecting to 6E:79:0F:49:E8:26 after 20.0s, disconnect timed out: False,  after 20.0s

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/config/custom_components/pitboss/coordinator.py", line 62, in reset_device
    await self.conn.reset_device(device)
  File "/usr/local/lib/python3.12/site-packages/pytboss/ble.py", line 127, in reset_device
    await self.connect()
  File "/usr/local/lib/python3.12/site-packages/pytboss/ble.py", line 89, in connect
    self._ble_client = await bleak_retry_connector.establish_connection(
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/bleak_retry_connector/__init__.py", line 387, in establish_connection
    _raise_if_needed(name, device.address, exc)
  File "/usr/local/lib/python3.12/site-packages/bleak_retry_connector/__init__.py", line 327, in _raise_if_needed
    raise BleakNotFoundError(msg) from exc
bleak_retry_connector.BleakNotFoundError: PBL-98CDAC586188 - 6E:79:0F:49:E8:26: Failed to connect after 4 attempt(s): Timeout waiting for connect response while connecting to 6E:79:0F:49:E8:26 after 20.0s, disconnect timed out: False,  after 20.0s

Diagnostics dump

No response

dknowles2 commented 2 months ago

Yeah, this is a common problem. There's some strange interactions between the esphome ble stack and the controllers on the grills that I haven't quite nailed down.

You can try tweaking the esphome settings as suggested here: https://github.com/home-assistant/core/issues/79930#issuecomment-1279761239

In my experience, the retries eventually work, but they do leave a lot of log spam. I don't think I've tried tweaking the esphome settings myself, but I may do that before the next time I fire up my smoker.

nickwilsonr commented 2 months ago

I'm having a similar problem, with the exception that I'm not using an ESP32. Admittedly there's some distance between where my smoker is located and where my NAS (which is running the HA VM & has the BT receiver plugged into it). However, it detected my grill no problem during the configuration phase.

Flameancer commented 2 months ago

So I actually made a config change to ESP home and completely reinstalled the pitboss integration and same thing. The devices menu after a few minutes upon reboot sees the pitboss grill and adds it successfully but when viewing the entities they are all unavailable.

Logger: homeassistant Source: custom_components/pitboss/coordinator.py:62 integration: PitBoss (documentation, issues) First occurred: 12:09:06 PM (9 occurrences) Last logged: 2:18:28 PM

Error doing job: Task exception was never retrieved (None) Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/aioesphomeapi/client.py", line 578, in bluetooth_device_connect await connect_future TimeoutError

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/bleak_esphome/backend/client.py", line 77, in _async_wrap_bluetooth_operation return await func(self, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/bleak_esphome/backend/client.py", line 297, in connect await self._client.bluetooth_device_connect( File "/usr/local/lib/python3.12/site-packages/aioesphomeapi/client.py", line 598, in bluetooth_device_connect raise TimeoutAPIError( aioesphomeapi.core.TimeoutAPIError: Timeout waiting for connect response while connecting to 53:5D:1C:B4:8B:8F after 20.0s, disconnect timed out: False, after 20.0s

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/bleak_retry_connector/init.py", line 363, in establish_connection await client.connect( File "/usr/local/lib/python3.12/site-packages/habluetooth/wrappers.py", line 310, in connect connected = await super().connect(kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/bleak/init.py", line 615, in connect return await self._backend.connect(kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/bleak_esphome/backend/client.py", line 79, in _async_wrap_bluetooth_operation raise asyncio.TimeoutError(str(err)) from err TimeoutError: Timeout waiting for connect response while connecting to 53:5D:1C:B4:8B:8F after 20.0s, disconnect timed out: False, after 20.0s

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/config/custom_components/pitboss/coordinator.py", line 62, in reset_device await self.conn.reset_device(device) File "/usr/local/lib/python3.12/site-packages/pytboss/ble.py", line 127, in reset_device await self.connect() File "/usr/local/lib/python3.12/site-packages/pytboss/ble.py", line 89, in connect self._ble_client = await bleak_retry_connector.establish_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/bleak_retry_connector/init.py", line 387, in establish_connection _raise_if_needed(name, device.address, exc) File "/usr/local/lib/python3.12/site-packages/bleak_retry_connector/init.py", line 327, in _raise_if_needed raise BleakNotFoundError(msg) from exc bleak_retry_connector.BleakNotFoundError: PBL-98CDAC586188 - 53:5D:1C:B4:8B:8F: Failed to connect after 4 attempt(s): Timeout waiting for connect response while connecting to 53:5D:1C:B4:8B:8F after 20.0s, disconnect timed out: False, after 20.0s

Output from ESP: INFO ESPHome 2024.6.6 INFO Reading configuration /config/esphome/esp32-bluetooth-proxy-675ed8.yaml... INFO Starting log output from 172.16.1.236 using esphome API INFO Successfully connected to esp32-bluetooth-proxy-675ed8 @ 172.16.1.236 in 0.010s INFO Successful handshake with esp32-bluetooth-proxy-675ed8 @ 172.16.1.236 in 0.088s [14:27:51][I][app:100]: ESPHome version 2024.6.6 compiled on Jul 4 2024, 11:40:11 [14:27:51][I][app:102]: Project esphome.bluetooth-proxy version 1.0

[14:27:51][C][wifi:427]: Local MAC: 10:06:1C:67:5E:D8 [14:27:51][C][wifi:432]: SSID: [redacted] [14:27:51][C][wifi:435]: IP Address: 172.16.1.236 [14:27:51][C][wifi:439]: BSSID: [redacted]

[14:27:51][C][wifi:442]: Signal strength: -68 dB ▂▄▆█ [14:27:51][C][wifi:446]: Channel: 1 [14:27:51][C][wifi:447]: Subnet: 255.255.255.0 [14:27:51][C][wifi:448]: Gateway: 172.16.1.1 [14:27:51][C][wifi:449]: DNS1: 172.16.1.20 [14:27:51][C][wifi:450]: DNS2: 1.1.1.1

[14:27:51][C][logger:186]: Level: DEBUG [14:27:51][C][logger:188]: Log Baud Rate: 115200 [14:27:51][C][logger:189]: Hardware UART: UART0 [14:27:51][C][bluetooth_proxy:088]: Bluetooth Proxy: [14:27:51][C][bluetooth_proxy:089]: Active: YES [14:27:51][C][safe_mode.button:024]: Safe Mode Button 'Safe Mode Boot'

[14:27:51][C][esp32_ble:383]: ESP32 BLE: [14:27:51][C][esp32_ble:385]: MAC address: 10:06:1C:67:5E:DA [14:27:51][C][esp32_ble:386]: IO Capability: none [14:27:51][C][esp32_ble_tracker:653]: BLE Tracker: [14:27:51][C][esp32_ble_tracker:654]: Scan Duration: 300 s [14:27:51][C][esp32_ble_tracker:655]: Scan Interval: 2000.0 ms [14:27:51][C][esp32_ble_tracker:656]: Scan Window: 1100.0 ms [14:27:51][C][esp32_ble_tracker:657]: Scan Type: ACTIVE [14:27:51][C][esp32_ble_tracker:658]: Continuous Scanning: True

[14:27:51][C][mdns:116]: Hostname: esp32-bluetooth-proxy-675ed8 [14:27:51][C][esphome.ota:073]: Over-The-Air updates: [14:27:51][C][esphome.ota:074]: Address: esp32-bluetooth-proxy-675ed8.local:3232 [14:27:51][C][esphome.ota:075]: Version: 2 [14:27:51][C][safe_mode:018]: Safe Mode: [14:27:51][C][safe_mode:020]: Boot considered successful after 60 seconds [14:27:51][C][safe_mode:021]: Invoke after 10 boot attempts [14:27:51][C][safe_mode:023]: Remain in safe mode for 300 seconds [14:27:51][C][api:139]: API Server: [14:27:51][C][api:140]: Address: esp32-bluetooth-proxy-675ed8.local:6053 [14:27:51][C][api:142]: Using noise encryption: YES [14:27:51][C][improv_serial:032]: Improv Serial:

trentsmart commented 1 month ago

Any updates on this, I'm having the same issues. Got everything connected but all sensors are unavailable.