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
73.78k stars 30.88k forks source link

Switchbot Meter not detected #129973

Open dreifritz opened 1 week ago

dreifritz commented 1 week ago

The problem

Switchbot Meter works with Switchbot App (local BLE connection). Six Govee Bluetooth Thermometers, Shelly Bluetooth dongle, works flawlessly. Tried to add Switchbot Bluetooth integration, terminates immediately with "No unconfigured devices found" message. Active scanning enabled. Shelly dongle log and bluetooth.remote_scanners both show entries with correct device address: "E8:89:3E:EC:8F:82", see log file entries attached

What version of Home Assistant Core has the issue?

core-2024.10.4

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

SwitchBot

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

In Shelly Blu Gateway Log:
{
    "ts": 1730909572.454,
    "level": 2,
    "data": "shelly_notification:208 Event from script:1: {\"component\":\"script:1\",\"id\":1,\"event\":\"ble.scan_result\",\"data\":[2,[[\"e8:89:3e:ec:8f:82\",-70,\"AgEGDv9pCeiJPuyPgtgDApFC\",\"\"]]],\"ts\":1730909572.42}",
    "fd": 1
  },

In Home Assistant Log: homeassistant > -storage > bluetooth.remote_scanners
 "E8:89:3E:EC:8F:82": {
          "device": {
            "address": "E8:89:3E:EC:8F:82",
            "name": null,
            "rssi": -61,
            "details": {
              "source": "3C:E9:0E:7D:C6:70"
            }
          },
          "advertisement_data": {
            "local_name": null,
            "manufacturer_data": {
              "2409": "e8893eec8f82db03009142"
            },
            "service_data": {},
            "service_uuids": [],
            "rssi": -61,
            "tx_power": -127,
            "platform_data": []
          }
        },

Additional information

No response

bdraco commented 1 week ago

You either have active scans disabled or the SwitchBot device is too far away from the Bluetooth scanner and it can't hear it. SwitchBot requires active scans for discovery.

home-assistant[bot] commented 1 week ago

Hey there @danielhiversen, @renierm26, @murtas, @eloston, @dsypniewski, mind taking a look at this issue as it has been labeled with an integration (switchbot) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `switchbot` 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 switchbot` 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)


switchbot documentation switchbot source (message by IssueLinks)

dreifritz commented 1 week ago

As I wrote above, I do have active scans enabled, the Switchbot device is 2 meters away from the dongle, and it is detected by the Shelly dongle and listed in the HA scanner report. What else do you need to prove that the Switchbot device is present and visible?

bdraco commented 1 week ago
    "data": "shelly_notification:208 Event from script:1: {\"component\":\"script:1\",\"id\":1,\"event\":\"ble.scan_result\",\"data\":[2,[[\"e8:89:3e:ec:8f:82\",-70,\"AgEGDv9pCeiJPuyPgtgDApFC\",\"\"]]],\"ts\":1730909572.42}",

Active scans aren't happening or the device isn't sending a scan response. The second value is empty

https://github.com/home-assistant-libs/aioshelly/blob/78fd1ed4b1ece333301f26ae42bc8d5f3529fab2/aioshelly/ble/parser.py#L40

"AgEGDv9pCeiJPuyPgtgDApFC", "" <--- there should be a scan response here

Its likely one of the following problems:

dreifritz commented 1 week ago

Great. As a user I am totally lost. How can I find out if it's a Shelly integration bug or a Shelly firmware bug or a Switchbot firmware bug? Or something else? Strangely enough there are reports of other users that their Switchbot Meters do work. I am wondering why the Switchbot integration terminates immediately within a fraction of a second. I would have expected that it at least tries to find a device for some time.