SwitchBot bot/curtain/meter/contact/motion MQTT ESP32 bridge - Local control

hey @chintito4ever . It is possible the esp32 itself is faulty. I have one esp32 that will randomly fail no matter what is installed on it

I use 2 esp32s in a meshed setup with this code and they have been running for months and months now

if you have another esp32 (another brand would be good) I would suggest trying that one

Hey a couple of days ago i set up this MQTT bridge and all was woring fine. But now when i came how i noticed that the esp32 is unavailable and in explorer it lastWill=offline. I can see it is connected to my router and i can see that my switchbot stats. It seems like it goes offline exactly 60 seconds after i rebooted the router and all.

Hello,

This is my first time working with the SwitchBot MQTT ESP32 Bridge.

I have been able to upload the firmware to my ESP32 wroom.

I can see it is connected to WiFi, both in my router and navigating to the IP address.

I cannot connect to MQTT. Nothing shows up in HA or when checking MQTT Explorer.

I am hitting a wall.

I tried adjusting the setting, making sure all entries are one word lower case with no symbols.

I am assuming my MQTT Broker IP is the IP address of my HA.

I kinda need some help please.

Actually,

The ESP32s (I am configuring two) are connecting to my Wi-Fi via the assigned IP addresses, but…

When I view the connectivity in my router, both of them appear and disappear every few seconds.

The interface they are connecting through also fluctuates between 2.4G and Ethernet (it’s impossible for them to connect via Ethernet).

I have set my router’s wireless settings to force them to connect via 2.4G, but that is not helping.

I can access the board in my browser using their IP address though.

Hold up…

I figured it out I think.

I needed to create a username and password.

I need one ESP32 per room, 4 total, not meshed.

Are there and conflicts I need to be aware of?

Is these hardware good to run the switchbot devices?

Board:

https://www.amazon.nl/iHaospace-ESP32-DevKitC-ESP32-WROOM-32U-Ontwikkelingsboard-Development/dp/B08BZKZXLL/ref=sr_1_5?adgrpid=143237756317&hvadid=633573760241&hvdev=c&hvlocphy=1010752&hvnetw=g&hvqmt=e&hvrand=10864381411042801128&hvtargid=kwd-496386101209&hydadcr=16597_2174990&keywords=esp32-wroom-32u&qid=1688556399&sr=8-5&th=1

Antenna:

https://www.amazon.nl/dp/B08FX3QXRQ/ref=sspa_dk_detail_4?psc=1&pf_rd_p=c7754686-6a8e-4389-b12f-5078a0c620b3&pf_rd_r=K6VME2K287HGV1GPYH5R&pd_rd_wg=0gHn0&pd_rd_w=331vX&content-id=amzn1.sym.c7754686-6a8e-4389-b12f-5078a0c620b3&pd_rd_r=c792550a-8fb9-4c22-b217-ad9809ab9a77&s=electronics&sp_csd=d2lkZ2V0TmFtZT1zcF9kZXRhaWw

Or are there any better baords? Money is not the problem.

Hopefully this hasn’t already been answered, I scrolled for a while… has the new HA BLE integration become a new way to connect SwitchBot devices? Or maybe it’s on the horizon having this code get ported into using that one?

Thanks in advance, seems like yours has been a great solution for a long time.

The native Home Assistant integration manage all devices supported by this project and more because for example the Switch Bot smart lock is managed by the native Home Assistant, also the new indoor/outdoor meter.
Humidifier is also compatible with the native HA integration.

IIRC the advantage from the HA integration is it send commands again in case of failure I.E. for bots or curtains when the native Home Assistant integration only provide an entity attribute to see if command was successful or not so additional attempts have to be done from an automation for example.

But in my case I only use meters with the native HA integration so I only gave you information I have for other devices.

1 Like

I have been using this integration for a couple of years now, very happy… my use case is to replicate bt signal far away from ha installation… on another floor…

Does the native HA integration allow to control a BT (switchbot) far away where the server built jn BT cannot reach?

Not sure if my question is silly :stuck_out_tongue_winking_eye:

Thank you

I am using SwitchBot in “push” mode (one push, appliance turn on, another push, appliance turn off)…

I now need to “simulate the on and off” status… from the github documentation it seems possible, but how do I actually do it in the code?

Anybody can help, please

Thank you

Advantage of this integration is to be able to retry better when command fails, if I remember correctly the HA integration is less performant in this case.

For the case where bot is fare from HA server if I understand correctly your question now things should be near the same because now it is possible to make a bluetooth proxy with and ESP32 and HA use it as it would use a Bluetooth dongle.
It is not mesh as it is for this integration but result are near the same, better signal is used to communicate with BT devices.

I hop I understood correctly what you asked :slight_smile:

Thank you @Nardol

this is what I was wondering… last one: how do set the ESP32 proxy as proxy? where can I find the instructions?

lastly, I am using the SwitchBot as “push” button (one push, the appliance is on, another push the appliance is off), is there any way to assign to is the “on/off” status? I would need it for an automation…

Thank you

No one can help to find a good board?

Hi @devWaves , thank you for all the hard work on this. I saw someone ask earlier about adding blind tilt support. Do you know if you will be adding that in the future? I tried to see if I could get it to work as a curtain but no luck.

Thanks again!

No one can help to find a good board?

I’m using those as well. Do you have any issues that might be related to the ESP32 WROOM? I feel like it does weird things with signal strength sensing. The fluctuations are huge even when devices are less than 1m away.

You could try this board
@devWaves sent me this link if I remember correctly.

After the WiFi-router loses power and regains power, the ESP32s running this software won’t come back up again, which I consider undesirable. From the code, I didn’t see a reconnect call anywhere, but perhaps I didn’t look good enough (looked at the code on my phone). I’d want the system to use DHCP to obtain a new IP after an outage from the wireless router.

I have a couple of these in the house and i just set dhcp reservations for each in the router/dhcp server and set the ‘static’ reserved IP in the code. hasn’t been an issue with restarting my APs after a firmware upgrade.

Now however, i do get random ‘freezes’, where the esp just becomes unresponsive. I solved this by powering the module off of a cheap zigbee switch and have an automation that if the curtain modules in home assistant (that i know are tied to a specific ESP) become unavailable for more than 5 mins, just power off the switch, wait 5 seconds and then power back up. problem solved. plus i have some ‘range extenders’ that are now always powered (the switches) now to help with the meshing and communication of some of the battery powered sensors i have in the house

Yes, I also considered adding Zigbee switches, but I don’t like workarounds (it also looks awful and eats extra power).

@devWaves Apparently, I am not the only one that has random freezes. Can you provide a technical explanation for that? I’d expect that the WiFi component you are using is not robust (or perhaps everyone is just using it in adversarial environments with many other competing WiFi-devices), because it seems unlikely that there is a huge design flaw in all ESP32 devices (we probably would have heard about that by now).