Add support for switchbot presence sensor#156314
Conversation
There was a problem hiding this comment.
It seems you haven't yet signed a CLA. Please do so here.
Once you do that we will be able to review and accept this pull request.
Thanks!
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
|
Hey there @Danielhiversen, @RenierM26, @murtas, @Eloston, @dsypniewski, @zerzhang, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
|
Hi @lukasmalkmus, thanks for this PR! JFYI, the Switchbot Smart Radiator Thermostat support by @zerzhang has just been merged: #155123 Thanks again |
|
This shows "motion" in your screenshot. As its a presence sensor, it would likely be better to show "occupancy" instead, with also the house icon instead of motion icon. |
dc8495d to
8561814
Compare
| # Presence sensors should use occupancy device class instead of motion | ||
| if ( | ||
| binary_sensor == "motion_detected" | ||
| and coordinator.model == SwitchbotModel.PRESENCE_SENSOR | ||
| ): | ||
| self._attr_device_class = BinarySensorDeviceClass.OCCUPANCY |
There was a problem hiding this comment.
Not sure about this bit but I didn't want to interfere with existing sensors by changing this, globally.
There was a problem hiding this comment.
I would say the light sensor can be called that as well. Unfortunately no lux values so not a lux sensor, but still a light level sensor. Just trying to help out with correct labeling, hope it can be merged soon, bought 7 of these in the hope they were supported, but they were not (yet). Haha.
There was a problem hiding this comment.
From what I understand, this might not just be the labeling, which is why I was careful.
And yes, same mistake. Bought a bunch just to find out they are not (yet) compatible, lol 🤦
This comment was marked as off-topic.
This comment was marked as off-topic.
8561814 to
dfada38
Compare
This comment was marked as off-topic.
This comment was marked as off-topic.
frenck
left a comment
There was a problem hiding this comment.
Oh hi there @lukasmalkmus 👋
Thanks for the pull request. However, the tests seems to be failing right now. Can you take a look and make sure they pass?
Thanks already! 🙏
../Frenck
Blogging my personal ramblings at frenck.dev
This comment was marked as off-topic.
This comment was marked as off-topic.
ed89d72 to
2057d8a
Compare
2057d8a to
2f52f3b
Compare
Hi, I rebased on latest main, every check seems to pass, now (apart from the ones I can't trigger as I miss workflow approval). EDIT: I think most of the comments here are a result of frustration about the poor marketing from SwitchBot. I bought the sensor because the product page explicitly stated that it supports Home Assistant without a Hub. SwitchBot Bluetooth being a gold rated HA integration, I thought I'm just doing something wrong and reached out to SwitchBot support. After going through the usual first-level support shenanigans of providing screenshots, diagnostics, etc. it turns out the support is just not there and scheduled to be available Nov. 31st. A little more detail in the marketing material would have helped many of us :) |
|
So we now we have this PR and this other one for the same goal and both not yet merged. |
75eeea9 to
d461cc6
Compare
|
Can you please stop force pushing? I pushed changed to get it mergable and now it's overwritten again... |
I'm not emotionally attached to this piece of code so I happily accept the other PR being merged (not that I have any authority over that 😄) since the author seems to be affiliated with SwitchBot. (I still incorporated the missing And finally the tests pass, forgot to update them. |
|
I am going to check with Switchbot on the battery range, as I think it's weird to both have battery state and battery range. It doesn't add much IMO (why add a vague option when you have a precise one available) |
b96dfbb to
b83720e
Compare
|
Thanks @lukasmalkmus @joostlek |
Ah, my bad! I Didn't see that. I recently adopted Jujutsu and now I developed a habit of force pushing. Forgot for a second I'm not alone on this branch. |
|
Thank you all for the help getting this merged! |

👋 First-time contributor
First contribution to Home Assistant. Created with AI assistance, thoroughly reviewed and tested with actual hardware on HA 2025.11.1. All entities working correctly.
Compact implementation (~93 lines, mostly tests) following recent merged PRs (#155124, #155309). Happy to receive feedback and make adjustments!
Proposed change
Add SwitchBot Presence Sensor support to the switchbot Bluetooth integration.
The device combines mmWave radar, PIR sensor, and light detection. Already supported by PySwitchbot 0.73.0 (PR #410) and the
switchbot_cloudintegration (#155309), but missing from the Bluetooth integration.Changes: Add device type to supported models list and configure platforms (binary_sensor + sensor). Pattern matches Motion Sensor.
Entities: Motion + Light (binary_sensor), Battery + Light level + Signal strength (sensor)
Screenshots
Type of change
Additional information
Checklist
If the code communicates with devices, web services, or third-party tools:
python3 -m script.hassfest(will run if requested)Testing
Tested on HA 2025.11.1 with real hardware. Device discovered automatically via Bluetooth, all 5 entities created and reporting correctly.
Test added following climate panel pattern (#155124), verifying entity counts and attributes.