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.7k stars 30.82k forks source link

Switchbot Lock doesn't show up in integration. #100342

Open rdperkins opened 1 year ago

rdperkins commented 1 year ago

The problem

It worked for a few months, but I noticed it not showing up a couple of months ago - not sure of the time. Haven't tried deleting the Switchbot integration and reinstalling yet.

What version of Home Assistant Core has the issue?

core-2023.9.2

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?

No response

Additional information

No response

home-assistant[bot] commented 1 year 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.

(message by CodeOwnersMention)


switchbot documentation switchbot source (message by IssueLinks)

morficus commented 1 year ago

I can confirm that it is showing up again. I'm currently running 2023.10.0

rdperkins commented 1 year ago

I see the Switchbot BT Hub in my integrations, but how do I find/integrate/control my Switchbot Lock or Bots? I don’t see any Switchbot devices or entities other than the hub.

From: Maurice Williams @.> Sent: Thursday, October 5, 2023 9:09 AM To: home-assistant/core @.> Cc: Robert Perkins @.>; Author @.> Subject: Re: [home-assistant/core] Switchbot Lock doesn't show up in integration. (Issue #100342)

I can confirm that it is showing up again. I'm currently running 2023.10.0

— Reply to this email directly, view it on GitHubhttps://github.com/home-assistant/core/issues/100342#issuecomment-1748866117, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AH55NH4CRGNANDXS25OJ5VLX52WNFAVCNFSM6AAAAAA4XMJ5ESVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONBYHA3DMMJRG4. You are receiving this because you authored the thread.Message ID: @.**@.>>

morficus commented 1 year ago

I just got a switchbot device (+ hub) and you are correct. I see the "integration" in the list, but it does not find any devices (either BT or the API integration).

Mcruiser commented 11 months ago

same for me. I had the lock registered and could access the entities through a BT proxy (esp32). then about 4 weeks ago they became unavailable, and I deleted them, hoping I could re-register them again)

When scanning for BT integration I get a prompt that no device is available. Reset the lock (take batteries out and re-calibrate).

the device is also registered through SwBot Hub mini using the switchbot cloud integration (entered API token & key as per instructions). The cloud integration in HA shows no devices available; in the switchbot app, however, the lock shows as registered with the cloud.

the lock shows up with it's MAC in the BLE proxy logs like so:

[10:56:44][VV][esp32_ble_tracker:423]: Parse Result: [10:56:44][VV][esp32_ble_tracker:440]: Address: XX:54:X:X4:X:EX (RANDOM) [10:56:44][VV][esp32_ble_tracker:442]: RSSI: -76 [10:56:44][VV][esp32_ble_tracker:443]: Name: '' [10:56:44][VV][esp32_ble_tracker:451]: Ad Flag: 6 [10:56:44][VV][esp32_ble_tracker:457]: Manufacturer data: XX:54:X:X4:X:EX.38.83.00.20 (10) [10:56:44][VV][esp32_ble_tracker:468]: Service data: [10:56:44][VV][esp32_ble_tracker:469]: UUID: 0xFD3D [10:56:44][VV][esp32_ble_tracker:470]: Data: 6F.80.64 [10:56:44][VV][esp32_ble_tracker:473]: Adv data: 02.01.06.0D.FF.69.09.XX:54:X:X4:X:EX.38.83.00.20.06.16.3D.FD.6F.80.64 (24)

all versions are on the latest Core 2023.11.3 Supervisor 2023.11.6 Operating System 11.1 (VM ware) Frontend 20231030.2 ESPHome 2023.11.6

Mcruiser commented 11 months ago

are the MACs cached somewhere? can that be reset?

Mcruiser commented 11 months ago

