SwitchBot-MQTT-BLE-ESP32 icon indicating copy to clipboard operation
SwitchBot-MQTT-BLE-ESP32 copied to clipboard

Add functionality to push all switchbots with ESP32 BOOT button

Open TheHolyRoger opened this issue 2 years ago • 3 comments

I have to admit I'm not hugely familiar with cpp yet but here is a PR that's working for me to use the ESP32 BOOT button to toggle all switchbots :)

Useful for me so thought I'd share

TheHolyRoger avatar May 10 '22 21:05 TheHolyRoger

lol. I barely know c++. It is not one of the languages I work with daily. But knew just enough to get this project going

that's a neat idea and I could probably add something like that, but I would probably make a few code changes. Good work though

things I would change:

  1. create another list for bots to control with the esp32 button (instead of all bots)
  2. add the command to control the bot to the queue of commands instead of sending the command directly. This will ensure the retry logic works etc and doesn't interfere with MQTT commands coming in. Like this...
struct QueueCommand queueCommand;
queueCommand.payload = "OFF";
queueCommand.topic = ESPMQTTTopic + "/control";
queueCommand.device = aDevice;
queueCommand.disconnectAfter = true;
queueCommand.priority = false;
queueCommand.currentTry = 1;
commandQueue.enqueue(queueCommand);

instead of .. controlMQTT(aDevice, "OFF", true);

  1. This could also technically apply to curtains

I am working on getting the v7.0 release, which is here https://github.com/devWaves/SwitchBot-MQTT-BLE-ESP32/tree/v7alpha The only remaining issue in v7.0 is related to mesh stuff I added, but it includes a bunch of other changes. So I will be releasing it soon either way

Once I get v7.0 out, I will try to take a look a this

thanks for sharing

devWaves avatar May 11 '22 02:05 devWaves

@devWaves thanks man! I might come back to this when you release v7 if you haven't done your own implementation :D

Thanks to you I just successfully ripped this code apart and created a working ESP32 keypad to arm/disarm my HASS alarm :) thank you!!!

TheHolyRoger avatar May 14 '22 10:05 TheHolyRoger

@devWaves updated it :)

TheHolyRoger avatar Sep 12 '22 23:09 TheHolyRoger