as a workaround - i might try and make my HA shell_commands read the successful "OK!"and try again on failure or at least show an error to the user.
I have updated the script.js to have a ok/error check via mqtt. Every time you call the bot, it will either have ok or error message output to mqtt.
From there you can create a sensor and use it to re run the bot if it outputs error. You will need to think how you can implement this check for all your bots. I was testing it on the bot device using script. Seems to work. The below script template will run 10 times or until until sensor.switchbot_status state is ok.
Guys, I’m planning to buy Switchbot Curtain but I have some doubts.
I have NAS with Docker HA installed 2nd floor and curtains which I wish to control on 1st floor. Im pretty sure of that Bluetooth range will not cover that place.
Is it possible to extend a range of bluetooth or mage Rpi Zero as some kind of extender or bridge?
Upper you wrote about switchbots.js as I understand I have to install it on Rpi0? This connect via MQTT with my Mosquito Broker on NAS?
So the communication looks like: SwitchBot -- (BT) --> Raspberry Pi -- (MQTT - WiFi) --> NAS with MQTT
Hi.
That looks right. Though mqtt is optional if you don’t care about knowing the data of the bot. My pi 3 is connected via wire, but I am sure wifi will work as well. Just make sure the pi zero has good wifi coverage.
You have the pi zero W? Let us know how it goes if you are going to go forward with it. I am thinking about switching over to a rpi zero w myself.
Is it possible to extend a range of bluetooth or mage Rpi Zero as some kind of extender or bridge?
I am not sure if that is possible or if it is, it maybe not worth the trouble not knowing how far it can be extended.
Is anyone integrate Switchbot Curtain via BT-MQTT-GATEWAY (https://github.com/zewelor/bt-mqtt-gateway)?
Yesterday with success I installed this on my old RPi0 and connected to Xiaomi Thermostat.
In documentation it support Switchbot but I didn’t found information if it support Curtain.
My set up is HA installed via docker on a NAS in the basement and the curtains are in the bedroom two floors up. I do have the Hub in the bedroom.
I recently purchased the switchbot curtain and it works very well. I’m also starting out with HA for the 4th time. I integrated the curtain via mac and it does show up in HA. However, none of the buttons do anything. I’m assuming that is because it’s trying to communicate via BT and it can’t reach it.
I’ve read through this entire thread and I’m not more confused than I started. I’ve tried using the mac of the curtain, hub and BLE but only the mac for the curtains show up as pressable buttons (which again don’t do anythign when clicked).
Is there a way to integrate the HUB to control the curtains in HA?
The curtain integration provided by the user above works by communicating with HA via BT and not the Switchbot Hub. Since your HA is install 3 floors down, it is out of range. Does your NAS have BT?
As far as I know, there is no HA Integration to talk to the hub. However, there is a switchbot api method you can try which needs the hub to communicate. Request a token via the mobile app feedback. I don’t have a hub to test. But an example of a way to trigger via HA is by curl.
The downfall to the api method is that, if you lose internet connection, you will not be able to trigger your devices. An alternative is to move your HA closer to the curtain device or install another server (ex. rpi) and try my method.
There is another method I have found recently that uses ESP32 to connect to the device. It is setup for 2 bot devices and the author claims it should work for the curtain devices as well, but not tested.
ya it should work with curtains, but I would have to make a couple code changes. It currently only does push. Shouldn’t be difficult to make the changes for open/close calls. I can look at that this weekend if someone wants to test
thanks for this. Reading your guide, i’m not sure if this will work in my situation as all i have is the switchbot hub. I’m also still having issues getting Mosquitto MQTT to work properly on my Qnap Nas. I took a look at the switchbot api solution as well and that was a bit over my head.
I do however have an old smartthings hub laying around somewhere thats not being used. not sure if that would help.
I was hoping there was a solution for HA (in docker on a QNAP NAS) > Switchbot Hub > Switchbot Curatin.
there are a couple solutions. you just need to decide which one suite your needs. using the switchbot hub is a solution but will always require internet access as mentioned
If you want full local control you need to do it with bluetooth BLE. You can either have your smarthub make the bluetooth calls or have your smarthub call something else, and that something else makes the bluetooth calls.
for me, my main switchbot is too far from my smarthub to be reliable. This is why I wrote the esp32 option. an esp32 cost $5.
my esp32 option avoids the hassle of ensuring the linux box bluetooth is configured correctly. you don’t use the bluetooth on the linux box.
Thank you for your code. I tested it and it is working impressively good.
I noticed a bug with the position of the curtains, which is reported after using requestInfo.
Independently from the state of the curtain it always reports the same position.
cool thanks. to get the latest value I needed to do a rescan of that specific bluetooth device
when you call requestInfo, it deletes the current device and rescans for it. it will scan max 60 sec, but should only take a sec depending on distance from bot
so you should be able to spam control calls as much as u want. When calling requestInfo tho, depending on how close the devices are, you wont want to spam those calls to often
Thank you, I noticed that after some hours (with one requestInfo per hour) the device doesn’t respond any more and needs a power cycle. I should probably avoid sending requestInfo commands.