Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inkbird sensor disconnecting Similar to #109405 #137249

Open
bschatzow opened this issue Feb 3, 2025 · 27 comments
Open

Inkbird sensor disconnecting Similar to #109405 #137249

bschatzow opened this issue Feb 3, 2025 · 27 comments
Assignees

Comments

@bschatzow
Copy link

The problem

The Inbird sensor disconnecting is back. Not sure if the Supervisor or Core is causing it. On a new update I lose the connection to one of my Inkbird sensors. A reboot always brings it back. Using ESPhome Proxy as my Bluetooth connection. The proxy is on line as it sees other Inkbird devices

What version of Home Assistant Core has the issue?

2025.2.0b7

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

Inkbird

Link to integration documentation on our website

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

Diagnostics information

Nothing in the logs. This issue keeps coming back.

Example YAML snippet

Anything in the logs that might be useful for us?

Additional information

No response

@home-assistant
Copy link

home-assistant bot commented Feb 3, 2025

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

Code owner commands

Code owners of inkbird 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 inkbird 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)


inkbird documentation
inkbird source
(message by IssueLinks)

@bdraco
Copy link
Member

bdraco commented Feb 3, 2025

Please post

  • diagnostics for the Bluetooth adapters
  • the Bluetooth section of the yaml config for each proxy
  • the MAC address of the ink bird device

Additionally, get everything into a good state, than enable the following debug logs :

logger:
  default: info
  logs:
    btsocket: debug
    inkbird_ble: debug
    bleak_retry_connector: debug
    bluetooth_adapters: debug
    bluetooth_auto_recovery: debug
    habluetooth: debug

When the problem happens again, post the logs and the timestamp of when the problem happens again

@bschatzow
Copy link
Author

bschatzow commented Feb 3, 2025

I have setup the logger to capture the information and will post next time it shows as offline.

The esphome code is:

substitutions:
  name: "garage-bluetooth-proxy"
  friendly_name: garage_bluetooth
ota:
  platform: esphome
packages:
  esphome.bluetooth-proxy: github://esphome/bluetooth-proxies/esp32-generic.yaml@main
esphome:
  name: ${name}
  name_add_mac_suffix: false
  friendly_name: ${friendly_name}
button:
  - platform: restart
    name: "Garage Restart"
    id: Button_Restart
switch:
  - platform: restart
    name: "garage_bluethooth Restart"
logger:
  level: VERBOSE
wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  use_address: 192.168.1.180
  manual_ip:
    static_ip: 192.168.1.180
    gateway: 192.168.1.1
    subnet: 255.255.255.0
    dns1: 192.168.1.1
    dns2: 8.8.8.8

I assume the mac address you are looking for is the Mac address shown in the Inkbird integration?
Bluetooth: 49:42:08:00:46:DC (the one that fails most of the time)
Bluetooth: 49:22:10:16:04:AD (the one that works most of the time)
Is the diagnostics that you are looking for the logs from esphome or something else?

@bdraco
Copy link
Member

bdraco commented Feb 3, 2025

Diagnostics from the Bluetooth config entry would be best. Thanks

@bschatzow
Copy link
Author

I have 4 restarts since I opened the issue. So far, it is back working. Not sure why? I'll leave this open for a couple of more days to see if it got fixed with a different change in either supervisor or core code.

@bdraco
Copy link
Member

bdraco commented Feb 4, 2025

I have a feeling its an environmental issue as there haven't been any changes that would explain why it would stop or start working again

@bschatzow
Copy link
Author

When / if it happens again I will post the information. Not sure what an environmental issue is? Nothing has changed in the area that the sensors are located.

@bdraco
Copy link
Member

bdraco commented Feb 5, 2025

When / if it happens again I will post the information. Not sure what an environmental issue is? Nothing has changed in the area that the sensors are located.

environmental issue = something unique to your local environment that we wouldn't see in testing. Could be interference, hardware issue, etc.

