ha-pitboss
ha-pitboss copied to clipboard
Integration fails to keep a connection with the grill.
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
- [X] I have enabled debug logging for my installation.
- [X] I have filled out the issue template to the best of my ability.
- [X] This issue only contains 1 issue (if you have multiple issues, open one issue for each issue).
- [X] This issue is not a duplicate issue of currently previous issues..
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
- Add the grill to the Pitboss Integration
- 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
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.
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.
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:599]: WiFi: [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:440]: Hostname: 'esp32-bluetooth-proxy-675ed8' [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:185]: Logger: [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][safe_mode.button:024]: Icon: 'mdi:restart-alert' [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:115]: mDNS: [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:
Any updates on this, I'm having the same issues. Got everything connected but all sensors are unavailable.
Since I've flashed my ble proxies with the arduino framework, the grill connects and works fine. This integration crashes and reboots esp32 boards ble proxies flashed with the esp-idf framework.
I wish there were something more I could do here. The grill/smoker bluetooth protocol requires an active connection from HA, which is way different from how most HA bluetooth integrations work. Typically bluetooth integrations in HA assume you can read data passively through BLE advertisements, but there aren't any advertisements exported by the grills.
It's not a great protocol implemented by the PitBoss developers, IMHO: it works by spitting out a strangely encoded message on the debug logging GATT service provided by Mongoose OS. On the plus-side, that GATT service supports bluetooth subscriptions, so you can subscribe to real-time updates. But the down-side is that you can't just passively watch advertisement data and have to stay connected to the grill.
Thanks for the insight. I keep checking on this to see if there is a solution and just looks like poor ble coding from pitboss. The actual app also uses WiFi. Is there a limitation in creating an implementation that uses WiFi instead.
The WiFi protocol uses AWS IoT Device Shadow which sends MQTT notifications to Amazon servers. IIRC the topics only allow one subscriber at a time, so if you open the PitBoss app at the same time it will disconnect any other connections.
It may be possible to override the MQTT server it's sending notifications to and have it instead send to a local one (i.e. one run by a HA AddOn) but then your PitBoss app will for sure stop working, and I'm not sure what else might break by doing that.
@dknowles2 i wouldnt mind this honestly, I have other apps where I can't login using the native app (Roomba, petkit feeder, etc). If I can get it running in HA and stop using pitboss app, I think that would be fine since my goal is to have all my stuff in a singular place.
Just my 2 cents though
The WiFi protocol uses AWS IoT Device Shadow which sends MQTT notifications to Amazon servers. IIRC the topics only allow one subscriber at a time, so if you open the PitBoss app at the same time it will disconnect any other connections.
It may be possible to override the MQTT server it's sending notifications to and have it instead send to a local one (i.e. one run by a HA AddOn) but then your PitBoss app will for sure stop working, and I'm not sure what else might break by doing that.
To be honest I only use the app to monitor and control temps. If that functionality still existed in HA, I'd be fine. Also on a more positive note recent update to this extension and with ESPHome now has my grill sending data to HA now. I am seeing issues where there is constant disconnects but I'm assuming that is something probably native to BLE or with ESPHome, but it works now.
Turns out I'm wrong about the Device Shadow. I think the original firmware used that but they switched it to a plain (unauthenticated!!!!) WebSocket when they refreshed the app last year.
I started making changes to the pytboss library to support this as an alternative transport, but my free time is booked up for the next 4 weeks so I'm not going to be able to finish up that work any time soon. When life calms down again I'll finish it up and plumb it into the HA integration as an option.
Hey @dknowles2 any movement on this ?
Let's track WiFi support in https://github.com/dknowles2/ha-pitboss/issues/71
I pushed a preview release (2025.1.0b4) that changes the transport to use WiFi instead of bluetooth. You can install it through HACS if you request to download a specific version
Please give it a try and let me know if it makes things better. My testing earlier in the week (before the temperature dropped again here) showed that the WiFi connection wasn't very reliable either. I suspect there's some instability in the PitBoss cloud service, because I was seeing the same unreliability through the iOS app.
I pushed a preview release (2025.1.0b4) that changes the transport to use WiFi instead of Bluetooth. You can install it through HACS if you request to download a specific version
Please give it a try and let me know if it makes things better. My testing earlier in the week (before the temperature dropped again here) showed that the WiFi connection wasn't very reliable either. I suspect there's some instability in the PitBoss cloud service, because I was seeing the same unreliability through the iOS app.
I have tried the new version and it works great. I think at the moment I am having general wifi issues with my grill as it won't even connect via their app. But I did a cook on 1/12 into 1/13
I pushed a preview release (2025.1.0b4) that changes the transport to use WiFi instead of bluetooth. You can install it through HACS if you request to download a specific version
Please give it a try and let me know if it makes things better. My testing earlier in the week (before the temperature dropped again here) showed that the WiFi connection wasn't very reliable either. I suspect there's some instability in the PitBoss cloud service, because I was seeing the same unreliability through the iOS app.
Tested it too and it works well so far, all I had to do was download the new PB app (had the old Smoke IT before), did the grill SW update and as soon as that was done HA saw the grill and asked to integrate it. Didn't have to provide the password the first go around as I had none configured. I'll report back if I have any issues. Thanks for the effort Mr Knowles!
Since I've flashed my ble proxies with the arduino framework, the grill connects and works fine. This integration crashes and reboots esp32 boards ble proxies flashed with the esp-idf framework.
as Wifi isn't an option for me, can you provide me the Code or a short tutorial how to do it? My ESP is working on Arduino IDE and i can monitor some basic example codes. But i am a noob and can't find the code to use it as a HA Proxy
https://esphome.io/index.html https://esphome.io/components/bluetooth_proxy.html https://esphome.io/projects/index.html
https://esphome.io/index.html https://esphome.io/components/bluetooth_proxy.html https://esphome.io/projects/index.html
thanks. I tried to reinstall the proxy . With esp home i edited it to: wifi: ssid: !secret wifi_ssid password: !secret wifi_password
esp32: board: esp32dev framework: type: arduino
and reinstalled it with esphome over "plug into this Computer" to use a serial port. (uploading bin, erase it, reinstall) But i still get the same error /problem. My ESP Log looks fine...
Also adding the timings didn't change anything
Can you help me to do a proper installation? or do i need different hardware (I use a esp32-vroom32 from aliexpress)
What error/problem is that? Be sure to install version 2024.10.1 of the PitBoss integration (and not beta/prerelease). I also use the wroom32 board. This is my working ESPHome yaml (although I get occasional disconnects and I have to reboot the BLE proxy):
substitutions:
name: "ble-proxy-front"
upper_devicename: BLE Proxy Front
hostname: BLE-Proxy-Front.lh
domain: .lh
friendly_name: BLE Proxy Front
esphome:
name: ${name}
name_add_mac_suffix: false
friendly_name: ${friendly_name}
esp32:
board: esp32dev
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
domain: $domain
use_address: $hostname
ap:
ssid: $upper_devicename
password: !secret ap_password
time:
- platform: homeassistant
id: homeassistant_time
api:
encryption:
key: !secret api_key
logger:
level: INFO
ota:
platform: esphome
password: !secret web_server_password
esp32_ble_tracker:
scan_parameters:
interval: 1100ms
window: 1100ms
active: true
bluetooth_proxy:
active: true
button:
- platform: safe_mode
name: $upper_devicename Safe Mode Boot
entity_category: diagnostic
- platform: restart
name: $upper_devicename Reboot
entity_category: diagnostic
What error/problem is that? Be sure to install version 2024.10.1 of the PitBoss integration (and not beta/prerelease). I also use the wroom32 board. This is my working ESPHome yaml (although I get occasional disconnects and I have to reboot the BLE proxy):
thanks! i can connect to the Grill and see the entities but every entity is empty/not avialable
your code doesnt include the framwork? How do you flash it? Esphome has esp-if as standard if im right?
I also checked the version. It's 2024.10.1
Here is my Log from the proxy:
and here from Pitboss
I've flashed the initial firmware over serial port (just like you) and subsequent updates over the air. The dafault framework is arduino. I've tried with recommended esp-idf but the boards just randomly crashes and reboots upon connection. So it's arduino if not sepecified. Is the reboot in your logs intended or due to a crash? Be sure that log level is INFO as it seems to help with low memory devices like this. As I've said, I also have connection issues but for the most it recovers after restarting the esp board and the integration (sometimes more than once). I'm guessing it's maybe due to poor signal from both esp board and grill although the grill connects just fine over bluetooth and bigger distances (even walls) with android PitBoss app. I've put the esp32 as close to the grill as possible but I still get ocasional disconnects. Also, I have the esp32 on a 2A power supply. I don't know what else to say, sadly I don't know anything at all about bluetooth protocols and connections and stuff.
Okay, no problem. I don't change anything in logs. And the wifi there is good + the esp board is around 3meters away from my grill (without walls or anything, so pretty good). If you use the esphome standard bluetooth build its esp-if... but i already tried both. Power supply is just a cheap 1A one, maybe i should change that. I also tried rebooting several times without any connection.
Thanks for your time. Maybe my Grill just got a error (bt over the app worked 2 years ago, but now it doesn't work).
@nickeeey No problem. Hope you get it sorted out! PS. The yaml I've just posted definitely installs the arduino framework😜:
INFO Reading configuration /config/esphome/ble-proxy-front.yaml...
INFO Detected timezone 'Europe/Bucharest'
INFO Generating C++ source...
INFO Compiling app...
Processing ble-proxy-front (board: esp32dev; framework: arduino; platform: platformio/[email protected])
--------------------------------------------------------------------------------
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
- toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
Dependency Graph
|-- WiFi @ 2.0.0
|-- ESPmDNS @ 2.0.0
|-- Update @ 2.0.0
|-- noise-c @ 0.1.6
RAM: [== ] 16.1% (used 52656 bytes from 327680 bytes)
Flash: [========= ] 87.2% (used 1599953 bytes from 1835008 bytes)
========================= [SUCCESS] Took 2.34 seconds =========================
INFO Successfully compiled program.
INFO Connecting to 192.168.1.52 port 3232...
INFO Connected to 192.168.1.52
INFO Uploading /data/build/ble-proxy-front/.pioenvs/ble-proxy-front/firmware.bin (1605728 bytes)
I'm going to close this issue. You can now choose between WiFi (WebSocket) and Bluetooth to connect, which I think should address all the issues that can be addressed.
It works great! Thank you! 🙏🏻