sup guys
love this community, and this discussion is just another good example of it
need some assistance. for some reason my “open” and “close” buttons are not working properly if the blinds are completely “close” or “open”.
let me elaborate.
buttons, sensor, and even the slider to control the switchbot - works great. however, if the blinds are 100% “open”, for some reason the “open” button on the dashboard is the only one that stays “pressable” (yet pressing it does nothing) while the “close” button is grayed out, and cant be pressed.
the “stop” button is useable as “close” button.
for now, i “reversed” the actions of the buttons - (close button actually open the blinds, and vice versa) but that cant be the “right” way to go…
i’d love some help, if anyone have any experience with this, or knows whats need to be done to fix it…
cheers
The API and HA are reversed how they see 100 and 0. There is a post in this topic how to adapt your code for this. I’m not behind a computer else I would look it up. Scroll through the topic and you will find it.
thanks for the pointer, i did try it, but it didnt work for me. not sure what i did wrong. so for now, im back to my “reverse definitions”, as the “open” button closes the blinds and vice versa. not ideal, but its fine. ill add a costume card with some buttons for better UI experience, and for the automations it doesn’t really matter anyway.
With the new HA release and renewed Bluetooth support I can now find my curtainbots without having to the use the API route. With me they don’t respond yet (but show status correctly), probably due to the distance. It may be worth investigating for you as if the distance isn’t to big. Will prevent a lot of tinkering with the API.
When you say they don’t respond yet, are you seeing errors? I can add them but cannot control them even if the Pi is very close to them. I opened a ticket but not sure if this is an isolated issue to my Pi.
“curl: (35) schannel: next InitializeSecurityContext failed: Unknown error (0x80092012) - La fonction de révocation n’a pas pu vérifier la révocation du certificat.”
Can anyone tell me what i’m doing wrong ?
thanks
EDIT:
Finally found out after hours of searching and trying (and failing).
Just needed to add “–ssl-no-revoke” at the end of the powershell command.
So it must look like this: curl.exe -H "Authorization: YOUR_API" https://api.switch-bot.com/v1.0/devices/ --ssl-no-revoke
Just want to add my2cent, maybe helpful for others.
I use a switchbot hub mini sto remote control my air condition. As there is no integration that uses the api to control the hub, I found a workaround, that works good for me.
I set up different scenes in the hub mini for the air condition, then I set up webhook actions in IFTTT to start these scenarios.
With the IFTTT integration in HA it’s pretty easy to initiate these Szenarios now from inside HA.
I defined an input_select with all Szenarios as well as an automation which sends IFTTT triggers, based on the input_select.
I now can even select the input_select from within HomeKit incl. Siri and control my air condition.
Perfect for me.
I found the answer by myself… The lock/unlock function have been remove from the API by switchbot for “security reason”. On github they mentionned they work on a new version to reopen the function…
I can confirm! the lock is back in their v1.1 API just released today (2022-09-16)
The main change is how you authenticate… you must use a token and a secret now. There’s an example in the API documentation… which is wrong btw, there’s just one thing misssing in the documentation… the nonce header.
After adding that, the lock is working now
Just one question… since we have to generate a sign string for every request (it is valid for only 5min or so), how can we add this logic into HA? In python some additional libraries are required right? so, I wonder how can we achieve the same with the jinja templates, or we should move to an actual python script for that… do you know if there’s any integration for switchbot stuff in the HACS? if not, is there a “template” or “example” to start withCreating your first integration | Home Assistant Developer Docs? I will play with it over this weekend - my focus will be this lock.
I was looking at V1.1 as well after troubleshooting why my lock wasn’t working, when it was polling status just fine(so thanks for pointing this out). How did you end up doing the cryptography for the sign string. I know sign for the header has to be set with hmac (sha256) according to the API forums. I tried in Node Red, but with no ability to import crypto() methods.
Does anyone know how to access the SwitchBot Motion Sensor status from within the Contact sensor? i.e. not a dedicated motion sensor but the contact sensor has a built-in motion sensor that triggers to the APP and sends notifications, but I can’t find anything within the API about the actual motion sensor element in order to use it.
I am totally new to home assistant and really not a coder either. I would like to add my lock to my home assistant but where do you add this file? I cannot figure out how to get this file where it need to be or what the name should be.
I have enabled a custom component for tplink and edited that so i am familiar with the process. Please, any help would be much appreciated.
I successfully added a bot to my setup, I’m able to see the switch in the dashboard (and it works), but I’m not able to use the device in Automation & Scences. After some digging, it does not register the switch as a device, did I miss something there?
I am using the v1.0 API interface for my switchbot curtains. Ever since I updated my firmware on the Switchbot Mini Hub and the Switchbot curtains to v6, the API does not return the correct position of the curtains. It appears to be fixed values that it was last updated.
Does anyone have the same experience or is there a fix to this?
I looked that the v1.1 API interface, but as pointed out above, this new authorization method is time limited - so I guess the current methods used here can no longer be used.
I am also crossing my fingers for an API-based integration. I could adventure into the manual code but I have been working 7 days a week and spend most of my free time sleeping where I can. So not a lot of trouble-shooting time as of late thus an easier solution would be great so that I can start controlling my SB locks.