The logs still might give us a hint as to whats going on if you can get it to happen again, and just because it might be environmental, it doesn't mean we can't work around it with a software change (but sometimes its a configuration or hardware change that is needed)

@bschatzow
Copy link
Author

Just happened again on 2025.2 release
Not seeing anything in logs.

Bluetooth Diagnostic attached

@bdraco
Copy link
Member

bdraco commented Feb 5, 2025

It looks like the diagnostics are missing.

There should be something in the logs, are you sure you have all the debug loggers enabled?

logger:
  default: info
  logs:
    btsocket: debug
    inkbird_ble: debug
    bleak_retry_connector: debug
    bluetooth_adapters: debug
    bluetooth_auto_recovery: debug
    habluetooth: debug

@bschatzow
Copy link
Author

I had to leave before I left the json file above.
my config is:

logger:
  default: info
  logs:
    custom_components.hacs: debug
    custom_components.places: debug
    btsocket: debug
    inkbird_ble: debug
    bleak_retry_connector: debug
    bluetooth_adapters: debug
    bluetooth_auto_recovery: debug
    habluetooth: debug
    hacs: debug
    aiogithubapi: debug
    google_nest_sdm: debug
    google_nest_sdm.device: debug
    google_nest_sdm.device_manager: debug
    google_nest_sdm.google_nest_subscriber: debug
    google_nest_sdm.event: debug
    google.cloud.pubsub_v1: debug
    google.cloud.pubsub_v1.subscriber._protocol.streaming_pull_manager: debug
    homeassistant.components.simplisafe: debug
    simplipy: debug
    default: warning  
    homeassistant.components.waze_travel_time: debug
    homeassistant.helpers.location: debug
    homeassistant.components.bluetooth: debug

not sure if this is helpful from the logs:

Logger: aioesphomeapi.reconnect_logic
Source: runner.py:154
First occurred: 3:25:55 PM (8 occurrences)
Last logged: 3:26:32 PM

Can't connect to ESPHome API for office-esp32-bluetooth-proxy @ 192.168.1.82: Error while starting connection: Starting connection cancelled (APIConnectionCancelledError)
Can't connect to ESPHome API for garage-backup @ 192.168.1.95: Error while starting connection: Starting connection cancelled (APIConnectionCancelledError)
Can't connect to ESPHome API for garage-bluetooth-proxy @ 192.168.1.180: Error while starting connection: Starting connection cancelled (APIConnectionCancelledError)
Can't connect to ESPHome API for test-b30678 @ 192.168.1.84: Error while starting connection: Starting connection cancelled (APIConnectionCancelledError)
Can't connect to ESPHome API for office-esp32-bluetooth-proxy @ 192.168.1.82: Error connecting to [AddrInfo(family=<AddressFamily.AF_INET: 2>, type=<SocketKind.SOCK_STREAM: 1>, proto=6, sockaddr=IPv4Sockaddr(address='192.168.1.82', port=6053))]: [Errno 113] Connect call failed ('192.168.1.82', 6053) (SocketAPIError)


@bdraco
Copy link
Member

bdraco commented Feb 5, 2025

Can't connect to ESPHome API for garage-bluetooth-proxy @ 192.168.1.180: Error while starting connection: Starting connection cancelled (APIConnectionCancelledError)

That looks like a cancellation problem.

Can you send a full log? It seems the connection to the Bluetooth proxy is being dropped and reconnecting is being cancelled for some reason.

@bschatzow
Copy link
Author

I have since rebooted as I need this sensor. Next time it fails I will post the complete core logs. Do you also want a new json file as well?

@bdraco
Copy link
Member

bdraco commented Feb 6, 2025

I have since rebooted as I need this sensor. Next time it fails I will post the complete core logs. Do you also want a new json file as well?

Yes please

@bdraco
Copy link
Member

bdraco commented Feb 6, 2025

Since it looks like the esphome device might be part of the issue, please add aioesphomeapi logger as well

@bschatzow
Copy link
Author

