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

Nice, update was done without OTA now, but I might try this next time.

All devices work.

One of the devices shows a link quality of -95 for a sensor. Any idea what might cause that?

Also, is it possible to list the same device in multiple esp32s instances in order to increase the probability of a signal such that the mqtt data is merged?

is the esp32 close enough to the device with -95? you might need another esp32 or move the current one more to the middle of all of the switchbot devices

Yes v7 is all about meshing 2 or morr ESP32s together for better motion, contact and/or meter performance. I am almost done, but you can try out the v7alpha branch in github which works, just still working on adding some improvements

Meshing only works for motion, contact or meter. You would chose one primary esp32 as the main host, and then use that host value as the meshHost value on the secondary esp32s.

meshing does not work for bot or curtains. For those devices you would only put the MAC address on the esp32 closest to the device

Just wanted to say thanks for this. I was struggling with using the original Switchbot hub to control the switchbot. But the hub is complete garbage.

After installing and using your software, my switchbot integration is rock solid! It works every time as it should.
Thanks!

1 Like

It took a while to get back to you, but I have the weirdest issue:

As you can see the signal drops completely. Itā€™s as if someone is turning on a signal jammer.

There is no physical access to people in the area where the ESP32 is located. There is physical access in the area where the Switchbot Meter is placed.

what version of esp32 code are u running? do u need to unplug it to get it going again or does it come back on its own? do u only have meter(s) setup with esp32?

are all your libraries up to date? there were some issues with libraries recently but should all be fixed now

I run whatever was latest master two days ago (so, not the version 7 alpha). It comes back on its own. I only have Swithbot Meters.

Libraries were up to date (until two days ago).

hmm. Dont think its an esp32 or code issue, but being -95 rssi isnt a great sign.

I had a meter go weird one time but taking the batteries out and putting them back in fixed it and hasnt happened since

an esp32 with external antenna might get u some extra rssi signal strength, but if it is only one meter with bad signal compared to the others you might have a dud meter? not sure

you could also use 2 esp32s and place the new one as close to that meter as possible

-95 is a bad signal so it looks like its right on the edge of the connection range

maybe take that meter and swap it with another in that location and see if it causes the same issue. If it does then you know its a range issue

Sensors from other suppliers without reception return a NaN of some kind instead of continuing to report the last value. I think that would be the better default.to have, because right now the sensor is reporting data that is false.

hey @lepton so this isnt really an issue if the device is always in range I would look at figuring out what is messing up the connection. Mine work great

the esp32 will not send MQTT messages for the meter if it cant find it, so the last messages you see was the last time it was found

all the devices will report as unavailable/offline when the esp32 loses mqtt connection. MQTT only allows for one lastwill offline message per client

when it comes to binary sensors etc you can only send 2 messages on/off, open/closed etc, so u cant really send a N/A there

for the meters though, u can easily achieve what you want with an automation in HA. If no messages have been published to the MQTT topics in X mins, then send N/A to the topics u want

You can also change the lastwill message used in the esp32 code and instead manage the ā€œofflineā€ messages from HA automation. Send ā€œofflineā€ from HA when MQTT topics havent been updated in awhile

Hi!

There is any way to turn off the power led of my esp32 board? It is very powerful and annoying. There is no setting into the interface UIā€¦ I can only do firmware update.

Thank you in advace!

Hey. On some esp32 there are 2 LEDs. The power LED and the LED linked to a GPIO pin

the power LED cannot be turned off for most esp32. The only way to turn it off is to physically remove the led

the gpio LED can be enable/disabled with these settings

static const bool ledOnBootScan = true;              // Turn on LED during initial boot scan
static const bool ledOnScan = true;                  // Turn on LED while scanning (non-boot)
static const bool ledOnCommand = true;               // Turn on LED while MQTT command is processing. If scanning, LED will blink after scan completes. You may not notice it, there is no delay after scan

This esp32 which I use, can be turned off. I used Espresense in the past with this and that platform have an option in order to turn off the led. This is why I asked. If there is any way to turn off the power led with a code or something :smiley: Iā€™m very new to these thingsā€¦

Or go for the pragmatic approach and tape off the bright LED with black electrical tape.
I did the same with the green LED on my ZigStar coordinator as it was way too brightā€¦

there are a ton of different esp32s. The 3 different kind I have you cant turn off the power LED

send me the exact esp32 model you have, or figure out which GPIO pin it is connected to. It is probably a one or two line code change

or as @anon94216691 said, just tape it. I suggest not wrapping completely though as that could overheat it

This is what I use. I found the same information till now, that this is a hardware led and cannot be turned off, but the ESPresense software, make it happen :slight_smile: Maybe iā€™m wrongā€¦ I hope not :slight_smile:

ya that one has 2 LEDs also. if u can confirm another esp firmware is able to disable it then let me know and I will take a closer look, but from my knowledge you canā€™t disable the power led (most likely orange/red)

I did accidentally short an esp32 once and it killed the LED and it still worked, but most likely killed a resistor etc also. I would suggest not going that route lol

Hello. This is going to be my first ESP32 project. I want to use an esp32 in a case and an external antenna to get the most reception. I was hoping somebody could confirm these would work for this project: https://www.amazon.com/D-FLIFE-ESP32-DevKitC-Development-ESP32-WROOM-32U-Bluetooth/dp/B089F6LRBS/ and https://www.amazon.com/Antenna-Pigtail-Wireless-Routers-Repeater/dp/B07R21LN5P
Thanks!

yes those will work

Iā€™m trying to use this with the Switchbot Curtain Rod 2.

Everything is detected and shown in home assistant, then after I send the first command e.g. close the curtains - the curtains close - but then the esp32 and the curtains become ā€œunavailableā€ and I canā€™t control them anymore. On the device both the red and blue LEDs are permanently on.


If I power cycle the esp32 - it will become available again, and then after the first command is sent, unavailable.

Iā€™m new to home assistant, is there any logs I can look at to see what is happening.