Roome智小易开关精灵nodered控制

![SO~K7UF]93%`3~U4BM}XR7G.png|1391x632](upload://savdOAclMAKvMKdlJHAHRFpVE6U.png)

{"id":"79ae437d.8b503c","type":"tab","label":"roome开关控制","disabled":false,"info":""},{"id":"a8e84fe5.6b8c4","type":"inject","z":"79ae437d.8b503c","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":70,"y":440,"wires":"b9f5f76a.dffd78"]]},{"id":"93ada76.2d29158","type":"http request","z":"79ae437d.8b503c","name":"执行控制","method":"POST","ret":"obj","paytoqs":false,"url":"http://api-0.myroome.com/rmf-web/switch/action/onOff?deviceCode={{{deviceCode}}}&keyOption={{{keyOption}}}&onOff={{{onOff}}}","tls":"","proxy":"","authType":"","x":1300,"y":460,"wires":"b61e8b79.ad1fa8"]]},{"id":"395cb45.8a86a4c","type":"function","z":"79ae437d.8b503c","name":"设置相关参数","func":"msg.payload = \"data to post\";\nmsg.headers = {};\nmsg.headers'User-Agent'] = 'Roome/5.9.6 (Android;8.1.0)  360 1807-A01';\nmsg.headers'Content-Type'] = 'application/x-www-form-urlencoded';\nmsg.headers'Cookie'] = ''+msg.qqid+'; '+msg.session+'';\nmsg.deviceCode = \"抓包获取\";\nmsg.keyOption = \"抓包获取\";\nreturn msg;","outputs":1,"noerr":0,"x":1140,"y":460,"wires":"93ada76.2d29158"]]},{"id":"b61e8b79.ad1fa8","type":"debug","z":"79ae437d.8b503c","name":"","active":true,"console":"false","complete":"false","x":1290,"y":540,"wires":]},{"id":"b9f5f76a.dffd78","type":"change","z":"79ae437d.8b503c","name":"关闭","rules":{"t":"set","p":"onOff","pt":"msg","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":190,"y":440,"wires":"484b11e8.12cb8"]]},{"id":"9eb7023f.b0063","type":"change","z":"79ae437d.8b503c","name":"开启","rules":{"t":"set","p":"onOff","pt":"msg","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":190,"y":480,"wires":"484b11e8.12cb8"]]},{"id":"9dde29ee.dec368","type":"inject","z":"79ae437d.8b503c","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":70,"y":480,"wires":"9eb7023f.b0063"]]},{"id":"f6acbd88.401c6","type":"http request","z":"79ae437d.8b503c","name":"","method":"POST","ret":"obj","paytoqs":false,"url":"http://api-0.myroome.com/rmf-web/user/switchs/key/findKeyStatus?homeId={{{homeId}}}&deviceCode={{{deviceCode}}}&keyOption={{{keyOption}}}","tls":"","proxy":"","authType":"","x":580,"y":460,"wires":"47496c0d.d20a44","fd36ec14.b2256"]]},{"id":"9f96a83a.8f9b58","type":"function","z":"79ae437d.8b503c","name":"设置相关参数","func":"msg.payload = \"data to post\";\nmsg.headers = {};\nmsg.headers'User-Agent'] = 'Roome/5.9.6 (Android;8.1.0)  360 1807-A01';\nmsg.headers'Content-Type'] = 'application/x-www-form-urlencoded';\nmsg.headers'Cookie'] = ''+msg.qqid+'; '+msg.session+'';\nmsg.deviceCode = \"抓包获取\";\nmsg.keyOption = \"抓包获取\";\nmsg.homeId = \"抓包获取\";\nreturn msg;","outputs":1,"noerr":0,"x":400,"y":460,"wires":"f6acbd88.401c6"]]},{"id":"47496c0d.d20a44","type":"debug","z":"79ae437d.8b503c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":730,"y":520,"wires":]},{"id":"3b88025f.5af07e","type":"inject","z":"79ae437d.8b503c","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":190,"y":640,"wires":"9f96a83a.8f9b58"]]},{"id":"fd36ec14.b2256","type":"switch","z":"79ae437d.8b503c","name":"判断设备是否在线","property":"payload.data.online","propertyType":"msg","rules":{"t":"eq","v":"1","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":750,"y":460,"wires":"6da90a8d.cca844"]]},{"id":"6da90a8d.cca844","type":"switch","z":"79ae437d.8b503c","name":"判断设备状态","property":"payload.data.onOff","propertyType":"msg","rules":{"t":"eq","v":"onOff","vt":"msg"},{"t":"neq","v":"onOff","vt":"msg"}],"checkall":"true","repair":false,"outputs":2,"x":940,"y":460,"wires":],"395cb45.8a86a4c"]],"outputLabels":"开启",null]},{"id":"d186ddc2.9cfc9","type":"inject","z":"79ae437d.8b503c","name":"每周日零点更新session","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"00 00 * * 0","once":false,"onceDelay":0.1,"x":170,"y":220,"wires":"7173838.904c57c"]]},{"id":"867f67d7.8c24d8","type":"debug","z":"79ae437d.8b503c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":930,"y":160,"wires":]},{"id":"182d1b36.2f14e5","type":"http request","z":"79ae437d.8b503c","name":"获取session","method":"POST","ret":"obj","paytoqs":false,"url":"http://api-0.myroome.com/rmf-web/j_spring_security_check?j_username=你的账户名&j_password=你的账户密码","tls":"","proxy":"","authType":"","x":730,"y":220,"wires":"867f67d7.8c24d8","a2fe5703.41c788"]]},{"id":"7173838.904c57c","type":"function","z":"79ae437d.8b503c","name":"设置相关参数","func":"msg.payload = \"data to post\";\nmsg.headers = {};\nmsg.headers'User-Agent'] = 'Roome/5.9.6 (Android;8.1.0)  360 1807-A01';\nmsg.headers'Content-Type'] = 'application/x-www-form-urlencoded';\n\n\nreturn msg;","outputs":1,"noerr":0,"x":500,"y":220,"wires":"182d1b36.2f14e5"]]},{"id":"a2fe5703.41c788","type":"change","z":"79ae437d.8b503c","name":"保存session到flow","rules":{"t":"move","p":"headers.set-cookie","pt":"msg","to":"cookie","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":990,"y":220,"wires":]]},{"id":"484b11e8.12cb8","type":"function","z":"79ae437d.8b503c","name":"读取session","func":"msg.qqid = \"\";\nmsg.session = \"\";\n\nif(flow.get(\"cookie\")!=null && flow.get(\"cookie\")!=\"\"){\n    var qqid = flow.get(\"cookie\")[0];\n    var session = flow.get(\"cookie\")[1];\n    msg.qqid = qqid;\n    msg.session = session;\n    if(qqid!=\"\" && qqid !=null && session!=\"\" && session != null ){\n        session = session.split(\";\")[0];\n        msg.qqid = qqid;\n        msg.session = session;\n    }\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":510,"y":340,"wires":"e80ae56a.1e6388"]]},{"id":"2b3c602d.86488","type":"inject","z":"79ae437d.8b503c","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":210,"y":340,"wires":"484b11e8.12cb8"]]},{"id":"e80ae56a.1e6388","type":"switch","z":"79ae437d.8b503c","name":"","property":"qqid","propertyType":"msg","rules":{"t":"empty"},{"t":"nempty"}],"checkall":"true","repair":false,"outputs":2,"x":690,"y":340,"wires":"7173838.904c57c"],"9f96a83a.8f9b58"]],"outputLabels":"为空","不为空"]}]

获取相关参数链接
获取homeId:
http://api-0.myroome.com/rmf-web/user/home/getHomeInfoList
通过homeId获取设备信息
http://api-0.myroome.com/rmf-web … eList?homeId=000000

通过http请求可获取相关信息

太直接了,,,,直白,,,:lol:lol,一个文字也没有

:lol导入后应该能看懂,