Added this. I still don't understand why the issue only shows on a restart and goes away on a reboot.?

@bschatzow
Copy link
Author

Failed on a restart this morning. Had about 6 prior restarts with no issues.

home-assistant_2025-02-09T15-50-16.126Z.log

Bluetooth Json

config_entry-bluetooth-01JJSMXY3T4XJDPKX3MC6F7GNS (1).json

@bdraco
Copy link
Member

bdraco commented Feb 9, 2025

Which timestamp did it fail at?

@bdraco
Copy link
Member

bdraco commented Feb 9, 2025

Also which Bluetooth mac failed this time?

@bdraco
Copy link
Member

bdraco commented Feb 9, 2025

        "49:42:08:00:46:DC": 0.7399942789925262,

In the data seen 0.73s ago

{
          "name": "\u0013}\ufffd(\u0002\ufffd\u0018X",
          "address": "49:42:08:00:46:DC",
          "rssi": -96,
          "manufacturer_data": {
            "63938": {
              "__type": "<class 'bytes'>",
              "repr": "b'h\\x13\\x00\\xe1\\xa1d\\x08'"
            },
            "63890": {
              "__type": "<class 'bytes'>",
              "repr": "b'&\\x13\\x00A\\xbad\\x08'"
            },
            "63895": {
              "__type": "<class 'bytes'>",
              "repr": "b'\\x04\\x16\\x00.\\xe0d\\x08'"
            },
            "63898": {
              "__type": "<class 'bytes'>",
              "repr": "b'|\\x16\\x00\\x838d\\x08'"
            },
            "63906": {
              "__type": "<class 'bytes'>",
              "repr": "b'\\xf4\\x16\\x00\\xa2\\xd7d\\x08'"
            },
            "63896": {
              "__type": "<class 'bytes'>",
              "repr": "b'V\\x16\\x00\\xdb0d\\x08'"
            },
            "63894": {
              "__type": "<class 'bytes'>",
              "repr": "b'\\x89\\x16\\x00\\x83\\x0bd\\x08'"
            },
            "63920": {
              "__type": "<class 'bytes'>",
              "repr": "b'\\x01\\x17\\x00\\x0bvd\\x08'"
            },
            "63915": {
              "__type": "<class 'bytes'>",
              "repr": "b'\\xf6\\x12\\x00\\xdd\\xd6d\\x08'"
            },
            "63908": {
              "__type": "<class 'bytes'>",
              "repr": "b'\\x1d\\x17\\x00\\xfa\\xb3d\\x08'"
            },
            "63921": {
              "__type": "<class 'bytes'>",
              "repr": "b'\\x05\\x17\\x00wwd\\x08'"
            },
            "63923": {
              "__type": "<class 'bytes'>",
              "repr": "b'Z\\x17\\x00>\\xa5d\\x08'"
            },
            "63922": {
              "__type": "<class 'bytes'>",
              "repr": "b'\\xd1\\x12\\x00p\\x1fd\\x08'"
            },
            "63929": {
              "__type": "<class 'bytes'>",
              "repr": "b\"b\\x17\\x00'id\\x08\""
            },
            "63931": {
              "__type": "<class 'bytes'>",
              "repr": "b'\\xcc\\x17\\x00?Hd\\x08'"
            },
            "63928": {
              "__type": "<class 'bytes'>",
              "repr": "b'\\xb8\\x17\\x00;Rd\\x08'"
            },
            "63945": {
              "__type": "<class 'bytes'>",
              "repr": "b'\\xd8\\x17\\x00GGd\\x08'"
            },
            "63934": {
              "__type": "<class 'bytes'>",
              "repr": "b'V\\x18\\x00\\xd6\\x97d\\x08'"
            },
            "63937": {
              "__type": "<class 'bytes'>",
              "repr": "b'4\\x13\\x00e\\xb3d\\x08'"
            },
            "63933": {
              "__type": "<class 'bytes'>",
              "repr": "b'\\x13\\x18\\x00\\x83Bd\\x08'"
            },
            "63944": {
              "__type": "<class 'bytes'>",
              "repr": "b'8\\x18\\x00~\\x81d\\x08'"
            },
            "63940": {
              "__type": "<class 'bytes'>",
              "repr": "b'D\\x18\\x00\\xafXd\\x08'"
            },
            "63946": {
              "__type": "<class 'bytes'>",
              "repr": "b'K\\x13\\x00\\xf1\\xaad\\x08'"
            },
            "63962": {
              "__type": "<class 'bytes'>",
              "repr": "b'c\\x19\\x00\\xb6\\xc1d\\x08'"
            },
            "63964": {
              "__type": "<class 'bytes'>",
              "repr": "b'\\x14\\x19\\x00\\x8e\\xdbd\\x08'"
            },
            "63965": {
              "__type": "<class 'bytes'>",
              "repr": "b'S\\x19\\x00\\x03\\x0ed\\x08'"
            },
            "63972": {
              "__type": "<class 'bytes'>",
              "repr": "b'\\xf5\\x13\\x00y\\x88d\\x08'"
            },
            "63985": {
              "__type": "<class 'bytes'>",
              "repr": "b'\\xfb\\x14\\x00\\x17\\xb8d\\x08'"
            },
            "63967": {
              "__type": "<class 'bytes'>",
              "repr": "b'\\xd9\\x13\\x00]\\x84d\\x08'"
            },
            "63986": {
              "__type": "<class 'bytes'>",
              "repr": "b\"\\xe0\\x19\\x00'/d\\x08\""
            },
            "63991": {
              "__type": "<class 'bytes'>",
              "repr": "b'\\xe3\\x14\\x00\\x1f\\xbfd\\x08'"
            },
            "63978": {
              "__type": "<class 'bytes'>",
              "repr": "b'a\\x14\\x00S\\x95d\\x08'"
            },
            "63994": {
              "__type": "<class 'bytes'>",
              "repr": "b'\\xe6\\x19\\x00&\\xefd\\x08'"
            },
            "63990": {
              "__type": "<class 'bytes'>",
              "repr": "b'\\xd8\\x19\\x00W\"d\\x08'"
            },
            "63996": {
              "__type": "<class 'bytes'>",
              "repr": "b'=\\x15\\x00\\xdb\\xd4d\\x08'"
            },
            "63987": {
              "__type": "<class 'bytes'>",
              "repr": "b'\\xdf\\x19\\x00*\\xe3d\\x08'"
            },
            "63988": {
              "__type": "<class 'bytes'>",
              "repr": "b'\\xee\\x19\\x00\\xce\\xecd\\x08'"
            },
            "64004": {
              "__type": "<class 'bytes'>",
              "repr": "b'x\\x16\\x00kad\\x08'"
            },
            "64006": {
              "__type": "<class 'bytes'>",
              "repr": "b'\\x16\\x17\\x00r\\xecd\\x08'"
            },
            "64003": {
              "__type": "<class 'bytes'>",
              "repr": "b'\\x8e\\x15\\x00>cd\\x08'"
            },
            "63998": {
              "__type": "<class 'bytes'>",
              "repr": "b'o\\x15\\x00\\x03\\xc5d\\x08'"
            },
            "63989": {
              "__type": "<class 'bytes'>",
              "repr": "b'G\\x15\\x00&\\x0cd\\x08'"
            },
            "63973": {
              "__type": "<class 'bytes'>",
              "repr": "b'\\x16\\x14\\x00\\xb7\\x8ed\\x08'"
            },
            "63974": {
              "__type": "<class 'bytes'>",
              "repr": "b'%\\x14\\x00\\x03\\x81d\\x08'"
            },
            "63953": {
              "__type": "<class 'bytes'>",
              "repr": "b'\\x9c\\x13\\x00%\\x90d\\x08'"
            },
            "63959": {
              "__type": "<class 'bytes'>",
              "repr": "b'\\x8a\\x13\\x00LTd\\x08'"
            },
            "63947": {
              "__type": "<class 'bytes'>",
              "repr": "b'I\\x13\\x00m\\xaad\\x08'"
            },
            "63935": {
              "__type": "<class 'bytes'>",
              "repr": "b'0\\x13\\x00\\x0cxd\\x08'"
            },
            "63907": {
              "__type": "<class 'bytes'>",
              "repr": "b'\\xda\\x12\\x00\\xfd\\xded\\x08'"
            },
            "63900": {
              "__type": "<class 'bytes'>",
              "repr": "b'\\xa2\\x12\\x00i\\xc2d\\x08'"
            },
            "63904": {
              "__type": "<class 'bytes'>",
              "repr": "b'\\xa7\\x12\\x00)\\xc6d\\x08'"
            },
            "63903": {
              "__type": "<class 'bytes'>",
              "repr": "b'6\\x17\\x00o~d\\x08'"
            },
            "63897": {
              "__type": "<class 'bytes'>",
              "repr": "b'E\\x16\\x00\\x175d\\x08'"
            },
            "63899": {
              "__type": "<class 'bytes'>",
              "repr": "b'\\xec\\x16\\x00\\xbe\\xd5d\\x08'"
            }
          },
          "service_data": {},
          "service_uuids": [
            "0000fff0-0000-1000-8000-00805f9b34fb"
          ],
          "source": "EC:62:60:B2:C2:0C",
          "advertisement": [
            "\u0013}\ufffd(\u0002\ufffd\u0018X",
            {
              "63938": {
                "__type": "<class 'bytes'>",
                "repr": "b'h\\x13\\x00\\xe1\\xa1d\\x08'"
              },
              "63890": {
                "__type": "<class 'bytes'>",
                "repr": "b'&\\x13\\x00A\\xbad\\x08'"
              },
              "63895": {
                "__type": "<class 'bytes'>",
                "repr": "b'\\x04\\x16\\x00.\\xe0d\\x08'"
              },
              "63898": {
                "__type": "<class 'bytes'>",
                "repr": "b'|\\x16\\x00\\x838d\\x08'"
              },
              "63906": {
                "__type": "<class 'bytes'>",
                "repr": "b'\\xf4\\x16\\x00\\xa2\\xd7d\\x08'"
              },
              "63896": {
                "__type": "<class 'bytes'>",
                "repr": "b'V\\x16\\x00\\xdb0d\\x08'"
              },
              "63894": {
                "__type": "<class 'bytes'>",
                "repr": "b'\\x89\\x16\\x00\\x83\\x0bd\\x08'"
              },
              "63920": {
                "__type": "<class 'bytes'>",
                "repr": "b'\\x01\\x17\\x00\\x0bvd\\x08'"
              },
              "63915": {
                "__type": "<class 'bytes'>",
                "repr": "b'\\xf6\\x12\\x00\\xdd\\xd6d\\x08'"
              },
              "63908": {
                "__type": "<class 'bytes'>",
                "repr": "b'\\x1d\\x17\\x00\\xfa\\xb3d\\x08'"
              },
              "63921": {
                "__type": "<class 'bytes'>",
                "repr": "b'\\x05\\x17\\x00wwd\\x08'"
              },
              "63923": {
                "__type": "<class 'bytes'>",
                "repr": "b'Z\\x17\\x00>\\xa5d\\x08'"
              },
              "63922": {
                "__type": "<class 'bytes'>",
                "repr": "b'\\xd1\\x12\\x00p\\x1fd\\x08'"
              },
              "63929": {
                "__type": "<class 'bytes'>",
                "repr": "b\"b\\x17\\x00'id\\x08\""
              },
              "63931": {
                "__type": "<class 'bytes'>",
                "repr": "b'\\xcc\\x17\\x00?Hd\\x08'"
              },
              "63928": {
                "__type": "<class 'bytes'>",
                "repr": "b'\\xb8\\x17\\x00;Rd\\x08'"
              },
              "63945": {
                "__type": "<class 'bytes'>",
                "repr": "b'\\xd8\\x17\\x00GGd\\x08'"
              },
              "63934": {
                "__type": "<class 'bytes'>",
                "repr": "b'V\\x18\\x00\\xd6\\x97d\\x08'"
              },
              "63937": {
                "__type": "<class 'bytes'>",
                "repr": "b'4\\x13\\x00e\\xb3d\\x08'"
              },
              "63933": {
                "__type": "<class 'bytes'>",
                "repr": "b'\\x13\\x18\\x00\\x83Bd\\x08'"
              },
              "63944": {
                "__type": "<class 'bytes'>",
                "repr": "b'8\\x18\\x00~\\x81d\\x08'"
              },
              "63940": {
                "__type": "<class 'bytes'>",
                "repr": "b'D\\x18\\x00\\xafXd\\x08'"
              },
              "63946": {
                "__type": "<class 'bytes'>",
                "repr": "b'K\\x13\\x00\\xf1\\xaad\\x08'"
              },
              "63962": {
                "__type": "<class 'bytes'>",
                "repr": "b'c\\x19\\x00\\xb6\\xc1d\\x08'"
              },
              "63964": {
                "__type": "<class 'bytes'>",
                "repr": "b'\\x14\\x19\\x00\\x8e\\xdbd\\x08'"
              },
              "63965": {
                "__type": "<class 'bytes'>",
                "repr": "b'S\\x19\\x00\\x03\\x0ed\\x08'"
              },
              "63972": {
                "__type": "<class 'bytes'>",
                "repr": "b'\\xf5\\x13\\x00y\\x88d\\x08'"
              },
              "63985": {
                "__type": "<class 'bytes'>",
                "repr": "b'\\xfb\\x14\\x00\\x17\\xb8d\\x08'"
              },
              "63967": {
                "__type": "<class 'bytes'>",
                "repr": "b'\\xd9\\x13\\x00]\\x84d\\x08'"
              },
              "63986": {
                "__type": "<class 'bytes'>",
                "repr": "b\"\\xe0\\x19\\x00'/d\\x08\""
              },
              "63991": {
                "__type": "<class 'bytes'>",
                "repr": "b'\\xe3\\x14\\x00\\x1f\\xbfd\\x08'"
              },
              "63978": {
                "__type": "<class 'bytes'>",
                "repr": "b'a\\x14\\x00S\\x95d\\x08'"
              },
              "63994": {
                "__type": "<class 'bytes'>",
                "repr": "b'\\xe6\\x19\\x00&\\xefd\\x08'"
              },
              "63990": {
                "__type": "<class 'bytes'>",
                "repr": "b'\\xd8\\x19\\x00W\"d\\x08'"
              },
              "63996": {
                "__type": "<class 'bytes'>",
                "repr": "b'=\\x15\\x00\\xdb\\xd4d\\x08'"
              },
              "63987": {
                "__type": "<class 'bytes'>",
                "repr": "b'\\xdf\\x19\\x00*\\xe3d\\x08'"
              },
              "63988": {
                "__type": "<class 'bytes'>",
                "repr": "b'\\xee\\x19\\x00\\xce\\xecd\\x08'"
              },
              "64004": {
                "__type": "<class 'bytes'>",
                "repr": "b'x\\x16\\x00kad\\x08'"
              },
              "64006": {
                "__type": "<class 'bytes'>",
                "repr": "b'\\x16\\x17\\x00r\\xecd\\x08'"
              },
              "64003": {
                "__type": "<class 'bytes'>",
                "repr": "b'\\x8e\\x15\\x00>cd\\x08'"
              },
              "63998": {
                "__type": "<class 'bytes'>",
                "repr": "b'o\\x15\\x00\\x03\\xc5d\\x08'"
              },
              "63989": {
                "__type": "<class 'bytes'>",
                "repr": "b'G\\x15\\x00&\\x0cd\\x08'"
              },
              "63973": {
                "__type": "<class 'bytes'>",
                "repr": "b'\\x16\\x14\\x00\\xb7\\x8ed\\x08'"
              },
              "63974": {
                "__type": "<class 'bytes'>",
                "repr": "b'%\\x14\\x00\\x03\\x81d\\x08'"
              },
              "63953": {
                "__type": "<class 'bytes'>",
                "repr": "b'\\x9c\\x13\\x00%\\x90d\\x08'"
              },
              "63959": {
                "__type": "<class 'bytes'>",
                "repr": "b'\\x8a\\x13\\x00LTd\\x08'"
              },
              "63947": {
                "__type": "<class 'bytes'>",
                "repr": "b'I\\x13\\x00m\\xaad\\x08'"
              },
              "63935": {
                "__type": "<class 'bytes'>",
                "repr": "b'0\\x13\\x00\\x0cxd\\x08'"
              },
              "63907": {
                "__type": "<class 'bytes'>",
                "repr": "b'\\xda\\x12\\x00\\xfd\\xded\\x08'"
              },
              "63900": {
                "__type": "<class 'bytes'>",
                "repr": "b'\\xa2\\x12\\x00i\\xc2d\\x08'"
              },
              "63904": {
                "__type": "<class 'bytes'>",
                "repr": "b'\\xa7\\x12\\x00)\\xc6d\\x08'"
              },
              "63903": {
                "__type": "<class 'bytes'>",
                "repr": "b'6\\x17\\x00o~d\\x08'"
              },
              "63897": {
                "__type": "<class 'bytes'>",
                "repr": "b'E\\x16\\x00\\x175d\\x08'"
              },
              "63899": {
                "__type": "<class 'bytes'>",
                "repr": "b'\\xec\\x16\\x00\\xbe\\xd5d\\x08'"
              }
            },
            {},
            [
              "0000fff0-0000-1000-8000-00805f9b34fb"
            ],
            -127,
            -96,
            []
          ],
          "device": {
            "__type": "<class 'bleak.backends.device.BLEDevice'>",
            "repr": "BLEDevice(49:42:08:00:46:DC, \u0013}\ufffd(\u0002\ufffd\u0018X)"
          },
          "connectable": true,
          "time": 319940.108139138,
          "tx_power": null
        },

