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

Sorry for bothering again, now in MQTT explorer it scans for two min and status changes back to idle and no other topic is listed, not sure what i am i missing.

Maybe start a fresh install to esp32. Be careful changing config entries then upload bin file.
Try one bot only, then two…

If your getting know where, send file to devWaves, sure he will help diagnose.

I am new to Arduino, i have been uploading the sketch files every time, how do i get the bin files from sketch? or is the bin and sketch are same, sorry for my ignorance (sorry found the way to do it)

Don’t worry, I’m learning and only recently got my head head round it all. :slightly_smiling_face:

export from sketch in arduino tab - final bin file normally found under documents/arduino, in Windows that is.

code uploaded from Sketch is the same as a bin file, you may find taking the esp32 away from your pc then uploading fresh code via a bin file may fix your problems?!

Thanks, i have not setup anything in HA, i am hoping once it finds in scan it should start publishing the topics and it should show in MQTT explorer. In my case it is not. I will ask @devWaves for help

Sorry, I have never tried Mqtt explorer. Just had a look at what it is… may have a play with that. :grimacing:

Guys sorry found the issue , super stupid mistake, it was wrong mac id O vs 0 .sorry for all the trouble.

:joy: It happens, well done for finding. Hope all is good now.

lol nice. I’ll remember that one

when you change the mqtt topic they are now considered new devices in HA. you would need to delete the old devices in HA, then reboot the esp32 to get the latest HA discovery messages. The devices would then create with the latest topic name

Oh ok, understood.

Cheers devWaves! :+1:

1 Like

Works great!!! thanks for all ur efforts @devWaves

1 Like

Nevermind, I flashed a different ESP32 and it works now! Thanks a lot for helping!

1 Like

I’ve released a couple new features in a v3.0

  1. get responses from bot/curtain (success, failed, busy)
  2. automatically retry on “busy” response bot/curtain
  3. put a delay between commands to the same device
  4. get settings from bots (firmware, hold seconds, numbers of timers, inverted)
  5. Automatically get hold time from bots and add that to delay between commands
  6. get/set hold second on bots
  7. get/set mode on bots

I haven’t tested v3.0 with curtains, so if someone can let me know that would be cool

I am assuming the success, busy, failed responses from the curtains are the same values as the bots

getting settings is different then getting attribute values. getting settings requires writing a value to the bot/curtain and listening for the response. Similar to a set/control command

setting the hold seconds on bots is useful for people that need to use the same bot for different hold times.
Example: turning something on requires holding for 10 seconds, turning that same thing off requires holding for 0 seconds.

In v3.0 you can now look for the "status"="success" message if you have getBotResponse = true

the bots will now respond when it successfully completed the action

Hey there, I tried version 3.0.

I have a small issue… for some reason I do received the CommandSent and Success… but sometimes it stays in the CommandSent status even if I can see that it successfully performed the action. Not everytime, sometimes it changes to Success.

And I am waiting a good 30 seconds before sending command… Could this be due to the fact that my signal is -90? Like it’s not receiving the response from the BOT? Or this is signal proof and will retry to read the success value after a couple of seconds?

Also what is the value “5” after the Sucess Status ?

Thanks!

ya -90 is probably the cause. -100 means no signal.

to get the “success”, “failed”, or “busy” the new changes I added were to subscribe to switchbot ble responses. The value 5 is associated to a successful press action, value 1 is a successful on/off. 3 = busy, 9 = wrong password. I am only returning that value for diagnosis issues because I made the same changes for curtain and I am just assuming the response values are same as bots

the esp32 won’t retry on no response. responses are sent immediately

I set responses required, so if your not getting it… makes sense with bad signal

Hey devWaves,
I’m trying v3.0 with my curtain bots, it could be just me but only one bot out of two is being picked up by mqtt discovery.
Checking for typos and all appears good my side after copy/paste. :slight_smile:
Also tried removing devices in HA, reboot of HA and esp32.
Any ideas?

Its ok, think I’ve fixed it.
Adding values for the curtain bots for this string didn’t like things. [5] was set.

static std::map<std::string, int> botWaitBetweenControlTimes = {

Left values to default and seem fine now. Might be something you may need to look at?!?

do u have curtains? sorry can’t remember. I am not seeing where the issue could be. I just tried with the values inside botWaitBetweenControlTimes commented and uncommented… worked for me. I only have 2 bots though

also that variable shouldnt affect mqtt discovery