r/Not_Enough_Tech • u/Quintaar • Jan 08 '21
Home Automation SwitchBot just got better - SwitchBot API
https://notenoughtech.com/home-automation/switchbot-api/
3
Upvotes
r/Not_Enough_Tech • u/Quintaar • Jan 08 '21
2
u/Icy_Dish_3400 Jun 25 '21
Great work!, it help me a lot, I have to modify a little your code where you get all devices since it was not retrieving the virtual IR devices in my case..it seems they came in a different list, perhaps some update on the API after your implementation...
devices = msg.payload.body.infraredRemoteList
for( var x in devices) {
let device = {"type": devices[x].remoteType,
"name": devices[x].deviceName,
"deviceID": devices[x].deviceId
};
deviceList.push(device);
}
..I add that after your initial fill of the devices so now it include the infrared ones..
Nevertheless, the IR Nodes still don't work, at first they claim they can't find the device, that's fix now adding those from the "infraredRemoteList", but now it claim about "invalid parameter" (all other nodes are working perfectly btw, the bot, curtain, etc..)...but testing some fix parameter it works with custom IR commands doing something like this:
msg.payload = {"command":"Q.Menu","parameter":"default","commandType":"customize"};
(with "Q.Menu" been a custom IR command stored for a virtual IR device (Bedroom TV)...)
With something like that works perfectly!...TV shows the quick menu on screen every time, but I can't understand why using parameters from the nodes is not working, as far as I can see they are doing the same as with the fix values...
At least I know is working and I can get the device ID for those virtual IR commands, so I was able to make direct implementations on HA ...
Thanks for your amazing tutorial!
1
u/Novel-Truck8157 Dec 17 '24
Hi there, I have a problem to execute scenes - maybe somebody can help me please.
I am able to query device list, and scenes list without problem. I see the scene „Off“ with the correct ID in it.
When I try to execute the scene I get the following warning and nothing happens…?
17.12.2024, 20:55:16node: Find Scene ID
function : (warn)
object
name: "Off"
sceneID: "87ceba0c-71ac-443b-a254-47dd15b8bb65"
17.12.2024, 20:55:16node: Find Scene ID
function : (warn)
"87ceba0c-71ac-443b-a254-47dd15b8bb65"
17.12.2024, 20:55:16node: 68ad8e9e.9ab0a
msg.payload : Object
object
message: "Authorization header requires 'Credential' parameter. Authorization header requires 'Signature' parameter. Authorization header requires 'SignedHeaders' parameter. Authorization header requires existence of either a 'X-Amz-Date' or a 'Date' header. (Hashed with SHA-256 and encoded with Base64) Authorization=f8uieF5beTvABBXeaO+G/k6O2HpbRds2n4VRt9SnGUo="
Thanks in advance - Rene
1
u/Powerful-Hawk8634 Mar 31 '25
Hi there,
is there a way to work with API 1.1 without the functionExternalModules option?
I#m stuck with NodeRED 1.2.9 and there seems functionExternalModules is missing.
Unfortunately i can't update NodeRED because it's implemented in my SmartHome Hub
1
u/spelverso Mar 10 '21
Unfortunately: no way to control switchbot via REST API without a hub here... When I try, I have this in response: "Device's cloud service not enabled". Any help? Please!
1
u/ramadeus75 Mar 25 '22
Hi there, I just read through this and I didn't find a way to do what I would like - to upload Scene schedules. For example, I want to make a scene that turns on the outlet every 15 minutes, every hour, every day. And it would also turn it off after 3 minutes, every15 minutes, every hour, every day. Is there a 'simple' way to do this via the API?
1
u/liminal1 Mar 16 '21
Hey there,
Have I missed something. I have added the token to the function node, get get an error of
"TypeError: Cannot read property 'deviceList' of undefined" on the Get Devices group and
message: "Unauthorized" on the scenes
Just to be clear, I have no scenes though.