@bdraco
Copy link
Member

bdraco commented Feb 9, 2025

So the name is corrupted

>>> "\u0013}\ufffd(\u0002\ufffd\u0018X"
'\x13}�(\x02�\x18X'
>>> 

@bdraco
Copy link
Member

bdraco commented Feb 9, 2025

So it won't accept the advertising data once the name is corrupted because we no longer no what kind of device it is.

@bdraco
Copy link
Member

bdraco commented Feb 9, 2025

Its likely either a bug in the device firmware or a problem with the radio that causes it to send a corrupt name, or some interference problem that happens to have the CRC pass. Once it sees the longer name it will always prefer the longer name as it doesn't know the longer name is corrupt

@bdraco
Copy link
Member

bdraco commented Feb 9, 2025

A few things we could do to mitigate this problem:

  1. store the device type in the config entry so we do not need the name later since we can't trust we will get the right name from the device
  2. change the utf-8 parser in bluetooth-data-tools to be strict for names and reject them if they do not pass the strict decode test (will impact performance as we need to wrap with some try/except)

@bdraco
Copy link
Member

bdraco commented Feb 9, 2025

Sadly neither of these are small changes so it will take some time to work around this issue

@bschatzow
Copy link
Author

bschatzow commented Feb 9, 2025

Same Bluetooth: 49:42:08:00:46:DC as before. Not sure about time stamp. I grabbed the data as soon as it restarted with the sensor failure. I guess by the time I answered you had already figured this out.

@bdraco
Copy link
Member

bdraco commented Feb 9, 2025

At least we know whats going on now. Sadly we can't fix the actual problem but we can work around it. It will take some time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants