Support for SwitchBot Plug Mini (W1901400) with bluetooth proxying

I am running Home Assistant on a Raspberry Pi 4.

It looks like you were right! I loaded up HassOS on a virtual machine, installed the ESPHome add on, created and uploaded the firmware with your config and it seems to be working now.

Hopefully an update will come out that will allow this to work on arm processors.

Thanks for your help.

Has anyone figured out a way to hard reset these after getting Esphome loaded? I must have screwed something up in the yaml causing 2 of my plugs to not connect to my home wifi. I can see it has defaulted to its own AP but connecting to that does not give out an IP. I tried manually setting my device to something in the 192.168.4.x network but I cannot ping 192.168.4.1.

Other than figuring out how to open the plug up I’m guessing its bricked?

The partition table that is generated here switchbota/part.csv at b622e9096dcbfd76caaa33ef2293c4743b4ce57f · kendallgoto/switchbota · GitHub might not be large enough for the Bluetooth proxies so the performance might be slow connecting to devices unless you do a serial flash

Ah darn, is there any way to modify the partition table if we compile the espressif stuff from the switchbota repo?

Or is the part.csv file in that repo mirroring the actual partition scheme that’s already there?

Here is the partition table that esphome uses when you select esp-idf:

https://github.com/esphome/esphome/blob/6b7b0768755b21cca0e4b67515de93b9ca7b3821/esphome/components/esp32/__init__.py#L404

Is it possible to apply that partition table via an OTA flash? Or is it only doable over USB/serial?

Esphome only changes it via serial flash. It may be possible to do it with another tool but that’s probably a bit more risky and you may end up opening it up anyways.

What’s the concern with the partition table? Is there something that isn’t working correctly?

Looking at the two different tables it looks like the OTA partitions in the switchbota table are actually slightly bigger (although it’s been a while since last doing hex conversions so I might have mixed that up).

Anyway, mine seem to be working as bluetooth proxies (I have a lot of bluetooth proxies around the house so haven’t tested them exclusively though).

ESPHOME NVS SIZE = 446464 bytes
nvs, data, nvs, , 0x6d000,

The partition table linked above has an NVS of only 24K

If you only have a few bluetooth devices you will never notice but if you have a lot some of them will be slower as you’ll run out of space to cache the service lists.

I found a nice PR that enables web_server component on the esp-idf frame work so now the web server is running well on these plugs too. Hopefully it’ll get merged into mainline esphome soon, but for now it’s easy to add as an external component. I’ll update the top post but here is what you need to add to your config:

external_components:
  - source: github://pr#3500
    components:
      - web_server
      - web_server_idf
      - web_server_base

web_server:
  port: 80
  auth:
    username: !secret web_user
    password: !secret web_pass

Interesting note on the size of the NVS partition. I’ve got a few plugs I haven’t flashed yet so I may try to see if I can change it during the conversion process.

1 Like