[{"id":"2611100b.251df","type":"tab","label":"空气净化器","disabled":false,"info":""},{"id":"398e1722.d7d75","type":"homekit-service","z":"2611100b.251df","isParent":true,"hostType":"0","bridge":"8d00484b.f1d4c8","accessoryId":"","parentService":"","name":"空气净化器","serviceName":"AirPurifier","topic":"","filter":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","firmwareRev":"","hardwareRev":"","softwareRev":"","cameraConfigVideoProcessor":"","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":"","cameraConfigMaxWidth":"","cameraConfigMaxHeight":"","cameraConfigMaxFPS":"","cameraConfigMaxBitrate":"","cameraConfigVideoCodec":"","cameraConfigAudioCodec":"","cameraConfigAudio":false,"cameraConfigPacketSize":"","cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"","cameraConfigMapAudio":"","cameraConfigVideoFilter":"","cameraConfigAdditionalCommandLine":"","cameraConfigDebug":false,"cameraConfigInterfaceName":"","characteristicProperties":"{"TargetAirPurifierState":true,"LockPhysicalControls":true,"RotationSpeed":{"minValue":1,"maxValue":15,"minStep":1},"FilterLifeLevel":true,"CurrentRelativeHumidity":0,"PM2_5Density":1}","waitForSetupMsg":false,"outputs":2,"x":930,"y":700,"wires":[["aaeec4fb.92a798"],[]]},{"id":"aaeec4fb.92a798","type":"switch","z":"2611100b.251df","name":"判断","property":"payload","propertyType":"msg","rules":[{"t":"hask","v":"Active","vt":"str"},{"t":"hask","v":"TargetAirPurifierState","vt":"str"},{"t":"hask","v":"RotationSpeed","vt":"str"},{"t":"hask","v":"LockPhysicalControls","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":1130,"y":700,"wires":[["dfdf0b12.69a538"],["152e9a9.1029a65"],["2b1ec971.4c4226"],["32aec2a0.41c5de"]]},{"id":"dfdf0b12.69a538","type":"switch","z":"2611100b.251df","name":"开关","property":"payload.Active","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"num"},{"t":"eq","v":"1","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":1410,"y":540,"wires":[["aaa8096a.b8be58"],["80c58fff.bbbab"]]},{"id":"152e9a9.1029a65","type":"switch","z":"2611100b.251df","name":"模式","property":"payload.TargetAirPurifierState","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"0","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1410,"y":620,"wires":[["4b1c06c7.debec8"],["dbd8855d.1122b8"]]},{"id":"96f581be.61734","type":"api-call-service","z":"2611100b.251df","name":"","server":"9f12f038.c14df","version":1,"debugenabled":false,"service_domain":"xiaomi_miio_airpurifier","service":"fan_set_favorite_level","entityId":"fan.xiaomi_air_purifier_2","data":"","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1750,"y":760,"wires":[[]]},{"id":"2b1ec971.4c4226","type":"function","z":"2611100b.251df","name":"设置速度","func":"msg.payload.data={"level":`${msg.payload.RotationSpeed}`-1}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1420,"y":760,"wires":[["96f581be.61734"]]},{"id":"aaa8096a.b8be58","type":"api-call-service","z":"2611100b.251df","name":"","server":"9f12f038.c14df","version":1,"debugenabled":false,"service_domain":"fan","service":"turn_off","entityId":"fan.xiaomi_air_purifier_2","data":"","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1640,"y":500,"wires":[[]]},{"id":"80c58fff.bbbab","type":"api-call-service","z":"2611100b.251df","name":"","server":"9f12f038.c14df","version":1,"debugenabled":false,"service_domain":"fan","service":"turn_on","entityId":"fan.xiaomi_air_purifier_2","data":"","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1640,"y":560,"wires":[[]]},{"id":"4b1c06c7.debec8","type":"api-call-service","z":"2611100b.251df","name":"","server":"9f12f038.c14df","version":1,"debugenabled":false,"service_domain":"fan","service":"set_preset_mode","entityId":"fan.xiaomi_air_purifier_2","data":"{"preset_mode": "Auto"}","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1670,"y":620,"wires":[[]]},{"id":"dbd8855d.1122b8","type":"api-call-service","z":"2611100b.251df","name":"","server":"9f12f038.c14df","version":1,"debugenabled":false,"service_domain":"fan","service":"set_preset_mode","entityId":"fan.xiaomi_air_purifier_2","data":"{"preset_mode": "Favorite"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1670,"y":680,"wires":[[]]},{"id":"32aec2a0.41c5de","type":"switch","z":"2611100b.251df","name":"儿童锁","property":"payload.LockPhysicalControls","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"num"},{"t":"eq","v":"1","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":1410,"y":860,"wires":[["df21b274.9ca45"],["c0cd00ae.08d0a"]]},{"id":"c0cd00ae.08d0a","type":"api-call-service","z":"2611100b.251df","name":"","server":"9f12f038.c14df","version":1,"debugenabled":false,"service_domain":"xiaomi_miio_airpurifier","service":"fan_set_child_lock_on","entityId":"fan.xiaomi_air_purifier_2","data":"","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1750,"y":900,"wires":[[]]},{"id":"df21b274.9ca45","type":"api-call-service","z":"2611100b.251df","name":"","server":"9f12f038.c14df","version":1,"debugenabled":false,"service_domain":"xiaomi_miio_airpurifier","service":"fan_set_child_lock_off","entityId":"fan.xiaomi_air_purifier_2","data":"","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1750,"y":840,"wires":[[]]},{"id":"3357ad0c.dc80b2","type":"poll-state","z":"2611100b.251df","name":"","server":"9f12f038.c14df","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"updateinterval":"60","updateIntervalUnits":"seconds","outputinitially":false,"outputonchanged":false,"entity_id":"fan.xiaomi_air_purifier_2","state_type":"str","halt_if":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"x":160,"y":680,"wires":[["cd556164.f53ad","58e67d20.7fb854","e4fe35c4.5b2058","8601d2ff.71f59"]]},{"id":"cd556164.f53ad","type":"switch","z":"2611100b.251df","name":"模式","property":"data.attributes.preset_mode","propertyType":"msg","rules":[{"t":"eq","v":"Auto","vt":"str"},{"t":"neq","v":"Auto","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":530,"y":500,"wires":[["ba360278.c7fa"],["6d19cd3.c507934"]]},{"id":"ba360278.c7fa","type":"change","z":"2611100b.251df","name":"Manual Mode","rules":[{"t":"set","p":"payload","pt":"msg","to":"{"TargetAirPurifierState":1}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":700,"y":500,"wires":[["398e1722.d7d75"]]},{"id":"6d19cd3.c507934","type":"change","z":"2611100b.251df","name":"Auto mode","rules":[{"t":"set","p":"payload","pt":"msg","to":"{"TargetAirPurifierState":0}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":690,"y":540,"wires":[["398e1722.d7d75"]]},{"id":"6c28bbea.5d9b94","type":"debug","z":"2611100b.251df","name":"","active":true,"tosidebar":true,"console":true,"tostatus":true,"complete":"data","targetType":"msg","statusVal":"data","statusType":"auto","x":970,"y":400,"wires":[]},{"id":"58e67d20.7fb854","type":"switch","z":"2611100b.251df","name":"童锁","property":"data.attributes.child_lock","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":530,"y":680,"wires":[["aa39b0b7.8d46f"],["812786cc.36fee8"]]},{"id":"aa39b0b7.8d46f","type":"change","z":"2611100b.251df","name":"Child lock on","rules":[{"t":"set","p":"payload","pt":"msg","to":"{"LockPhysicalControls":1}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":690,"y":680,"wires":[["398e1722.d7d75"]]},{"id":"812786cc.36fee8","type":"change","z":"2611100b.251df","name":"Child lock off","rules":[{"t":"set","p":"payload","pt":"msg","to":"{"LockPhysicalControls":0}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":690,"y":720,"wires":[["398e1722.d7d75"]]},{"id":"e4fe35c4.5b2058","type":"switch","z":"2611100b.251df","name":"状态","property":"data.state","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":530,"y":840,"wires":[["94cdb5f2.adf4a8"],["f49b6684.cfbc88"]]},{"id":"94cdb5f2.adf4a8","type":"change","z":"2611100b.251df","name":"state: on","rules":[{"t":"set","p":"payload","pt":"msg","to":"{"Active":true,"CurrentAirPurifierState":2}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":680,"y":840,"wires":[["398e1722.d7d75"]]},{"id":"f49b6684.cfbc88","type":"change","z":"2611100b.251df","name":"state: off","rules":[{"t":"set","p":"payload","pt":"msg","to":"{"Active":false,"CurrentAirPurifierState":0}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":680,"y":880,"wires":[["398e1722.d7d75"]]},{"id":"8601d2ff.71f59","type":"function","z":"2611100b.251df","name":"设置属性","func":"msg.payload={"CurrentRelativeHumidity":`${msg.data.attributes.humidity}`,"FilterLifeLevel":`${msg.data.attributes.filter_life_remaining}`,"PM2_5Density":`${msg.data.attributes.aqi}`,"RotationSpeed":`${msg.data.attributes.favorite_level}`}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":620,"y":1000,"wires":[["398e1722.d7d75"]]},{"id":"1a921a50.6c9046","type":"debug","z":"2611100b.251df","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1080,"y":980,"wires":[]},{"id":"fb699f9c.128a8","type":"server-state-changed","z":"2611100b.251df","name":"","server":"9f12f038.c14df","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"fan.xiaomi_air_purifier_2","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":180,"y":820,"wires":[["9f5c144e.3e64f8","191f6ac4.0c8975","a75a0e42.8b0dc","1942f54b.fcf14b"]]},{"id":"9f5c144e.3e64f8","type":"switch","z":"2611100b.251df","name":"模式","property":"data.new_state.attributes.preset_mode","propertyType":"msg","rules":[{"t":"eq","v":"Auto","vt":"str"},{"t":"neq","v":"Auto","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":530,"y":540,"wires":[["ba360278.c7fa"],["6d19cd3.c507934"]]},{"id":"191f6ac4.0c8975","type":"switch","z":"2611100b.251df","name":"童锁","property":"data.new_state.attributes.child_lock","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":530,"y":720,"wires":[["aa39b0b7.8d46f"],["812786cc.36fee8"]]},{"id":"a75a0e42.8b0dc","type":"switch","z":"2611100b.251df","name":"状态","property":"data.new_state.state","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":530,"y":880,"wires":[["94cdb5f2.adf4a8"],["f49b6684.cfbc88"]]},{"id":"1942f54b.fcf14b","type":"function","z":"2611100b.251df","name":"设置属性","func":"msg.payload={"CurrentRelativeHumidity":`${msg.data.new_state.attributes.humidity}`,"FilterLifeLevel":`${msg.data.new_state.attributes.filter_life_remaining}`,"PM2_5Density":`${msg.data.new_state.attributes.aqi}`,"RotationSpeed":`${msg.data.new_state.attributes.favorite_level}`}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":620,"y":1060,"wires":[["398e1722.d7d75"]]},{"id":"8d00484b.f1d4c8","type":"homekit-bridge","bridgeName":"nodered桥","pinCode":"368-05-913","port":"","advertiser":"bonjour-hap","allowInsecureRequest":false,"manufacturer":"NRCHKB","model":"1.3.1","serialNo":"Default Serial Number","firmwareRev":"1.3.1","hardwareRev":"1.3.1","softwareRev":"1.3.1","customMdnsConfig":false,"mdnsMulticast":true,"mdnsInterface":"","mdnsPort":"","mdnsIp":"","mdnsTtl":"","mdnsLoopback":true,"mdnsReuseAddr":true,"allowMessagePassthrough":true},{"id":"9f12f038.c14df","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]