[{"id":"65a77e7e.bea8d","type":"tab","label":"小爱->Blinker控灯","disabled":false,"info":""},{"id":"34d4d6f2.f9f9da","type":"Blinker-IN","z":"65a77e7e.bea8d","name":"客厅4个灯","blinker":"a9068b30.e9caf8","x":80,"y":240,"wires":[["3bdeb5b1.03b3fa"]]},{"id":"508b96a6.691288","type":"api-call-service","z":"65a77e7e.bea8d","name":"开关控制","server":"c21a3934.c1b6c8","version":1,"debugenabled":true,"service_domain":"light","service":"","entityId":"","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":460,"y":240,"wires":[["b2c123d5.4b862"]]},{"id":"5a448244.ad561c","type":"Blinker-OUT","z":"65a77e7e.bea8d","x":910,"y":180,"wires":[[]]},{"id":"3bdeb5b1.03b3fa","type":"function","z":"65a77e7e.bea8d","name":"开关匹配","func":"var myLights={\n "1f844d0eeef9":[\n "light.vv_livingroom_zd",//客厅大灯\n "light.vv_livingroom_sd",//客厅灯带\n "light.vv_bedroom_sub",//入户灯\n "light.vv_livingroom_zl"//走廊灯\n ]\n}\nvar new_msg={};\nif(msg.payload.hasOwnProperty("get")){\n //状态查询\n new_msg.type="get";\n new_msg.SecretKey=msg.SecretKey;\n new_msg.payload={\n entity_id:myLights[msg.SecretKey][msg.payload.num-1]\n };\n return [new_msg,null,null];\n}else if(msg.payload.hasOwnProperty("set")){\n //操控指令\n new_msg.type="set";\n // new_msg.payload=msg.payload;\n new_msg.SecretKey=msg.SecretKey;\n new_msg.payload= {\n domain:"light",\n service: msg.payload.set.pState?"turn_on":"turn_off",\n data:{\n entity_id:myLights[msg.SecretKey][msg.payload.set.num-1]\n }\n }\n return[null,new_msg,null];\n}else{\n new_msg.type="other"\n new_msg.payload=msg.payload\n return[null,null,new_msg];\n}\n","outputs":3,"noerr":0,"x":260,"y":240,"wires":[["e3d6ac63.5df78"],["508b96a6.691288"],["618ed9d6.d44098"]]},{"id":"b2c123d5.4b862","type":"debug","z":"65a77e7e.bea8d","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":690,"y":240,"wires":[]},{"id":"76658294.1a74bc","type":"debug","z":"65a77e7e.bea8d","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":890,"y":240,"wires":[]},{"id":"e3d6ac63.5df78","type":"api-current-state","z":"65a77e7e.bea8d","name":"状态查询","server":"c21a3934.c1b6c8","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"","state_type":"habool","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":460,"y":180,"wires":[["d5fe930d.c487d"],["d5fe930d.c487d"]]},{"id":"d5fe930d.c487d","type":"function","z":"65a77e7e.bea8d","name":"状态反馈包","func":"var myLights={\n "1f844d0eeef9":[\n "light.vv_livingroom_zd",//客厅大灯\n "light.vv_livingroom_sd",//客厅灯带\n "light.vv_bedroom_sub",//入户灯\n "light.vv_livingroom_zl"//走廊灯\n ]\n}\nreturn {\n send:true,\n SecretKey:msg.SecretKey,\n payload:{\n pState:msg.data.state,\n num:myLights[msg.SecretKey].indexOf(msg.data.entity_id)+1\n }\n}","outputs":1,"noerr":0,"x":690,"y":180,"wires":[["76658294.1a74bc","5a448244.ad561c"]]},{"id":"618ed9d6.d44098","type":"debug","z":"65a77e7e.bea8d","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":450,"y":300,"wires":[]},{"id":"a9068b30.e9caf8","type":"blinker-conf","z":"","name":"客厅控制","SecretKey":"1f844d0eeef9","DeviceType":"multi_outlet","autoRes":"false"},{"id":"c21a3934.c1b6c8","type":"server","z":"","name":"Home Assistant","legacy":false,"addon":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]