I removed the mac of the lock from all files under /.storage (as per https://community.home-assistant.io/t/howto-re-add-removed-bluetooth-devices-via-esphome-bluetooth-proxy/596000) restarted HA, restarted hosting VM; no luck

only file the mac is showing up persistently (even after deleting the entry) is in "\homeassistant\config.storage\bluetooth.remote_scanners" like so: ~ line 60:

..., "XX:54:XX:X4:XX:EX": { "device": { "address": "XX:54:XX:X4:XX:EX", "name": null, "rssi": -75, "details": { "source": "11:111:11:11:11:11", "address_type": 1 } }, "advertisement_data": { "local_name": null, "manufacturer_data": { "2409": "XX:54:XX:X4:XX:EX" }, "service_data": { "0000fd3d-0000-1000-8000-00805f9b34fb": "6f8064" }, "service_uuids": [], "rssi": -75, "tx_power": -127, "platform_data": [] } },

and ~ line 1155

"discovered_device_timestamps": { ... "XX:54:XX:X4:XX:EX": 1702258625.2534335, ...


this is the esp32 yaml for the BT proxy and ble tracker settings?

bluetooth_proxy: active: true

esp32_ble_tracker: scan_parameters: interval: 5000ms window: 500ms active: true

on_ble_advertise:

Mcruiser commented 11 months ago

the BLE scanner logs show this :

[13:42:45][D][esp32_ble_tracker:266]: Starting scan... [13:42:45][D][ble_adv:055]: New BLE device [13:42:45][D][ble_adv:056]: address: XX:54:XX:X4:XX:EX

[13:42:45][D][ble_adv:058]: Advertised service UUIDs: [13:42:45][D][ble_adv:062]: Advertised service data: [13:42:45][D][ble_adv:064]: - 0xFD3D: (length 3) [13:42:45][D][ble_adv:066]: Advertised manufacturer data: [13:42:45][D][ble_adv:068]: - 0x0969: (length 10) [13:42:45][D][ble_adv:055]: New BLE device [13:42:45][D][ble_adv:056]: address: XX:54:XX:X4:XX:EX

[13:42:45][D][ble_adv:058]: Advertised service UUIDs: [13:42:45][D][ble_adv:062]: Advertised service data: [13:42:45][D][ble_adv:064]: - 0xFD3D: (length 3) [13:42:45][D][ble_adv:066]: Advertised manufacturer data: [13:42:45][D][ble_adv:068]: - 0x0969: (length 10) [13:42:45][D][ble_adv:055]: New BLE device [13:42:45][D][ble_adv:056]: address: XX:54:XX:X4:XX:EX

[13:42:45][D][ble_adv:058]: Advertised service UUIDs: [13:42:45][D][ble_adv:062]: Advertised service data: [13:42:45][D][ble_adv:064]: - 0xFD3D: (length 3) [13:42:45][D][ble_adv:066]: Advertised manufacturer data: [13:42:45][D][ble_adv:068]: - 0x0969: (length 10)

Mcruiser commented 11 months ago

but no new device available when trying to add Switchbot BT device

dyl421421 commented 11 months ago

I am experiencing the same issue with switchbot lock. I am able to see the device's MAC address from the logs of my bluetooth device, but the lock is never discovered. I am not able to add the lock to Home Assistant.

Mcruiser commented 11 months ago

I was able to restore the devices from a backup - despite the integration not being able to find the device (I had it working at some point earlier, so could get the setup from a backup).

this is the device entry in the "\homeassistant\config.storage\core.config_entries" , under "data": { "entries": [ {..}, { "entry_id": "078b07323f79f82ea50fc215176ab632", "version": 1, "domain": "switchbot", "title": "Lock A5FB", "data": { "key_id": "61", "encryption_key": "b6eb214822b9c24752d835a3baccabff", "address": "XX:54:XX:X4:XX:EX", "sensor_type": "lock" }, "options": { "retry_count": 3 }, "pref_disable_new_entities": false, "pref_disable_polling": false, "source": "bluetooth", "unique_id": "XX54XXX4XXEX", "disabled_by": null }, {...} ]

and also in the file "\homeassistant\config.storage\core.device_registry", under "data": { "devices": [ {...}, { "area_id": "hallway", "config_entries": [ "078b07323f79f82ea50fc215176ab632" ], "configuration_url": null, "connections": [ [ "mac", "XX:54:XX:X4:XX:EX" ], [ "bluetooth", "XX:54:XX:X4:XX:EX" ] ], "disabled_by": null, "entry_type": null, "hw_version": null, "id": "51af086d6dfccf420e03770bfe555ec3", "identifiers": [], "manufacturer": "switchbot", "model": "WoLock", "name_by_user": null, "name": "Lock A5FB", "serial_number": null, "sw_version": null, "via_device_id": null }, {...} ]

notice the corresponding ID in the two files (078b07323f79f82ea50fc215176ab632); you want to have a unique one of your own to use.

so maybe you can try editing these two files in order to add the lock to your config, then restart HA - make sure to do a full system backup before that, of course.

This worked for me and I have the lock functional and available in HA under the Switchbot BT integration again.

koshisan commented 10 months ago

Same here. I recently bought a second lock (its a pro version only available in Japan at the moment, but I am pretty sure the internal hardware is exactly the same). While my old lock continous to work perfectly, the new one just doesn't show up anywhere...

rdperkins commented 10 months ago

Thanks. Getting ready to try this but have some questions. Sorry for the delay. COVID hit!

How did you restore these two files from previous HA backups and to where? Did you edit them after or before importing them into HA? How do you import the file into HA, or do you just copy and paste from where you restored the file? Is the lock still working?

Happy New Year, Robert

From: Mcruiser @.> Sent: Wednesday, December 20, 2023 5:57 PM To: home-assistant/core @.> Cc: Robert Perkins @.>; Author @.> Subject: Re: [home-assistant/core] Switchbot Lock doesn't show up in integration. (Issue #100342)

I was able to restore the devices from a backup - despite the integration not being able to find the device (I had it working at some point earlier, so could get the setup from a backup).

this is the device entry in the "\homeassistant\config.storage\core.config_entries" , under "data": { "entries": [ {..}, { "entry_id": "078b07323f79f82ea50fc215176ab632", "version": 1, "domain": "switchbot", "title": "Lock A5FB", "data": { "key_id": "61", "encryption_key": "b6eb214822b9c24752d835a3baccabff", "address": "XX:54:XX:X4:XX:EX", "sensor_type": "lock" }, "options": { "retry_count": 3 }, "pref_disable_new_entities": false, "pref_disable_polling": false, "source": "bluetooth", "unique_id": "XX54XXX4XXEX", "disabled_by": null }, {...} ]

and also in the file "\homeassistant\config.storage\core.device_registry", under "data": { "devices": [ {...}, { "area_id": "hallway", "config_entries": [ "078b07323f79f82ea50fc215176ab632" ], "configuration_url": null, "connections": [ [ "mac", "XX:54:XX:X4:XX:EX" ], [ "bluetooth", "XX:54:XX:X4:XX:EX" ] ], "disabled_by": null, "entry_type": null, "hw_version": null, "id": "51af086d6dfccf420e03770bfe555ec3", "identifiers": [], "manufacturer": "switchbot", "model": "WoLock", "name_by_user": null, "name": "Lock A5FB", "serial_number": null, "sw_version": null, "via_device_id": null },

so maybe you can try editing these two files in order to add the lock to your config, then restart HA - make sure to do a full system backup before that, of course.

— Reply to this email directly, view it on GitHubhttps://github.com/home-assistant/core/issues/100342#issuecomment-1865250597, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AH55NHZWJMS6VPTC5LBME43YKNUMNAVCNFSM6AAAAAA4XMJ5ESVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRVGI2TANJZG4. You are receiving this because you authored the thread.Message ID: @.**@.>>

Mcruiser commented 10 months ago

As mentioned, I had it working at some point (first time setup was no trouble).

I located a backup from back then and downloaded it, extracted the config files (see above). I searched those files for the mac address of the lock, as it shows in my proxy debug logs.

then I just copied the json object(s) as outlined of from each file into the existing json object collection in the current ones on my HA; then restarted.

if you don't have a backup, maybe you can try to take the json config objects, insert the mac of your device (note: there are multiple lines, in either full mac notation with colons, or just the alphanumeric mac sequence without colon dividers), and add them to your HA config files.

make a full backup of the system prior, naturally. ;)

e4kenndr commented 9 months ago

Just in case helps anybody in future scanning this threadf - I eventually found my lock by going to bluetooth integrations settings (Not the Switchbot integration, but home assisstant bluetooth integration.) Clicking configure, and then unticking "passive scanning" lock was instantly found then

theadlee commented 7 months ago

I am having the same symptoms that @Mcruiser was experiencing, however, I can't resolve this with an old backup because the Lock Pro has never been discovered.

Just bought the new Switchbot Lock Pro and it refuses to be discovered by any of my BT Proxy devices. I have several switchbot buttons that are successfully working with HA and ESP32 BT Proxy but these same ESP32 devices will not discover the Lock Pro. The Lock MAC address is being heard by multiple BT Proxy devices. In addition, when I install the Switchbot Cloud integration, no devices are discovered.

theadlee commented 7 months ago

As an interim solution in case anyone else is having a problem, I have installed the homebridge switchbot plugin which works with home assistant. Unfortunately, this uses the cloud OpenAI interface and is not local.

randomsnack commented 7 months ago

I just has this problem, Home Assistant did not recognize the new Switchbot lock. I remember I had disable the BT dongle/integration and was only using BT proxy. Once I enable the BT integration and reboot, it recognized it right away. I tested it with disabling the BT integration and rebooting HA, the locks are working with BT proxy once installed through BT integration. Make sure the BT is configured to have active scan when trying to find the device. Some installation does not have this configuration and it's active by default.

theadlee commented 7 months ago

I just has this problem, Home Assistant did not recognize the new Switchbot lock. I remember I had disable the BT dongle/integration and was only using BT proxy. Once I enable the BT integration and reboot, it recognized it right away. I tested it with disabling the BT integration and rebooting HA, the locks are working with BT proxy once installed through BT integration. Make sure the BT is configured to have active scan when trying to find the device. Some installation does not have this configuration and it's active by default.

Thanks for sharing. Unfortunately this will not work for me. I am running HA on proxmox and currently do not have a Bluetooth adaptor passed through to my HA instance.

theadlee commented 7 months ago

I spend a few more hours trying to resolve this today with no luck. I disabled my ESP32 BT Proxy and installed a Bluetooth dongle. Again the dongle sees the MAC address of the Lock Pro and the Keypad but will not autodiscover. Both my ESP32 devices and Bluetooth dongle work with three of my Switchbot Bot devices but not the Lock Pro. The only thing I can think of at this point is that the Lock Pro must have new firmware that makes the autodiscovery process not recognize the Lock Pro. When installed the Lock Pro and the keypad, both of them had a firmware update available which I applied.

dsypniewski commented 7 months ago

I spend a few more hours trying to resolve this today with no luck. I disabled my ESP32 BT Proxy and installed a Bluetooth dongle. Again the dongle sees the MAC address of the Lock Pro and the Keypad but will not autodiscover. Both my ESP32 devices and Bluetooth dongle work with three of my Switchbot Bot devices but not the Lock Pro. The only thing I can think of at this point is that the Lock Pro must have new firmware that makes the autodiscovery process not recognize the Lock Pro. When installed the Lock Pro and the keypad, both of them had a firmware update available which I applied.

@theadlee the Pro model is separate from the standard one and currently it's not supported by SwitchBot BLE integration.

koshisan commented 7 months ago

Just to give a work around because people get increasingly frustrated: With the new hub both devices (normal and pro) support matter and work flawlessly in Home Assistant! Only the lock itself is exposed though - no door sensor, etc.

theadlee commented 7 months ago

I spend a few more hours trying to resolve this today with no luck. I disabled my ESP32 BT Proxy and installed a Bluetooth dongle. Again the dongle sees the MAC address of the Lock Pro and the Keypad but will not autodiscover. Both my ESP32 devices and Bluetooth dongle work with three of my Switchbot Bot devices but not the Lock Pro. The only thing I can think of at this point is that the Lock Pro must have new firmware that makes the autodiscovery process not recognize the Lock Pro. When installed the Lock Pro and the keypad, both of them had a firmware update available which I applied.

@theadlee the Pro model is separate from the standard one and currently it's not supported by SwitchBot BLE integration.

@dsypniewski thanks for the clarification. I will purchase the switchbot hub 2 and use matter for the time being. Are there any technical issues that would prohibit the Switchbot BLE integration in the future?

dsypniewski commented 7 months ago

@theadlee I think that as long as someone with a lot of free time, technical skills and the lock at hand would look into it then almost anything can be reverse engineered. Unfortunately I don't own the Pro model so I can't do it as I did for the standard one.

koshisan commented 6 months ago

Oh btw. just to add more info if someone actually wants to try: I did add my Pro model manually with editing the storage configuration like rdperkins suggested and it did somewhat work. Only the state seems to be reversed. This is only for the lock itself, the door sensor, etc. works just fine. -> I think you could probably get away with using the existing code, adding the identification of the new lock and fiddling around with reversing the status updates.

theadlee commented 6 months ago

Oh btw. just to add more info if someone actually wants to try: I did add my Pro model manually with editing the storage configuration like rdperkins suggested and it did somewhat work. Only the state seems to be reversed. This is only for the lock itself, the door sensor, etc. works just fine. -> I think you could probably get away with using the existing code, adding the identification of the new lock and fiddling around with reversing the status updates.

@koshisan great information. Thanks for sharing. I may try this myself. If the Pro is that similar to the previous gen maybe @dsypniewski will graciously add support.

nerumo commented 5 months ago

Just to give a work around because people get increasingly frustrated: With the new hub both devices (normal and pro) support matter and work flawlessly in Home Assistant! Only the lock itself is exposed though - no door sensor, etc.

hmm, I do have the hub, I added all my switchbot devices to the hub, but I can't see them anywhere in HA. How did you add the hub to HA?

issue-triage-workflows[bot] commented 2 months ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

rdperkins commented 2 months ago

I only see the cloud, not my bots, hubs or lock all of which are shown and operating with the switchbot app. Sent from my iPhone Robert Perkins

On Sep 15, 2024, at 11:07 AM, issue-triage-workflows[bot] @.***> wrote:



There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

— Reply to this email directly, view it on GitHubhttps://github.com/home-assistant/core/issues/100342#issuecomment-2351451450, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AH55NH3G7HFNTUL5XVTTB7TZWU54LAVCNFSM6AAAAAA4XMJ5ESVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNJRGQ2TCNBVGA. You are receiving this because you authored the thread.Message ID: @.***>

TioBundy commented 1 week ago

Until today I have integrated Switchbot Lock Pro in Home Assistant, 4 months. Suddenly tonight has stopped working and I just noticed after an update of an ESP32 Bluetooth proxy. But with the shutdown I can't detect the lock again. I hope the support these problems and help us.