This is awesome Mat - I was thinking yesterday (when I was watching your earlier switchbot videos), "it's a shame it can't be controlled with NodeRed". The only annoyance is it's not done locally via the hub, whereas the python/bluetooth api looks like it is local.
@notenoughtech3 жыл бұрын
Bluetooth is available on the pi... So 2 in1 😁😁😁
@jvrietveld3 жыл бұрын
So with this SwitchBotApi update for the Curtain Bot I can start and stop them via Node-Red. Nice! Great video Mat
@notenoughtech3 жыл бұрын
Yes you can set position too. So you can act upon this too. I'll have w short demo soon as I have a very specific need.
@sharktamer3 жыл бұрын
Wow, this is really great news. I was literally hours away from returning my switchbot hub mini, it's packaged up, ready to go and everything. I might need to keep it around for now since this has come out.
@notenoughtech3 жыл бұрын
Oh hub is pretty cool as you can trigger IR commands I use it to turn my sound system automatically
@automation44463 жыл бұрын
Great video!. Finally, with yout help I was able to put my switch-bot meter in the Node-RED loop with Alexa. Thanks a lot!
@notenoughtech3 жыл бұрын
Happy to help!
@rwkling1 Жыл бұрын
Thanks so much for the info! This is great - I downloaded your code and am attempting to use it but ran into an issue. I've stored my SwitchBot API token as a global, but I'm not getting the device list returned. I'm running into the error: "TypeError: Cannot read properties of undefined (reading 'deviceList')". Any insight?
@reesejenner35943 жыл бұрын
@NotEnoughTECH I'm not able to find out how to set a global variable, I've check links you've given before. I've tried hard coding my key and get errors: Cannot read property 'deviceList' of undefined
@notenoughtech3 жыл бұрын
When setting the values you need to check on start tab and then deploy it.
@mattbradbury19923 жыл бұрын
Would love to get this working, but find the instructions too vague and too hard to follow. Despite reading your website on this, still am not able to set it up :(
@notenoughtech3 жыл бұрын
What seems to be the problem? You need to be specific. Everything posted is pretty much plug and play. You need to submit token and device name as in SwitchBot account.
@mattbradbury19923 жыл бұрын
@@notenoughtech - Sorry for the late reply. I was struggling with setting the global variable - may I suggest you link to that video? I looked, but couldn't find it.
@notenoughtech3 жыл бұрын
@@mattbradbury1992 this will help notenoughtech.com/home-automation/why-nodered-server/
@mattbradbury19923 жыл бұрын
@@notenoughtech Thankyou :) I managed to get it working in the end.
@MrFadihamdan3 жыл бұрын
I’m confused! How did you import SwitchBot API flow? I think you are missing the initial part at least for me as beginner :) Can you please explain that?
@notenoughtech3 жыл бұрын
In the description of the video there is a link to he article. It has the project files to download at the bottom. Then use the import menu in nodered
@MrFadihamdan3 жыл бұрын
@@notenoughtech Where to paste my token? Is it on the format URL node? and how did you save all devices? I didn’t get it? I’m trying here to implement it in Home Assistant.
@notenoughtech3 жыл бұрын
@@MrFadihamdan I use nodered for this so I cant help much for HA setup. You should set the API key as global variable. Details are in the article with the link to saving variables too
@reesejenner35943 жыл бұрын
@@notenoughtech no clue how to set variable. I did manually, but devices don't populate/create a flow. HA has node red integration.
@notenoughtech3 жыл бұрын
@@reesejenner3594 in On Start/Setup tab add global.set("SwitchBotAPI", "token"); where token is your API key
@MEYER2511893 жыл бұрын
thanks Mat, you know why my switchbot bot is not been discoverd by the api ? in the doc they said that i have to enable the cloud service but i don't have this option
@notenoughtech3 жыл бұрын
do you have a switchbot hub?
@MEYER2511893 жыл бұрын
@@notenoughtech No i saw that the hub is required, there is another possibility to set a timer with secund ?
@notenoughtech3 жыл бұрын
@@MEYER251189 you will need the hub for some options but I think timers are stored locally once set in the app
@ronm65853 жыл бұрын
Cool stuff Mat. Thanks.
@notownblues3603 жыл бұрын
Would using the API be faster to switch the SwitchBot on? I've got it currently setup in HA / Node Red using the HA integration via Bluetooth but I've noticed it can be slow to turn on/off. Sometimes up to 4-5 seconds which is annoying.
@notenoughtech3 жыл бұрын
How quick your switchbot devices respond to app? It was less than a second for me. You should see a similar performance using API
@notownblues3603 жыл бұрын
@@notenoughtech Great thanks, I'll have a look into it. But I need the hub right? It takes 2-3 seconds at best, 4-5 seconds at worse. Pi is about 10m away from the SwitchBot using Bluetooth.
@notownblues3603 жыл бұрын
(I also have to precise that I'm using a hue sensor with the SwitchBot using Deconz. When I look at the live flow being triggered it's the SwitchBot that can take a couple of secs to turn on with the basic HA integration, hue sensor is pretty much triggered instantly since using Deconz)
@notenoughtech3 жыл бұрын
You will need the hub to do this via API. I'm not sure what could cause such long delay in the direct mode if I'm honest
@notownblues3603 жыл бұрын
@@notenoughtech Thanks, ordered one yesterday. Not sure either, apparently the Pi Bluetooth range is quite weak. On my phone it's instant via the app so I'm assuming it's the quality of the Bluetooth chipset on the Pi that's not great or the range. Hopefully the API will sort the slight delay.
@SkiingInstructorWithAPasssion3 жыл бұрын
Whats the box around your nodes in nodered?
@notenoughtech3 жыл бұрын
Groups in 1.1 version
@ortigonover2 жыл бұрын
Thanks for Sharing. Following your guide I get the this error: "payload: object message: "Unauthorized" I'm passing the variable with the inject node as follows: " msg.payload = global.set("SwitchBotAPI", "27e0af7eaf635d645351XXXXXXXXXXXXXXXXXXXXX"); It's that correct? Alternatively, I installed "npm install node-red-contrib-switchbot-api" . In the configuration of the node "send command", after entering the TOKEN API code, select type = SwitchBot device. When I do click in the "Refresh" button, it can't find anything to add as "device name". Is the API still working? Is there a way to check it? Thanks
@notenoughtech2 жыл бұрын
I will assume the API is enabled in the app and your key is correct? The error specifically refers to issues authenticating your request. Any typos or spaces anywhere where they shouldn't be?
@ortigonover2 жыл бұрын
@@notenoughtech I think I'm injecting the variable with the token wrong. Can you confirm that it is simply a matter of passing it with the "inject" node, I think that is the point that I don't quite understand. I'm sorry for that. Inject Node: global.set("SwitchBotAPI", "27XXXXXXXXXXXXX"); Thanks
@notenoughtech2 жыл бұрын
There are a couple ways to achieve that, but you can confirm that your global is set by going to context tab on the right and checking if globals switchbotapi is set and has the correct key
@ortigonover2 жыл бұрын
@@notenoughtech Thanks for your help. The token seems right because if I type directly in the function node it works. But I would like to do it in your way. Maybe those 3 screenshots helps me better to explain how I have it: snipboard.io/CIrqKu.jpg snipboard.io/FZNPcs.jpg snipboard.io/IgwRud.jpg Thanks in advance!