Skip to content

Instantly share code, notes, and snippets.

@notenoughtech
Created January 8, 2021 12:13
Show Gist options
  • Save notenoughtech/d3562798b03679ec4e990dbb681e4d0f to your computer and use it in GitHub Desktop.
Save notenoughtech/d3562798b03679ec4e990dbb681e4d0f to your computer and use it in GitHub Desktop.
SwitchBot API

enter image description here SwitchBot API use in NodeRED. Covering all device types and API types to control SwitchBot devices.

Requirements

SwitchBot API token set as global variable "SwitchBotAPI"

SwitchBot Devices

Settings

  • Devices are set in "devices" flow
  • Scenes are set in "scenes" flow

More about me:

If you want to get the latest updates to this project you can follow me via your preferred social media:

And if you feeling like buying me a coffee or supporting me in a more continuous way:

I hope you have enjoyed the project!

[{"id":"6c2da3e3.8ce88c","type":"tab","label":"SwitchBot API","disabled":false,"info":"\n![enter image description here](https://notenoughtech.com/wp-content/uploads/2021/01/maxresdefault-1.jpg)\nSwitchBot API use in NodeRED. Covering all device types and API types to control SwitchBot devices.\n\n - [Complete instructions](https://notenoughtech.com/home-automation/switchbot-api/)\n\n\n\n## Requirements\n\nSwitchBot API token set as global variable \"**SwitchBotAPI**\"\n\nSwitchBot Devices\n\n - [SwitchBot Curtain](https://www.switch-bot.com/products/switchbot-curtain?sca_ref=457345.2RiWh8eFCv)\n - [SwitchBot](https://www.switch-bot.com/products/switchbot-bot?sca_ref=457345.2RiWh8eFCv)\n - [SwitchBot Hub](https://www.switch-bot.com/products/switchbot-hub-mini?sca_ref=457345.2RiWh8eFCv)\n - [SwitchBot Solar panel](https://www.switch-bot.com/products/switchbot-solar-panel?sca_ref=457345.2RiWh8eFCv)\n - [SwitchBot Remote](https://www.switch-bot.com/products/switchbot-remote?sca_ref=457345.2RiWh8eFCv)\n - [SwitchBot Temp & Humidity](https://www.switch-bot.com/products/switchbot-meter?sca_ref=457345.2RiWh8eFCv)\n\n# Settings\n\n - Devices are set in \"devices\" flow\n - Scenes are set in \"scenes\" flow\n \n ## More about me:\n\nIf you want to get the latest updates to this project you can follow me via your preferred social media:\n\n- [Facebook](https://www.facebook.com/NotEnoughTECH/)\n- [Twitter](https://twitter.com/NotEnoughTECH)\n- [Instagram](https://www.instagram.com/notenoughtech/)\n- [YouTube](https://www.youtube.com/user/Polepositionpage)\n\nAnd if you feeling like buying me a coffee or supporting me in a more continuous way:\n\n- [Paypal](https://www.paypal.me/notenoughtech)\n- [Patreon](https://www.patreon.com/NotEnoughTECH)\n\nI hope you have enjoyed the project!\n\n "},{"id":"2a1dca0d.f1f4c6","type":"group","z":"6c2da3e3.8ce88c","name":"Execute scene","style":{"stroke":"#0070c0","fill":"#bfdbef","label":true,"label-position":"n"},"nodes":["37966fa4.a738e","f97151c9.fc84","3ab9a7e9.8343e8","68ad8e9e.9ab0a"],"x":1174,"y":859,"w":872,"h":82},{"id":"379a49f4.a3b286","type":"group","z":"6c2da3e3.8ce88c","name":"Control Bot","style":{"stroke":"#777777","fill":"#ffffff","label":true,"label-position":"n"},"nodes":["637788bd.6baff8","bda7e7d2.d671f8","abe69a9.d214968","ef0480b0.4ba6","be3408b7.5ef288","9bc68b96.508fb8"],"x":1174,"y":59,"w":792,"h":162},{"id":"4dd84400.462e0c","type":"group","z":"6c2da3e3.8ce88c","name":"Control Curtain","style":{"stroke":"#777777","fill":"#ffffff","label":true,"label-position":"n"},"nodes":["3b3f70f7.ec1eb","3fe192cc.704d9e","bff7014c.1c958","50606f6f.3fec1","43e52cce.2d9424","10f2051c.079a1b","8f6f4236.ba008"],"x":1174,"y":279,"w":792,"h":222},{"id":"a48f785e.a96968","type":"group","z":"6c2da3e3.8ce88c","name":"Get Devices","style":{"stroke":"#92d04f","fill":"#e3f3d3","label":true,"label-position":"n","color":"#000000"},"nodes":["a4a33996.4e6aa","a1020ca2.c78ed8","faa74fdb.3d587","1da7ecd2.f06d63","4e24dc50.af1874"],"x":114,"y":139,"w":852,"h":122},{"id":"c0943863.d88218","type":"group","z":"6c2da3e3.8ce88c","name":"Get Scenes","style":{"stroke":"#0070c0","fill":"#bfdbef","label":true,"label-position":"n","color":"#000000"},"nodes":["f9b2a950.046288","9e36394e.833358","c39e2486.6466b8","c4549aa0.7517f8","375e60a.7b420a"],"x":114,"y":279,"w":852,"h":122},{"id":"e064bac4.ee6008","type":"group","z":"6c2da3e3.8ce88c","name":"Get Status","style":{"stroke":"#777777","fill":"#ffffff","label":true,"label-position":"n"},"nodes":["959b0cf9.e0e4d","e28f892e.fd7c08","677e6c21.6e2614","2c0611b4.db7b1e","e715bd1e.71c5a","315ed551.d15caa"],"x":134,"y":439,"w":772,"h":162},{"id":"ed86057f.2c4d38","type":"group","z":"6c2da3e3.8ce88c","name":"Control IR","style":{"stroke":"#ffC000","fill":"#ffefbf","label":true,"label-position":"n"},"nodes":["b351553f.83d768","8712e9b4.041a78","1528da43.c1d0b6","5a893192.0c0dc","39d018ed.a9d9d8","649101e1.7b308","a8e9f700.cf6558"],"x":1174,"y":559,"w":812,"h":182},{"id":"a4a33996.4e6aa","type":"http request","z":"6c2da3e3.8ce88c","g":"a48f785e.a96968","name":"All Devices","method":"GET","ret":"obj","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","x":630,"y":220,"wires":[["1da7ecd2.f06d63"]]},{"id":"a1020ca2.c78ed8","type":"function","z":"6c2da3e3.8ce88c","g":"a48f785e.a96968","name":"Fromat URL","func":"//needs authentication token stored as global variable\n\nmsg.headers = {Authorization: global.get(\"SwitchBotAPI\")};\nmsg.url = \"https://api.switch-bot.com/v1.0/devices\";\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":440,"y":220,"wires":[["a4a33996.4e6aa"]]},{"id":"faa74fdb.3d587","type":"inject","z":"6c2da3e3.8ce88c","g":"a48f785e.a96968","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":210,"y":220,"wires":[["a1020ca2.c78ed8"]]},{"id":"1da7ecd2.f06d63","type":"function","z":"6c2da3e3.8ce88c","g":"a48f785e.a96968","name":"Save as flow","func":"var devices = msg.payload.body.deviceList\n\nvar deviceList = [];\n\nfor( var y in devices) {\n \n let device = {\"type\": devices[y].deviceType,\n \"name\": devices[y].deviceName,\n \"deviceID\": devices[y].deviceId\n };\n deviceList.push(device);\n} \nflow.set(\"devices\", deviceList);\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":870,"y":220,"wires":[[]]},{"id":"4e24dc50.af1874","type":"comment","z":"6c2da3e3.8ce88c","g":"a48f785e.a96968","name":"Get all devices and save as flow","info":"","x":290,"y":180,"wires":[]},{"id":"3b3f70f7.ec1eb","type":"function","z":"6c2da3e3.8ce88c","g":"4dd84400.462e0c","name":"Control device Curtain","func":"var devices = flow.get(\"devices\");\nvar param = msg.topic;\n\nif(param === undefined){\n param = \"default\";\n}\n\nvar device = \"Curtain\"; //enter name of the device or use msg.payload \n\nfunction FindDevice(name){\n let index = devices.find(o => o.name === name);\n node.warn(index);\n let deviceID = index.deviceID;\n return deviceID\n}\nvar command = msg.payload;\n\nmsg.headers = {\"Authorization\": global.get(\"SwitchBotAPI\"),\n \"ContentType\": \"application/json; charset=utf8\"};\n \nmsg.url = \"https://api.switch-bot.com/v1.0/devices/\"+ FindDevice(device) +\"/commands\"\nmsg.payload = {\"command\":command,\"parameter\":param,\"commandType\":\"command\"};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1460,"y":360,"wires":[["bff7014c.1c958"]]},{"id":"3fe192cc.704d9e","type":"inject","z":"6c2da3e3.8ce88c","g":"4dd84400.462e0c","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"turnOn","payloadType":"str","x":1270,"y":320,"wires":[["3b3f70f7.ec1eb"]]},{"id":"bff7014c.1c958","type":"http request","z":"6c2da3e3.8ce88c","g":"4dd84400.462e0c","name":"Command","method":"POST","ret":"obj","paytoqs":"query","url":"","tls":"","persist":false,"proxy":"","authType":"","x":1670,"y":360,"wires":[["43e52cce.2d9424"]]},{"id":"50606f6f.3fec1","type":"inject","z":"6c2da3e3.8ce88c","g":"4dd84400.462e0c","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"turnOff","payloadType":"str","x":1270,"y":360,"wires":[["3b3f70f7.ec1eb"]]},{"id":"43e52cce.2d9424","type":"debug","z":"6c2da3e3.8ce88c","g":"4dd84400.462e0c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1850,"y":360,"wires":[]},{"id":"10f2051c.079a1b","type":"inject","z":"6c2da3e3.8ce88c","g":"4dd84400.462e0c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"0,ff,25","payload":"setPosition","payloadType":"str","x":1310,"y":460,"wires":[["3b3f70f7.ec1eb"]]},{"id":"637788bd.6baff8","type":"function","z":"6c2da3e3.8ce88c","g":"379a49f4.a3b286","name":"Control device White B","func":"var devices = flow.get(\"devices\");\n\nvar device = \"White B\"; //enter name of the device or use msg.payload \n\nfunction FindDevice(name){\n let index = devices.find(o => o.name === name);\n node.warn(index);\n let deviceID = index.deviceID;\n return deviceID\n}\nvar command = msg.payload;\n\nmsg.headers = {\"Authorization\": global.get(\"SwitchBotAPI\"),\n \"ContentType\": \"application/json; charset=utf8\"};\n \nmsg.url = \"https://api.switch-bot.com/v1.0/devices/\"+ FindDevice(device) +\"/commands\"\nmsg.payload = {\"command\":command,\"parameter\":\"default\",\"commandType\":\"command\"};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1480,"y":140,"wires":[["abe69a9.d214968"]]},{"id":"bda7e7d2.d671f8","type":"inject","z":"6c2da3e3.8ce88c","g":"379a49f4.a3b286","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"turnOn","payloadType":"str","x":1270,"y":100,"wires":[["637788bd.6baff8"]]},{"id":"abe69a9.d214968","type":"http request","z":"6c2da3e3.8ce88c","g":"379a49f4.a3b286","name":"Command","method":"POST","ret":"obj","paytoqs":"query","url":"","tls":"","persist":false,"proxy":"","authType":"","x":1690,"y":140,"wires":[["be3408b7.5ef288"]]},{"id":"ef0480b0.4ba6","type":"inject","z":"6c2da3e3.8ce88c","g":"379a49f4.a3b286","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"turnOff","payloadType":"str","x":1270,"y":140,"wires":[["637788bd.6baff8"]]},{"id":"be3408b7.5ef288","type":"debug","z":"6c2da3e3.8ce88c","g":"379a49f4.a3b286","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1850,"y":140,"wires":[]},{"id":"9bc68b96.508fb8","type":"inject","z":"6c2da3e3.8ce88c","g":"379a49f4.a3b286","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"press","payloadType":"str","x":1270,"y":180,"wires":[["637788bd.6baff8"]]},{"id":"8f6f4236.ba008","type":"comment","z":"6c2da3e3.8ce88c","g":"4dd84400.462e0c","name":"Pos params","info":"Curtain\tcommand\tsetPosition\n\n\n\"index0,mode0,postion0\"\n\n\nmode: 0 (Performance Mode), 1 (Silent Mode), ff (default mode)\npostion: 0~100 (0 means opened, 100 means closed)","x":1490,"y":420,"wires":[]},{"id":"b351553f.83d768","type":"function","z":"6c2da3e3.8ce88c","g":"ed86057f.2c4d38","name":"Control device IR","func":"var devices = flow.get(\"devices\");\n\nvar device = \"Curtain\"; //enter name of the device or use msg.payload \nmsg.payload = {\"command\":command,\"parameter\":\"default\",\"commandType\":\"customize\"};\n\nif(msg.topic !== \"custom\"){\n \n msg.payload = {\"command\":command,\"parameter\":\"default\",\"commandType\":\"customize\"}; \n \n}\n\nfunction FindDevice(name){\n let index = devices.find(o => o.name === name);\n node.warn(index);\n let deviceID = index.deviceID;\n return deviceID\n}\nvar command = msg.payload;\n\nmsg.headers = {\"Authorization\": global.get(\"SwitchBotAPI\"),\n \"ContentType\": \"application/json; charset=utf8\"};\n \nmsg.url = \"https://api.switch-bot.com/v1.0/devices/\"+ FindDevice(device) +\"/commands\"\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1470,"y":640,"wires":[["1528da43.c1d0b6"]]},{"id":"8712e9b4.041a78","type":"inject","z":"6c2da3e3.8ce88c","g":"ed86057f.2c4d38","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"turnOn","payloadType":"str","x":1290,"y":600,"wires":[["b351553f.83d768"]]},{"id":"1528da43.c1d0b6","type":"http request","z":"6c2da3e3.8ce88c","g":"ed86057f.2c4d38","name":"Command","method":"POST","ret":"obj","paytoqs":"query","url":"","tls":"","persist":false,"proxy":"","authType":"","x":1690,"y":640,"wires":[["39d018ed.a9d9d8"]]},{"id":"5a893192.0c0dc","type":"inject","z":"6c2da3e3.8ce88c","g":"ed86057f.2c4d38","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"turnOff","payloadType":"str","x":1290,"y":640,"wires":[["b351553f.83d768"]]},{"id":"39d018ed.a9d9d8","type":"debug","z":"6c2da3e3.8ce88c","g":"ed86057f.2c4d38","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1870,"y":640,"wires":[]},{"id":"649101e1.7b308","type":"comment","z":"6c2da3e3.8ce88c","g":"ed86057f.2c4d38","name":"Custom IR","info":"deviceType\tcommandType\tCommand\tcommand parameter\tDescription\nAll home appliance types except Others\t\"\"\tturnOn\tdefault\tevery home appliance can be turned on by default\nAll home appliance types except Others\tcommand\tturnOff\tdefault\tevery home appliance can be turned off by default\nOthers\tcustomize\t{user-defined button name}\tdefault\tall user-defined buttons must be configured with commandType=customize\nAir Conditioner\tcommand\tsetAll\t{temperature},{mode},{fan speed},{power state}\ne.g. 26,1,3,on\tthe unit of temperature is in celsius;\nmodes include 1 (auto), 2 (cool), 3 (dry), 4 (fan), 5 (heat);\nfan speed includes 1 (auto), 2 (low), 3 (medium), 4 (high);\npower state includes on and off\nTV, IPTV/Streamer, Set Top Box\tcommand\tSetChannel\t{channel number}, e.g. 15\tset the TV channel to switch to\ncommand\tvolumeAdd\tdefault\tvolume up\ncommand\tvolumeSub\tdefault\tvolume down\ncommand\tchannelAdd\tdefault\tnext channel\ncommand\tchannelSub\tdefault\tprevious channel\nDVD, Speaker\tcommand\tsetMute\tdefault\tmute/unmute\ncommand\tFastForward\tdefault\tfast forward\ncommand\tRewind\tdefault\trewind\ncommand\tNext\tdefault\tnext track\ncommand\tPrevious\tdefault\tlast track\ncommand\tPause\tdefault\tpause\ncommand\tPlay\tdefault\tplay/resume\ncommand\tStop\tdefault\tstop\nSpeaker\tcommand\tvolumeAdd\tdefault\tvolume up\ncommand\tvolumeSub\tdefault\tvolume down\nFan\tcommand\tswing\tdefault\tswing\ncommand\ttimer\tdefault\tset timer\ncommand\tlowSpeed\tdefault\tset fan speed to low\ncommand\tmiddleSpeed\tdefault\tset fan speed to medium\ncommand\thighSpeed\tdefault\tset fan speed to high\nLight\tcommand\tbrightnessUp\tdefault\tbrightness up\ncommand\tbrightnessDown\tdefault\tbrightness down\nNote: Most of the devices support turnOn or turnOff, which are case-sensitive. For infrared remote devices, when you have created customized buttons, you must set commandType to customize, otherwise the command will not work. command needs to be set to the name of the customized button.","x":1500,"y":700,"wires":[]},{"id":"f9b2a950.046288","type":"http request","z":"6c2da3e3.8ce88c","g":"c0943863.d88218","name":"All Devices","method":"GET","ret":"obj","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","x":630,"y":360,"wires":[["c4549aa0.7517f8"]]},{"id":"9e36394e.833358","type":"function","z":"6c2da3e3.8ce88c","g":"c0943863.d88218","name":"Fromat URL","func":"//needs authentication token stored as global variable\n\nmsg.headers = {Authorization: global.get(\"SwitchBotAPI\")};\nmsg.url = \"https://api.switch-bot.com/v1.0/scenes\";\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":440,"y":360,"wires":[["f9b2a950.046288"]]},{"id":"c39e2486.6466b8","type":"inject","z":"6c2da3e3.8ce88c","g":"c0943863.d88218","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":210,"y":360,"wires":[["9e36394e.833358"]]},{"id":"c4549aa0.7517f8","type":"function","z":"6c2da3e3.8ce88c","g":"c0943863.d88218","name":"Save as flow","func":"var scenes = msg.payload.body\n\nvar sceneList = [];\n\nfor( var y in scenes) {\n \n let scene = { \"name\": scenes[y].sceneName,\n \"sceneID\": scenes[y].sceneId\n };\n sceneList.push(scene);\n} \nflow.set(\"scenes\", sceneList);\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":870,"y":360,"wires":[[]]},{"id":"375e60a.7b420a","type":"comment","z":"6c2da3e3.8ce88c","g":"c0943863.d88218","name":"Get all devices and save as flow","info":"","x":290,"y":320,"wires":[]},{"id":"37966fa4.a738e","type":"function","z":"6c2da3e3.8ce88c","g":"2a1dca0d.f1f4c6","name":"Find Scene ID","func":"var scenes = flow.get(\"scenes\");\nvar scene = msg.payload;\n\nfunction FindScene(name){\n let index = scenes.find(o => o.name === name);\n node.warn(index);\n let sceneID = index.sceneID;\n node.warn(sceneID);\n return sceneID\n}\n\n\n\nmsg.headers = {\"Authorization\": global.get(\"SwitchBotAPI\"),\n \"ContentType\": \"application/json; charset=utf8\"};\n \nmsg.url = \"https://api.switch-bot.com/v1.0/scenes/\"+ FindScene(scene) +\"/execute\";\nmsg.payload = \"\";\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1520,"y":900,"wires":[["3ab9a7e9.8343e8"]]},{"id":"f97151c9.fc84","type":"inject","z":"6c2da3e3.8ce88c","g":"2a1dca0d.f1f4c6","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"BedroomSound","payloadType":"str","x":1300,"y":900,"wires":[["37966fa4.a738e"]]},{"id":"3ab9a7e9.8343e8","type":"http request","z":"6c2da3e3.8ce88c","g":"2a1dca0d.f1f4c6","name":"Execute","method":"POST","ret":"obj","paytoqs":"query","url":"","tls":"","persist":false,"proxy":"","authType":"","x":1740,"y":900,"wires":[["68ad8e9e.9ab0a"]]},{"id":"68ad8e9e.9ab0a","type":"debug","z":"6c2da3e3.8ce88c","g":"2a1dca0d.f1f4c6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1930,"y":900,"wires":[]},{"id":"a8e9f700.cf6558","type":"inject","z":"6c2da3e3.8ce88c","g":"ed86057f.2c4d38","name":"Custom sample","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"custom","payload":"{\"command\":\"CustomRemoteButton\",\"parameter\":\"default\",\"commandType\":\"customize\"}","payloadType":"json","x":1300,"y":700,"wires":[["b351553f.83d768"]]},{"id":"959b0cf9.e0e4d","type":"function","z":"6c2da3e3.8ce88c","g":"e064bac4.ee6008","name":"Get Status","func":"var devices = flow.get(\"devices\");\n\nvar device = msg.payload; //enter name of the device or use msg.payload \n\nfunction FindDevice(name){\n let index = devices.find(o => o.name === name);\n node.warn(index);\n let deviceID = index.deviceID;\n return deviceID\n}\n\nmsg.headers = {\"Authorization\": global.get(\"SwitchBotAPI\"),\n \"ContentType\": \"application/json; charset=utf8\"};\n \nmsg.url = \"https://api.switch-bot.com/v1.0/devices/\"+ FindDevice(device) +\"/status\"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":410,"y":520,"wires":[["677e6c21.6e2614"]]},{"id":"e28f892e.fd7c08","type":"inject","z":"6c2da3e3.8ce88c","g":"e064bac4.ee6008","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"White B","payloadType":"str","x":230,"y":480,"wires":[["959b0cf9.e0e4d"]]},{"id":"677e6c21.6e2614","type":"http request","z":"6c2da3e3.8ce88c","g":"e064bac4.ee6008","name":"Status","method":"GET","ret":"obj","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","x":610,"y":520,"wires":[["2c0611b4.db7b1e"]]},{"id":"2c0611b4.db7b1e","type":"debug","z":"6c2da3e3.8ce88c","g":"e064bac4.ee6008","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":790,"y":520,"wires":[]},{"id":"e715bd1e.71c5a","type":"inject","z":"6c2da3e3.8ce88c","g":"e064bac4.ee6008","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Curtain","payloadType":"str","x":230,"y":520,"wires":[["959b0cf9.e0e4d"]]},{"id":"315ed551.d15caa","type":"inject","z":"6c2da3e3.8ce88c","g":"e064bac4.ee6008","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Office","payloadType":"str","x":230,"y":560,"wires":[["959b0cf9.e0e4d"]]}]
@MartynWynne
Copy link

Love the concept and new to this so forgive the question if was covered somewhere else, but I can't see any mention of version 1.1? My token gives Unauthorized on 1.1 and Cannot read properties of undefined (reading 'device_type' on 1.0. I'm on version 7.9 of the app so think I need more complex authentication?

@notenoughtech
Copy link
Author

I started to work on v1.1 about a week ago. Authentication has changed and I need to rewrite some of this to reflect this. I'm sorry it takes some time as I'm juggling multiple things at once. It's on my list for sure. You can beat me to it, if you want as SwitchBot outlined the new authentication in their documentation.

@MartynWynne
Copy link

MartynWynne commented Jun 26, 2024 via email

@notenoughtech
Copy link
Author

I'll check it out probably over the weekend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment