devWaves / SwitchBot-MQTT-BLE-ESP32

Allows for multiple SwitchBot bots and curtains to be controlled via MQTT sent to ESP32. ESP32 will send BLE commands to switchbots and return MQTT responses to the broker. Also supports Temperature, Motion, Contact sensors
MIT License
539 stars 66 forks source link

Alexa support? #37

Closed fabiosoft closed 2 years ago

fabiosoft commented 2 years ago

Do you plan to add Alexa/Google home support?

Maybe with FauxmoESP is easy, even for multiple switchbots

devWaves commented 2 years ago

I wasn't planning of having it as part of the main branch since the main intention of this project is to use MQTT with a smarthub and you can just connect Alexa/GoogleHome to your smarthub to control the devices that way

...but I added a separate branch for Alexa if you want to test it out. I just quickly wrote this and would need someone to test since I don't own alexa/echos. I have google homes which don't have a similar integration

https://github.com/devWaves/SwitchBot-MQTT-BLE-ESP32/blob/alexaBranch/Arduino%20IDE%20Files/SwitchBot-BLE2MQTT-ESP32.ino

You will need to add the FauxmoESP library and also manually add the AsyncTCP library using the zip https://github.com/me-no-dev/AsyncTCP/archive/master.zip

The code currently still requires that you have MQTT setup and working, but you should be able to make the calls directly from Alexa for bots and curtain (ON,OFF). Position isn't setup to work through alexa yet

The standard code heavily expects MQTT to be connected, so I would need to remove those checks in order to not use MQTT

Again, I coded this with zero Alexa testing since I don't own one, so good luck

fabiosoft commented 2 years ago

Hi, at home i own an Alexa Echo dot so i will test soon...according docs should be easy to implement percent position. Maybe i will try to issue some voice commands to alexa and try to write some code.

I'll let you know :)

devWaves commented 2 years ago

I can do the percentage part so u dont need to worry about that, the code now is just a preliminary test to see that it works for on/off. I might switch to espalexa... not sure yet

If it works I"ll make changes so you can disable the need for mqtt

fabiosoft commented 2 years ago

okok, anyway i'll use both alexa (voice) and mqtt with my hub. If you need some logs and prints about input parameters provided by alexa...let me know.

Did you find some improvements to use espalexa over Fauxmoesp? Maybe light bulb colors?

devWaves commented 2 years ago

Without an alexa/echo to test with it is difficult to tell if one is better than the other (fauxmoesp or espalexa). I know aircoookies WLED work and espalexa is slightly easier to install (no zip to download). espalexa didnt look like it was setup for dynamic device names though

fabiosoft commented 2 years ago

According to my experiments they are pretty mush the same, maybe the espalexa is more oriented to colors and brightness...as well as percentage but fauxmoesp also support boolean state and percent but colors are in a separate branch. The developer says he is not very happy with implementation.

Anyways both solutions seem to work good

devWaves commented 2 years ago

@fabiosoft have u have the chance to test? if it works I'll look at removing the mqtt requirement

devWaves commented 2 years ago

Closing this for now. Can be reopened later if needed