NRCHKB / node-red-contrib-homekit-bridged

Node-RED Contribution - HomeKit Bridged : Node-RED nodes to simulate Apple HomeKit devices.
https://nrchkb.github.io
MIT License
412 stars 52 forks source link

[Bug]: Cannot link sensors to AirPurifier. #519

Closed SongzhouYang closed 1 year ago

SongzhouYang commented 1 year ago

NRCHKB Plugin Version

1.5.0

Node JS Version

addon-node-red 14.1.0

NPM Version

addon-node-red 14.1.0

Node-RED Version

addon-node-red 14.1.0

Operating System

Linux raspberrypi 5.15.84-v8+

What happened?

It’s not possible to link any sensor directly to the AirPurifier and display its data. When the sensor node, such as the HumiditySensor, is assigned as a linked node to the AirPurifier node, it won’t appear in the AirPurifier display, but can be accessed through Accessories. Even if you define CurrentRelativeHumidity: true in the AirPurifier, the humidity sensor won’t be visible.

IMG_2876

Assigning the HumiditySensor to another parent node, like a Switch, will display the humidity data in the AirPurifier, but the data cannot be read.

IMG_2877

To make it work, data must be manually passed as the sensor cannot be linked to the AirPurifier directly.

IMG_2878

The same for AirQuality, FilterMaintenance, Temperature, and so on.

How to reproduce?

Just as I describe above. A Parent AirPurifier Node + A Linked Sensor Node --> Not Work A Parent AirPurifier Node + A Parent Any Node + A Linked Sensor Node --> Can see UI A Parent AirPurifier Node + A Parent Any Node + A Linked Sensor Node + Manually Set Data --> Work

Expected behavior:

The sensor is visible with its data via direct link.

Additional comments?

Try many combinations, not the ugly way works.

Relevant log output

No response

crxporter commented 1 year ago

Hello!

I believe you are approaching this in the wrong manner. The Air Purifier doesn't need extra sensors added. It has these "built in"

You don't add a humidity sensor service to the air purifier ... you just send the current humidity to the air purifier service.

Take a look at the "Full Featured Air Purifier" example from our wiki link here

I hope this makes sense - let us know how it goes, we'll be here to help more

edit: reading in more detail - I might have misunderstood. Let's see if @gogovega has any comments?

SongzhouYang commented 1 year ago

Hello,

Thank you for responding quickly!

I have reviewed the Wiki, and as you can see from my attached picture, the same issue arises with the FilterMaintenance node. The Wiki suggests creating a FilterMaintenance node and linking it to an AirPurifier node, but my attempt to do so has not been successful. As a result, I had to manually set the values.

TheNON75 commented 1 year ago

What do you mean by "setting the values manually"?

GogoVega commented 1 year ago

Hi, The Wiki is correct on this point, if you define

{ "CurrentRelativeHumidity": true }

in the characteristics of your Air Purifier node, a humidity field will be integrated into the AirPurifier service in Home.app (see image below). I dropped the flow with which I made the image below. If the problem persists, try a full deploy(click on deploy option) then if it still does not work restart your machine.

IMG_3085

[{"id":"23658c6b.4bf7fc","type":"debug","z":"0611fdba4878ab79","name":"Output","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":570,"y":1100,"wires":[]},{"id":"48715e2b.edde4","type":"inject","z":"0611fdba4878ab79","name":"Target state: on","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"Active\":true}","payloadType":"json","x":180,"y":1160,"wires":[["b76a15e.cbd98e8"]]},{"id":"6c58b865.cbe098","type":"inject","z":"0611fdba4878ab79","name":"Target state: off","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"Active\":false}","payloadType":"json","x":180,"y":1200,"wires":[["b76a15e.cbd98e8"]]},{"id":"c80db304.c4e","type":"inject","z":"0611fdba4878ab79","name":"Auto mode","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"TargetAirPurifierState\":1}","payloadType":"json","x":440,"y":980,"wires":[["b76a15e.cbd98e8"]]},{"id":"2188d196.d711e6","type":"inject","z":"0611fdba4878ab79","name":"Current State: ON","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"CurrentAirPurifierState\":2}","payloadType":"json","x":410,"y":1380,"wires":[["b76a15e.cbd98e8"]]},{"id":"b76a15e.cbd98e8","type":"homekit-service","z":"0611fdba4878ab79","isParent":true,"hostType":"0","bridge":"f0825aeb.9064a8","accessoryId":"","parentService":"","name":"Pure 2","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":"{\"CurrentRelativeHumidity\": true}","waitForSetupMsg":false,"outputs":2,"x":430,"y":1100,"wires":[["23658c6b.4bf7fc"],[]]},{"id":"5c80309d.22e278","type":"inject","z":"0611fdba4878ab79","name":"Manual Mode","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"TargetAirPurifierState\":0}","payloadType":"json","x":430,"y":1020,"wires":[["b76a15e.cbd98e8"]]},{"id":"44a8a93d.b0b51","type":"inject","z":"0611fdba4878ab79","name":"Current State: OFF","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"CurrentAirPurifierState\":0}","payloadType":"json","x":410,"y":1300,"wires":[["b76a15e.cbd98e8"]]},{"id":"e090d2b0.110df8","type":"inject","z":"0611fdba4878ab79","name":"Current State: IDLE","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"CurrentAirPurifierState\":1}","payloadType":"json","x":410,"y":1340,"wires":[["b76a15e.cbd98e8"]]},{"id":"633c58dd.2f2dc8","type":"comment","z":"0611fdba4878ab79","name":"Auto/Manual mode","info":"","x":250,"y":980,"wires":[]},{"id":"9a55b755.665a2","type":"comment","z":"0611fdba4878ab79","name":"Set target state","info":"","x":160,"y":1120,"wires":[]},{"id":"6d243594.778f14","type":"comment","z":"0611fdba4878ab79","name":"Set actual state off/idle/on","info":"","x":410,"y":1260,"wires":[]},{"id":"ddf73ca967abad6a","type":"inject","z":"0611fdba4878ab79","name":"Humidity: 23","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"CurrentRelativeHumidity\": 23}","payloadType":"json","x":150,"y":1020,"wires":[["b76a15e.cbd98e8"]]},{"id":"03cb32e9f2be725a","type":"inject","z":"0611fdba4878ab79","name":"Humidity: 83","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"CurrentRelativeHumidity\": 83}","payloadType":"json","x":150,"y":1060,"wires":[["b76a15e.cbd98e8"]]},{"id":"f0825aeb.9064a8","type":"homekit-bridge","bridgeName":"Dev","pinCode":"111-11-111","port":"","allowInsecureRequest":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number"}]
SongzhouYang commented 1 year ago

What do you mean by "setting the values manually"?

Hi @TheNON75, it's done by a Function node as:

var FilterLifeLevel = parseInt(`${msg.payload}`);
msg.payload = {
    "FilterLifeLevel": FilterLifeLevel,
    "FilterChangeIndication": FilterLifeLevel < 10
}
return msg;

Hi @GogoVega, I've checked the flow you provided, of course this will work successfully, because this flow does not involve the sensor node, but manually sets the value, but I want to know how to link the sensor node directly.

This is the three situations corresponding to aforementioned pictures: CleanShot 2023-03-18 at 09 19 45@2x

Here is also my full flow which works but cumbersome:

[{"id":"bcea52a269480ce5","type":"tab","label":"AirPurifier","disabled":false,"info":"","env":[]},{"id":"dd9a7a6397b9c1dc","type":"server-state-changed","z":"bcea52a269480ce5","name":"Air Purifier Child Lock","server":"9f12f038.c14df","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"switch.zhimi_rma1_48c4_physical_control_locked","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":160,"y":700,"wires":[["dfdf221e3013322a"],["be6810ccdceec089"]]},{"id":"dfdf221e3013322a","type":"change","z":"bcea52a269480ce5","name":"On","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"LockPhysicalControls\":1}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":660,"wires":[["c18c9a52aab597e9"]]},{"id":"be6810ccdceec089","type":"change","z":"bcea52a269480ce5","name":"Off","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"LockPhysicalControls\":0}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":740,"wires":[["c18c9a52aab597e9"]]},{"id":"c18c9a52aab597e9","type":"homekit-service","z":"bcea52a269480ce5","isParent":true,"hostType":"0","bridge":"ecdb703c13e87f1b","accessoryId":"","parentService":"","name":"Air Purifier","serviceName":"AirPurifier","topic":"","filter":false,"manufacturer":"Xiaomi","model":"zhimi.airpurifier.rma1","serialNo":"zhimi.airpurifier.rma1","firmwareRev":"1.0.0","hardwareRev":"1.0.0","softwareRev":"1.0.0","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":1280,"cameraConfigMaxHeight":720,"cameraConfigMaxFPS":10,"cameraConfigMaxBitrate":300,"cameraConfigVideoCodec":"libx264","cameraConfigAudioCodec":"libfdk_aac","cameraConfigAudio":false,"cameraConfigPacketSize":1316,"cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"scale=1280:720","cameraConfigAdditionalCommandLine":"-tune zerolatency","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{\"LockPhysicalControls\":true,\"RotationSpeed\":{\"minValue\":0,\"maxValue\":15,\"minStep\":1},\"SwingMode\":true,\"TargetAirPurifierState\":{\"minValue\":0,\"maxValue\":2,\"minStep\":1,\"validValues\":[0,1,2]},\"AirQuality\":true,\"PM2_5Density\":true,\"CurrentRelativeHumidity\":true,\"CurrentTemperature\":true,\"FilterLifeLevel\":true,\"FilterChangeIndication\":true}","waitForSetupMsg":false,"outputs":2,"x":970,"y":780,"wires":[[],["2c561c84b01de726"]]},{"id":"f28bfd54c843a23b","type":"api-call-service","z":"bcea52a269480ce5","name":"Lock","server":"9f12f038.c14df","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.zhimi_rma1_48c4_physical_control_locked"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1870,"y":660,"wires":[[]]},{"id":"5dab20df02cb7978","type":"switch","z":"bcea52a269480ce5","name":"Lock","property":"payload.LockPhysicalControls","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"0","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1410,"y":700,"wires":[["7627532132c097d1"],["33123a1ca5a5eafa"]]},{"id":"aa5078bbc2ce79dc","type":"api-call-service","z":"bcea52a269480ce5","name":"Unlock","server":"9f12f038.c14df","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.zhimi_rma1_48c4_physical_control_locked"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1880,"y":740,"wires":[[]]},{"id":"33123a1ca5a5eafa","type":"api-current-state","z":"bcea52a269480ce5","name":"Currently Locked","server":"9f12f038.c14df","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.zhimi_rma1_48c4_physical_control_locked","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1650,"y":740,"wires":[["aa5078bbc2ce79dc"],[]]},{"id":"7627532132c097d1","type":"api-current-state","z":"bcea52a269480ce5","name":"Currently Unlocked","server":"9f12f038.c14df","version":3,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.zhimi_rma1_48c4_physical_control_locked","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1650,"y":660,"wires":[["f28bfd54c843a23b"],[]]},{"id":"dccff125a771308a","type":"server-state-changed","z":"bcea52a269480ce5","name":"Air Purifier Alarm","server":"9f12f038.c14df","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"switch.zhimi_rma1_48c4_alarm","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":180,"y":1420,"wires":[["78ca885223c7e919"],["7b0cc9148bc52393"]]},{"id":"78ca885223c7e919","type":"change","z":"bcea52a269480ce5","name":"On","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"On\":true}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":1380,"wires":[["50d026423d926d92"]]},{"id":"7b0cc9148bc52393","type":"change","z":"bcea52a269480ce5","name":"Off","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"On\":false}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":1460,"wires":[["50d026423d926d92"]]},{"id":"f52227374b9d5a76","type":"api-call-service","z":"bcea52a269480ce5","name":"Turn On","server":"9f12f038.c14df","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.zhimi_rma1_48c4_alarm"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1880,"y":1380,"wires":[[]]},{"id":"bb3a9689a8d11057","type":"switch","z":"bcea52a269480ce5","name":"Alarm Status","property":"payload.On","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":1430,"y":1420,"wires":[["87fd60f0524bf0ae"],["eb39763da4314ff7"]]},{"id":"42de2e95d427805a","type":"api-call-service","z":"bcea52a269480ce5","name":"Turn Off","server":"9f12f038.c14df","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.zhimi_rma1_48c4_alarm"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1880,"y":1460,"wires":[[]]},{"id":"eb39763da4314ff7","type":"api-current-state","z":"bcea52a269480ce5","name":"Currently On","server":"9f12f038.c14df","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.zhimi_rma1_48c4_alarm","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1630,"y":1460,"wires":[["42de2e95d427805a"],[]]},{"id":"87fd60f0524bf0ae","type":"api-current-state","z":"bcea52a269480ce5","name":"Currently Off","server":"9f12f038.c14df","version":3,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.zhimi_rma1_48c4_alarm","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1630,"y":1380,"wires":[["f52227374b9d5a76"],[]]},{"id":"50d026423d926d92","type":"homekit-service","z":"bcea52a269480ce5","isParent":false,"hostType":"0","bridge":"","accessoryId":"","parentService":"4bbc93931ee830c1","name":"Air Purifier Alarm","serviceName":"Switch","topic":"Sound","filter":false,"manufacturer":"NRCHKB","model":"1.5.0","serialNo":"Default Serial Number","firmwareRev":"1.5.0","hardwareRev":"1.5.0","softwareRev":"1.5.0","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":1280,"cameraConfigMaxHeight":720,"cameraConfigMaxFPS":10,"cameraConfigMaxBitrate":300,"cameraConfigVideoCodec":"libx264","cameraConfigAudioCodec":"libfdk_aac","cameraConfigAudio":false,"cameraConfigPacketSize":1316,"cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"scale=1280:720","cameraConfigAdditionalCommandLine":"-tune zerolatency","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{}","waitForSetupMsg":false,"outputs":2,"x":990,"y":1420,"wires":[[],["bb3a9689a8d11057"]]},{"id":"e36f89291c082855","type":"server-state-changed","z":"bcea52a269480ce5","name":"Air Purifier Main","server":"9f12f038.c14df","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"fan.zhimi_rma1_48c4_air_purifier","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":false,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":180,"y":540,"wires":[["be7ee40de1d46911"]]},{"id":"6949d49808255116","type":"server-state-changed","z":"bcea52a269480ce5","name":"Air Purifier Power","server":"9f12f038.c14df","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"switch.zhimi_rma1_48c4_switch_status","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":false,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":180,"y":860,"wires":[["efd20cb5ddf3404c"],["2a7bdffdeb47d853"]]},{"id":"18594c160050d307","type":"server-state-changed","z":"bcea52a269480ce5","name":"Air Purifier Humidity","server":"9f12f038.c14df","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.zhimi_rma1_48c4_relative_humidity","entityidfiltertype":"exact","outputinitially":true,"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,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":170,"y":1140,"wires":[["4084e9bad25a556c"]]},{"id":"893c742a21e66a86","type":"server-state-changed","z":"bcea52a269480ce5","name":"Air Purifier Temperature","server":"9f12f038.c14df","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.zhimi_rma1_48c4_temperature","entityidfiltertype":"exact","outputinitially":true,"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,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":160,"y":1220,"wires":[["f0d7ae948e9aac5c"]]},{"id":"3f0c3c9f958fafdd","type":"server-state-changed","z":"bcea52a269480ce5","name":"Air Purifier Air Quality","server":"9f12f038.c14df","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.zhimi_rma1_48c4_pm25_density","entityidfiltertype":"exact","outputinitially":true,"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,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":160,"y":1060,"wires":[["cc06c5c2ade8232a"]]},{"id":"abfa4bee03a80326","type":"server-state-changed","z":"bcea52a269480ce5","name":"Air Purifier Filter Status","server":"9f12f038.c14df","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.zhimi_rma1_48c4_filter_life_level","entityidfiltertype":"exact","outputinitially":true,"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,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":160,"y":1300,"wires":[["0fccc25c03fd0eb5"]]},{"id":"be7ee40de1d46911","type":"switch","z":"bcea52a269480ce5","name":"Mode Control","property":"data.new_state.attributes.preset_mode","propertyType":"msg","rules":[{"t":"eq","v":"Auto","vt":"str"},{"t":"eq","v":"Sleep","vt":"str"},{"t":"eq","v":"Favorite","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":480,"y":540,"wires":[["f073926353c5f2f4","3301fab3d3dd0225"],["7e4b24da8efe8296","f073926353c5f2f4"],["cb24632ea9d8eef4"]]},{"id":"f073926353c5f2f4","type":"change","z":"bcea52a269480ce5","name":"Auto/Sleep Mode","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"TargetAirPurifierState\":1}","tot":"json"},{"t":"set","p":"isManual","pt":"flow","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":750,"y":500,"wires":[["c18c9a52aab597e9"]]},{"id":"cb24632ea9d8eef4","type":"change","z":"bcea52a269480ce5","name":"Favorite Mode","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"TargetAirPurifierState\":0}","tot":"json"},{"t":"set","p":"isManual","pt":"flow","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":580,"wires":[["c18c9a52aab597e9"]]},{"id":"7e4b24da8efe8296","type":"change","z":"bcea52a269480ce5","name":"Sleep Mode","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"On\":true}","tot":"json"},{"t":"set","p":"isSleep","pt":"flow","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":340,"wires":[["4bbc93931ee830c1"]]},{"id":"3301fab3d3dd0225","type":"change","z":"bcea52a269480ce5","name":"Auto Mode","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"On\":false}","tot":"json"},{"t":"set","p":"isSleep","pt":"flow","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":420,"wires":[["4bbc93931ee830c1"]]},{"id":"4bbc93931ee830c1","type":"homekit-service","z":"bcea52a269480ce5","isParent":true,"hostType":"0","bridge":"ecdb703c13e87f1b","accessoryId":"","parentService":"c18c9a52aab597e9","name":"Air Purifier Panel","serviceName":"Switch","topic":"","filter":false,"manufacturer":"Xiaomi","model":"zhimi.airpurifier.rma1","serialNo":"zhimi.airpurifier.rma1","firmwareRev":"1.0.0","hardwareRev":"1.0.0","softwareRev":"1.0.0","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":1280,"cameraConfigMaxHeight":720,"cameraConfigMaxFPS":10,"cameraConfigMaxBitrate":300,"cameraConfigVideoCodec":"libx264","cameraConfigAudioCodec":"libfdk_aac","cameraConfigAudio":false,"cameraConfigPacketSize":1316,"cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"scale=1280:720","cameraConfigAdditionalCommandLine":"-tune zerolatency","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{}","waitForSetupMsg":false,"outputs":2,"x":990,"y":380,"wires":[[],["61a423e0d1749a3c"]]},{"id":"ad0122d1b1914648","type":"api-call-service","z":"bcea52a269480ce5","name":"Switch to Sleep Mode","server":"9f12f038.c14df","version":5,"debugenabled":false,"domain":"fan","service":"set_preset_mode","areaId":[],"deviceId":[],"entityId":["fan.zhimi_rma1_48c4_air_purifier"],"data":"{\"preset_mode\":\"Sleep\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1920,"y":340,"wires":[[]]},{"id":"61a423e0d1749a3c","type":"switch","z":"bcea52a269480ce5","name":"Sleep","property":"payload.On","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":1410,"y":380,"wires":[["76dff5a61f83dd1b"],["3e0b77131f4847b5"]]},{"id":"b641db6ae6b3dcd5","type":"api-call-service","z":"bcea52a269480ce5","name":"Switch to Auto Mode","server":"9f12f038.c14df","version":5,"debugenabled":false,"domain":"fan","service":"set_preset_mode","areaId":[],"deviceId":[],"entityId":["fan.zhimi_rma1_48c4_air_purifier"],"data":"{\"preset_mode\":\"Auto\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1920,"y":420,"wires":[[]]},{"id":"76dff5a61f83dd1b","type":"switch","z":"bcea52a269480ce5","name":"Current Auto Mode","property":"isSleep","propertyType":"flow","rules":[{"t":"false"}],"checkall":"true","repair":false,"outputs":1,"x":1650,"y":340,"wires":[["ad0122d1b1914648"]]},{"id":"3e0b77131f4847b5","type":"switch","z":"bcea52a269480ce5","name":"Current Sleep Mode","property":"isSleep","propertyType":"flow","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":1660,"y":420,"wires":[["b641db6ae6b3dcd5"]]},{"id":"6013102806aba494","type":"switch","z":"bcea52a269480ce5","name":"Mode","property":"payload.TargetAirPurifierState","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"0","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1410,"y":540,"wires":[["6eefd68468972571"],["39a5986d0bc79d13"]]},{"id":"f997923ba9089a0d","type":"api-call-service","z":"bcea52a269480ce5","name":"Turn Manual","server":"9f12f038.c14df","version":5,"debugenabled":false,"domain":"fan","service":"set_preset_mode","areaId":[],"deviceId":[],"entityId":["fan.zhimi_rma1_48c4_air_purifier"],"data":"{\"preset_mode\":\"Favorite\"}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1890,"y":580,"wires":[[]]},{"id":"6eefd68468972571","type":"switch","z":"bcea52a269480ce5","name":"Currently Manual","property":"isManual","propertyType":"flow","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":1650,"y":500,"wires":[["abd5f28eff0941c8"]]},{"id":"39a5986d0bc79d13","type":"switch","z":"bcea52a269480ce5","name":"Currently Auto/Sleep","property":"isManual","propertyType":"flow","rules":[{"t":"false"}],"checkall":"true","repair":false,"outputs":1,"x":1660,"y":580,"wires":[["f997923ba9089a0d"]]},{"id":"810aac151c120aab","type":"server-state-changed","z":"bcea52a269480ce5","name":"Air Purifier Rotation Speed","server":"9f12f038.c14df","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"number.zhimi_rma1_48c4_favorite_level","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,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":150,"y":980,"wires":[["2399a72ad0f492c5"]]},{"id":"2399a72ad0f492c5","type":"function","z":"bcea52a269480ce5","name":"Set Rotation Speed","func":"flow.set(\"RotationSpeed\", parseInt(`${msg.payload}`) + 1);\nmsg.payload = {\n    \"RotationSpeed\": parseInt(`${msg.payload}`) + 1\n};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":490,"y":980,"wires":[["c18c9a52aab597e9"]]},{"id":"efd20cb5ddf3404c","type":"change","z":"bcea52a269480ce5","name":"On","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"Active\":1,\"CurrentAirPurifierState\":2}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":820,"wires":[["c18c9a52aab597e9"]]},{"id":"2a7bdffdeb47d853","type":"change","z":"bcea52a269480ce5","name":"Off","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"Active\":0,\"CurrentAirPurifierState\":0}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":900,"wires":[["c18c9a52aab597e9"]]},{"id":"055619c28debc9cf","type":"switch","z":"bcea52a269480ce5","name":"Speed","property":"payload.RotationSpeed","propertyType":"msg","rules":[{"t":"neq","v":"RotationSpeed","vt":"flow"}],"checkall":"true","repair":false,"outputs":1,"x":1410,"y":980,"wires":[["5695530444198331"]]},{"id":"94212df5570387e4","type":"api-call-service","z":"bcea52a269480ce5","name":"Set Rotation Speed","server":"9f12f038.c14df","version":5,"debugenabled":false,"domain":"number","service":"set_value","areaId":[],"deviceId":[],"entityId":["number.zhimi_rma1_48c4_favorite_level"],"data":"{\"value\": payload}","dataType":"jsonata","mergeContext":"","mustacheAltTags":true,"outputProperties":[],"queue":"none","x":1910,"y":980,"wires":[[]]},{"id":"2c561c84b01de726","type":"switch","z":"bcea52a269480ce5","name":"Shunt","property":"payload","propertyType":"msg","rules":[{"t":"hask","v":"TargetAirPurifierState","vt":"str"},{"t":"hask","v":"LockPhysicalControls","vt":"str"},{"t":"hask","v":"Active","vt":"str"},{"t":"hask","v":"RotationSpeed","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":1190,"y":780,"wires":[["6013102806aba494"],["5dab20df02cb7978"],["461a2a447661f701"],["055619c28debc9cf"]]},{"id":"5695530444198331","type":"function","z":"bcea52a269480ce5","name":"Set Rotation Speed","func":"msg.payload = parseInt(`${msg.payload.RotationSpeed}`) - 1;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1650,"y":980,"wires":[["94212df5570387e4"]]},{"id":"3ba6fccebeea6704","type":"api-call-service","z":"bcea52a269480ce5","name":"Turn On","server":"9f12f038.c14df","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.zhimi_rma1_48c4_switch_status"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1880,"y":820,"wires":[[]]},{"id":"461a2a447661f701","type":"switch","z":"bcea52a269480ce5","name":"Power","property":"payload.Active","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"0","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1410,"y":860,"wires":[["1d90bb562e94fc06"],["81f2f777a785dac2"]]},{"id":"21b39fd057141a1c","type":"api-call-service","z":"bcea52a269480ce5","name":"Turn Off","server":"9f12f038.c14df","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.zhimi_rma1_48c4_switch_status"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1880,"y":900,"wires":[[]]},{"id":"81f2f777a785dac2","type":"api-current-state","z":"bcea52a269480ce5","name":"Currently On","server":"9f12f038.c14df","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.zhimi_rma1_48c4_switch_status","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1630,"y":900,"wires":[["21b39fd057141a1c"],[]]},{"id":"1d90bb562e94fc06","type":"api-current-state","z":"bcea52a269480ce5","name":"Currently Off","server":"9f12f038.c14df","version":3,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.zhimi_rma1_48c4_switch_status","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1630,"y":820,"wires":[["3ba6fccebeea6704"],[]]},{"id":"a126fb56a8df4b70","type":"homekit-service","z":"bcea52a269480ce5","isParent":false,"hostType":"0","bridge":"","accessoryId":"","parentService":"4bbc93931ee830c1","name":"Air Purifier Air Quality","serviceName":"AirQualitySensor","topic":"","filter":false,"manufacturer":"NRCHKB","model":"1.5.0","serialNo":"Default Serial Number","firmwareRev":"1.5.0","hardwareRev":"1.5.0","softwareRev":"1.5.0","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":1280,"cameraConfigMaxHeight":720,"cameraConfigMaxFPS":10,"cameraConfigMaxBitrate":300,"cameraConfigVideoCodec":"libx264","cameraConfigAudioCodec":"libfdk_aac","cameraConfigAudio":false,"cameraConfigPacketSize":1316,"cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"scale=1280:720","cameraConfigAdditionalCommandLine":"-tune zerolatency","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{\"AirQuality\":true,\"PM2_5Density\":true}","waitForSetupMsg":false,"outputs":2,"x":1000,"y":1060,"wires":[[],[]]},{"id":"cc06c5c2ade8232a","type":"function","z":"bcea52a269480ce5","name":"Set Air Quality","func":"var PM2_5Density = parseInt(`${msg.payload}`);\nvar AirQuality = 0;\nif (PM2_5Density < 0) {\n    AirQuality = 0;\n} else if (PM2_5Density <= 35) {\n    AirQuality = 1;\n} else if (PM2_5Density <= 53) {\n    AirQuality = 2;\n} else if (PM2_5Density <= 70) {\n    AirQuality = 3;\n} else if (PM2_5Density <= 150) {\n    AirQuality = 4;\n} else {\n    AirQuality = 5;\n}\n\nmsg.payload = {\n    \"PM2_5Density\": PM2_5Density,\n    \"AirQuality\": AirQuality\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":1060,"wires":[["a126fb56a8df4b70","c18c9a52aab597e9"]]},{"id":"4084e9bad25a556c","type":"function","z":"bcea52a269480ce5","name":"Set Humidity","func":"msg.payload = {\n    \"CurrentRelativeHumidity\": parseFloat(`${msg.payload}`)\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":470,"y":1140,"wires":[["2e67d942f62cd433","c18c9a52aab597e9"]]},{"id":"2e67d942f62cd433","type":"homekit-service","z":"bcea52a269480ce5","isParent":false,"hostType":"0","bridge":"","accessoryId":"","parentService":"4bbc93931ee830c1","name":"Air Purifier Humidity","serviceName":"HumiditySensor","topic":"","filter":false,"manufacturer":"NRCHKB","model":"1.5.0","serialNo":"Default Serial Number","firmwareRev":"1.5.0","hardwareRev":"1.5.0","softwareRev":"1.5.0","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":1280,"cameraConfigMaxHeight":720,"cameraConfigMaxFPS":10,"cameraConfigMaxBitrate":300,"cameraConfigVideoCodec":"libx264","cameraConfigAudioCodec":"libfdk_aac","cameraConfigAudio":false,"cameraConfigPacketSize":1316,"cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"scale=1280:720","cameraConfigAdditionalCommandLine":"-tune zerolatency","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{\"CurrentRelativeHumidity\":true}","waitForSetupMsg":false,"outputs":2,"x":1000,"y":1140,"wires":[[],[]]},{"id":"f0d7ae948e9aac5c","type":"function","z":"bcea52a269480ce5","name":"Set Temperature","func":"msg.payload = {\n    \"CurrentTemperature\": parseFloat(`${msg.payload}`)\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":1220,"wires":[["de170dc03b72cceb","c18c9a52aab597e9"]]},{"id":"de170dc03b72cceb","type":"homekit-service","z":"bcea52a269480ce5","isParent":false,"hostType":"0","bridge":"","accessoryId":"","parentService":"4bbc93931ee830c1","name":"Air Purifier Temperature","serviceName":"TemperatureSensor","topic":"","filter":false,"manufacturer":"NRCHKB","model":"1.5.0","serialNo":"Default Serial Number","firmwareRev":"1.5.0","hardwareRev":"1.5.0","softwareRev":"1.5.0","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":1280,"cameraConfigMaxHeight":720,"cameraConfigMaxFPS":10,"cameraConfigMaxBitrate":300,"cameraConfigVideoCodec":"libx264","cameraConfigAudioCodec":"libfdk_aac","cameraConfigAudio":false,"cameraConfigPacketSize":1316,"cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"scale=1280:720","cameraConfigAdditionalCommandLine":"-tune zerolatency","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{\"CurrentTemperature\":true}","waitForSetupMsg":false,"outputs":2,"x":1010,"y":1220,"wires":[[],[]]},{"id":"0fccc25c03fd0eb5","type":"function","z":"bcea52a269480ce5","name":"Set Filter Status","func":"var FilterLifeLevel = parseInt(`${msg.payload}`);\nmsg.payload = {\n    \"FilterLifeLevel\": FilterLifeLevel,\n    \"FilterChangeIndication\": FilterLifeLevel < 10\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":1300,"wires":[["443d431871d84072","c18c9a52aab597e9"]]},{"id":"443d431871d84072","type":"homekit-service","z":"bcea52a269480ce5","isParent":false,"hostType":"0","bridge":"","accessoryId":"","parentService":"4bbc93931ee830c1","name":"Air Purifier Filter","serviceName":"FilterMaintenance","topic":"","filter":false,"manufacturer":"NRCHKB","model":"1.5.0","serialNo":"Default Serial Number","firmwareRev":"1.5.0","hardwareRev":"1.5.0","softwareRev":"1.5.0","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":1280,"cameraConfigMaxHeight":720,"cameraConfigMaxFPS":10,"cameraConfigMaxBitrate":300,"cameraConfigVideoCodec":"libx264","cameraConfigAudioCodec":"libfdk_aac","cameraConfigAudio":false,"cameraConfigPacketSize":1316,"cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"scale=1280:720","cameraConfigAdditionalCommandLine":"-tune zerolatency","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{\"FilterLifeLevel\":true,\"FilterChangeIndication\":true}","waitForSetupMsg":false,"outputs":2,"x":980,"y":1300,"wires":[[],[]]},{"id":"75417bae9c1ab6d0","type":"api-call-service","z":"bcea52a269480ce5","name":"Set Sleep Mode","server":"9f12f038.c14df","version":5,"debugenabled":false,"domain":"fan","service":"set_preset_mode","areaId":[],"deviceId":[],"entityId":["fan.zhimi_rma1_48c4_air_purifier"],"data":"{\"preset_mode\":\"Sleep\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":2160,"y":460,"wires":[[]]},{"id":"34842f9dd82ac478","type":"api-call-service","z":"bcea52a269480ce5","name":"Set Auto Mode","server":"9f12f038.c14df","version":5,"debugenabled":false,"domain":"fan","service":"set_preset_mode","areaId":[],"deviceId":[],"entityId":["fan.zhimi_rma1_48c4_air_purifier"],"data":"{\"preset_mode\":\"Auto\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":2160,"y":540,"wires":[[]]},{"id":"abd5f28eff0941c8","type":"switch","z":"bcea52a269480ce5","name":"Currently Set Sleep?","property":"isSleep","propertyType":"flow","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":1920,"y":500,"wires":[["75417bae9c1ab6d0"],["34842f9dd82ac478"]]},{"id":"a50ba1e5c770d7c6","type":"debug","z":"bcea52a269480ce5","name":"Debug Node","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":170,"y":460,"wires":[]},{"id":"9f12f038.c14df","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true},{"id":"ecdb703c13e87f1b","type":"homekit-bridge","z":"bcea52a269480ce5","bridgeName":"Air Purifier","pinCode":"320-01-253","port":"","advertiser":"bonjour-hap","allowInsecureRequest":false,"manufacturer":"NRCHKB","model":"1.5.0","serialNo":"Default Serial Number","firmwareRev":"1.5.0","hardwareRev":"1.5.0","softwareRev":"1.5.0","customMdnsConfig":false,"mdnsMulticast":true,"mdnsInterface":"","mdnsPort":"","mdnsIp":"","mdnsTtl":"","mdnsLoopback":true,"mdnsReuseAddr":true,"allowMessagePassthrough":true}]
GogoVega commented 1 year ago

Hi, If I don't talk nonsense, the difference between adding a characteristic and adding a linked node is that in the first case there will be only one accessory whereas the linked method proposes one accessory per node. The problem with the first is that it works but can bug if you add too many characteristics, in fact you have to keep consistency with a real device.

I tested your flow and works correctly, if I understood your problem correctly, you just have to remove your Air Purifier Panel node (I don't know what it's for), remove the additional characteristics (humidity, temperature...) of your Air Purify node and linked the children to the Air Purifier node. Below are screenshots of my import of your flow.

You can choose to unbundle your accessories.

I believe however that your problem is related to the additional characteristics you added in the Air Purifier node, if you add them to this node and you create linked nodes, you will double services.

When I add the accessory: IMG_3086

In the Accessories tab: IMG_3087

SongzhouYang commented 1 year ago

Hi @GogoVega,

If I understand correctly, you mean that I should remove the manual setting for sensor nodes (Filter, for example), and remove its true attribute in the AirPurifier node. Instead, It should be linked to the AirPurifier node.

This is actually the first scene I mentioned (the first picture). The attributes such as filter maintenance, humidity and temperature will be displayed on the title, not in the main interface, and can only be accessed through Accessories. Furthermore, it should be noted that there is no impact on the final outcome based on whether the corresponding true attribute is set or not.

IMG_2883

But referring to this discussion, if the sensor node is connected to the purifier in Linked mode, it should also be displayed in the main UI. That's what I expect.

FYI: The panel is utilized for organizing various switches, such as Sleep mode and Alarm, to streamline the AirPurifier’s panel and give it a clean appearance. I only link the sensor node to it to avoid reporting warning, but it doesn't really matter whether I link it or not.

Here is the test flow of the image outlined above (added true attribute for humidity as comparison):

[{"id":"715a08872a19bfab","type":"tab","label":"Test","disabled":false,"info":"","env":[]},{"id":"183cbe65c08788b3","type":"server-state-changed","z":"715a08872a19bfab","name":"Air Purifier Child Lock","server":"9f12f038.c14df","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"switch.zhimi_rma1_48c4_physical_control_locked","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":180,"y":740,"wires":[["d0ca0a837b4dac96"],["135cb2a59ae4e868"]]},{"id":"d0ca0a837b4dac96","type":"change","z":"715a08872a19bfab","name":"On","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"LockPhysicalControls\":1}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":700,"wires":[["05d1fb051adaf788"]]},{"id":"135cb2a59ae4e868","type":"change","z":"715a08872a19bfab","name":"Off","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"LockPhysicalControls\":0}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":780,"wires":[["05d1fb051adaf788"]]},{"id":"05d1fb051adaf788","type":"homekit-service","z":"715a08872a19bfab","isParent":true,"hostType":"0","bridge":"afae5d430989f1ee","accessoryId":"","parentService":"","name":"Air Purifier","serviceName":"AirPurifier","topic":"","filter":false,"manufacturer":"Xiaomi","model":"zhimi.airpurifier.rma1","serialNo":"zhimi.airpurifier.rma1","firmwareRev":"1.0.0","hardwareRev":"1.0.0","softwareRev":"1.0.0","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":1280,"cameraConfigMaxHeight":720,"cameraConfigMaxFPS":10,"cameraConfigMaxBitrate":300,"cameraConfigVideoCodec":"libx264","cameraConfigAudioCodec":"libfdk_aac","cameraConfigAudio":false,"cameraConfigPacketSize":1316,"cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"scale=1280:720","cameraConfigAdditionalCommandLine":"-tune zerolatency","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{\"LockPhysicalControls\":true,\"RotationSpeed\":{\"minValue\":1,\"maxValue\":15,\"minStep\":1},\"SwingMode\":true,\"TargetAirPurifierState\":{\"minValue\":0,\"maxValue\":2,\"minStep\":1,\"validValues\":[0,1,2]},\"CurrentRelativeHumidity\":true}","waitForSetupMsg":false,"outputs":2,"x":990,"y":820,"wires":[[],["a98adc641d23a63d"]]},{"id":"9f4fb98d537ae58a","type":"api-call-service","z":"715a08872a19bfab","name":"Lock","server":"9f12f038.c14df","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.zhimi_rma1_48c4_physical_control_locked"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1890,"y":700,"wires":[[]]},{"id":"bcd62733e7592b73","type":"switch","z":"715a08872a19bfab","name":"Lock","property":"payload.LockPhysicalControls","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"0","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1430,"y":740,"wires":[["f69f2bc6ac16bc96"],["cf696bc631f88163"]]},{"id":"494852cd164c9932","type":"api-call-service","z":"715a08872a19bfab","name":"Unlock","server":"9f12f038.c14df","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.zhimi_rma1_48c4_physical_control_locked"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1900,"y":780,"wires":[[]]},{"id":"cf696bc631f88163","type":"api-current-state","z":"715a08872a19bfab","name":"Currently Locked","server":"9f12f038.c14df","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.zhimi_rma1_48c4_physical_control_locked","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1670,"y":780,"wires":[["494852cd164c9932"],[]]},{"id":"f69f2bc6ac16bc96","type":"api-current-state","z":"715a08872a19bfab","name":"Currently Unlocked","server":"9f12f038.c14df","version":3,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.zhimi_rma1_48c4_physical_control_locked","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1670,"y":700,"wires":[["9f4fb98d537ae58a"],[]]},{"id":"fdaa1dfd4fd23a22","type":"server-state-changed","z":"715a08872a19bfab","name":"Air Purifier Alarm","server":"9f12f038.c14df","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"switch.zhimi_rma1_48c4_alarm","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":200,"y":1460,"wires":[["6a953f3bc44f4839"],["b6f00ad2424ebc0a"]]},{"id":"6a953f3bc44f4839","type":"change","z":"715a08872a19bfab","name":"On","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"On\":true}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":1420,"wires":[["6e72aeaf169ecbef"]]},{"id":"b6f00ad2424ebc0a","type":"change","z":"715a08872a19bfab","name":"Off","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"On\":false}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":1500,"wires":[["6e72aeaf169ecbef"]]},{"id":"6310017102415e2f","type":"api-call-service","z":"715a08872a19bfab","name":"Turn On","server":"9f12f038.c14df","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.zhimi_rma1_48c4_alarm"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1900,"y":1420,"wires":[[]]},{"id":"21a5d9f040fc91fd","type":"switch","z":"715a08872a19bfab","name":"Alarm Status","property":"payload.On","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":1450,"y":1460,"wires":[["35cd46ce5eaae2c3"],["6e9caacec4343a22"]]},{"id":"28d38ea44a7903c5","type":"api-call-service","z":"715a08872a19bfab","name":"Turn Off","server":"9f12f038.c14df","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.zhimi_rma1_48c4_alarm"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1900,"y":1500,"wires":[[]]},{"id":"6e9caacec4343a22","type":"api-current-state","z":"715a08872a19bfab","name":"Currently On","server":"9f12f038.c14df","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.zhimi_rma1_48c4_alarm","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1650,"y":1500,"wires":[["28d38ea44a7903c5"],[]]},{"id":"35cd46ce5eaae2c3","type":"api-current-state","z":"715a08872a19bfab","name":"Currently Off","server":"9f12f038.c14df","version":3,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.zhimi_rma1_48c4_alarm","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1650,"y":1420,"wires":[["6310017102415e2f"],[]]},{"id":"6e72aeaf169ecbef","type":"homekit-service","z":"715a08872a19bfab","isParent":false,"hostType":"0","bridge":"","accessoryId":"","parentService":"4bbc93931ee830c1","name":"Air Purifier Alarm","serviceName":"Switch","topic":"Sound","filter":false,"manufacturer":"NRCHKB","model":"1.5.0","serialNo":"Default Serial Number","firmwareRev":"1.5.0","hardwareRev":"1.5.0","softwareRev":"1.5.0","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":1280,"cameraConfigMaxHeight":720,"cameraConfigMaxFPS":10,"cameraConfigMaxBitrate":300,"cameraConfigVideoCodec":"libx264","cameraConfigAudioCodec":"libfdk_aac","cameraConfigAudio":false,"cameraConfigPacketSize":1316,"cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"scale=1280:720","cameraConfigAdditionalCommandLine":"-tune zerolatency","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{}","waitForSetupMsg":false,"outputs":2,"x":1010,"y":1460,"wires":[[],["21a5d9f040fc91fd"]]},{"id":"b1d09904fa2f82d0","type":"server-state-changed","z":"715a08872a19bfab","name":"Air Purifier Main","server":"9f12f038.c14df","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"fan.zhimi_rma1_48c4_air_purifier","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":false,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":200,"y":580,"wires":[["c010a4b49757607f"]]},{"id":"840fc0d1ab801a86","type":"server-state-changed","z":"715a08872a19bfab","name":"Air Purifier Power","server":"9f12f038.c14df","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"switch.zhimi_rma1_48c4_switch_status","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":200,"y":900,"wires":[["94b6163719ce6d21"],["7785b31ffab75f83"]]},{"id":"a3d62476f883932c","type":"server-state-changed","z":"715a08872a19bfab","name":"Air Purifier Humidity","server":"9f12f038.c14df","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.zhimi_rma1_48c4_relative_humidity","entityidfiltertype":"exact","outputinitially":true,"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,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":190,"y":1180,"wires":[["501bed72c1b02b0e"]]},{"id":"73396a81d8af32a3","type":"server-state-changed","z":"715a08872a19bfab","name":"Air Purifier Temperature","server":"9f12f038.c14df","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.zhimi_rma1_48c4_temperature","entityidfiltertype":"exact","outputinitially":true,"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,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":180,"y":1260,"wires":[["604fae4676713ffa"]]},{"id":"69d53a7390718cab","type":"server-state-changed","z":"715a08872a19bfab","name":"Air Purifier Air Quality","server":"9f12f038.c14df","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.zhimi_rma1_48c4_pm25_density","entityidfiltertype":"exact","outputinitially":true,"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,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":180,"y":1100,"wires":[["7af007e6d8eb0171"]]},{"id":"af37209dcffd30e7","type":"server-state-changed","z":"715a08872a19bfab","name":"Air Purifier Filter Status","server":"9f12f038.c14df","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.zhimi_rma1_48c4_filter_life_level","entityidfiltertype":"exact","outputinitially":true,"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,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":180,"y":1340,"wires":[["455ad0a6ff93e81a"]]},{"id":"c010a4b49757607f","type":"switch","z":"715a08872a19bfab","name":"Mode Control","property":"data.new_state.attributes.preset_mode","propertyType":"msg","rules":[{"t":"eq","v":"Auto","vt":"str"},{"t":"eq","v":"Sleep","vt":"str"},{"t":"eq","v":"Favorite","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":500,"y":580,"wires":[["4392a1245a6d723b","3381221559c8f936"],["85a57944cd4b8cf9","4392a1245a6d723b"],["f22e2b1325f09c04"]]},{"id":"4392a1245a6d723b","type":"change","z":"715a08872a19bfab","name":"Auto/Sleep Mode","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"TargetAirPurifierState\":1}","tot":"json"},{"t":"set","p":"isManual","pt":"flow","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":770,"y":540,"wires":[["05d1fb051adaf788"]]},{"id":"f22e2b1325f09c04","type":"change","z":"715a08872a19bfab","name":"Favorite Mode","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"TargetAirPurifierState\":0}","tot":"json"},{"t":"set","p":"isManual","pt":"flow","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":760,"y":620,"wires":[["05d1fb051adaf788"]]},{"id":"85a57944cd4b8cf9","type":"change","z":"715a08872a19bfab","name":"Sleep Mode","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"On\":true}","tot":"json"},{"t":"set","p":"isSleep","pt":"flow","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":750,"y":380,"wires":[["d0b4ea8c1326937b"]]},{"id":"3381221559c8f936","type":"change","z":"715a08872a19bfab","name":"Auto Mode","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"On\":false}","tot":"json"},{"t":"set","p":"isSleep","pt":"flow","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":750,"y":460,"wires":[["d0b4ea8c1326937b"]]},{"id":"d0b4ea8c1326937b","type":"homekit-service","z":"715a08872a19bfab","isParent":true,"hostType":"0","bridge":"afae5d430989f1ee","accessoryId":"","parentService":"c18c9a52aab597e9","name":"Air Purifier Panel","serviceName":"Switch","topic":"","filter":false,"manufacturer":"Xiaomi","model":"zhimi.airpurifier.rma1","serialNo":"zhimi.airpurifier.rma1","firmwareRev":"1.0.0","hardwareRev":"1.0.0","softwareRev":"1.0.0","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":1280,"cameraConfigMaxHeight":720,"cameraConfigMaxFPS":10,"cameraConfigMaxBitrate":300,"cameraConfigVideoCodec":"libx264","cameraConfigAudioCodec":"libfdk_aac","cameraConfigAudio":false,"cameraConfigPacketSize":1316,"cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"scale=1280:720","cameraConfigAdditionalCommandLine":"-tune zerolatency","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{}","waitForSetupMsg":false,"outputs":2,"x":1010,"y":420,"wires":[[],["3b5cf86860bddae6"]]},{"id":"9bf9f17ddcccc5d0","type":"api-call-service","z":"715a08872a19bfab","name":"Switch to Sleep Mode","server":"9f12f038.c14df","version":5,"debugenabled":false,"domain":"fan","service":"set_preset_mode","areaId":[],"deviceId":[],"entityId":["fan.zhimi_rma1_48c4_air_purifier"],"data":"{\"preset_mode\":\"Sleep\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1940,"y":380,"wires":[[]]},{"id":"3b5cf86860bddae6","type":"switch","z":"715a08872a19bfab","name":"Sleep","property":"payload.On","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":1430,"y":420,"wires":[["927c0e826e53ef2e"],["86c38bdecedc5694"]]},{"id":"44311b8422c9d03d","type":"api-call-service","z":"715a08872a19bfab","name":"Switch to Auto Mode","server":"9f12f038.c14df","version":5,"debugenabled":false,"domain":"fan","service":"set_preset_mode","areaId":[],"deviceId":[],"entityId":["fan.zhimi_rma1_48c4_air_purifier"],"data":"{\"preset_mode\":\"Auto\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1940,"y":460,"wires":[[]]},{"id":"927c0e826e53ef2e","type":"switch","z":"715a08872a19bfab","name":"Current Auto Mode","property":"isSleep","propertyType":"flow","rules":[{"t":"false"}],"checkall":"true","repair":false,"outputs":1,"x":1670,"y":380,"wires":[["9bf9f17ddcccc5d0"]]},{"id":"86c38bdecedc5694","type":"switch","z":"715a08872a19bfab","name":"Current Sleep Mode","property":"isSleep","propertyType":"flow","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":1680,"y":460,"wires":[["44311b8422c9d03d"]]},{"id":"1253f12ed55e4f66","type":"switch","z":"715a08872a19bfab","name":"Mode","property":"payload.TargetAirPurifierState","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"0","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1430,"y":580,"wires":[["c5eee4b30e4fbddf"],["d090e0a4c6d88c07"]]},{"id":"3d7ddb4c32fe39a9","type":"api-call-service","z":"715a08872a19bfab","name":"Turn Manual","server":"9f12f038.c14df","version":5,"debugenabled":false,"domain":"fan","service":"set_preset_mode","areaId":[],"deviceId":[],"entityId":["fan.zhimi_rma1_48c4_air_purifier"],"data":"{\"preset_mode\":\"Favorite\"}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1910,"y":620,"wires":[[]]},{"id":"c5eee4b30e4fbddf","type":"switch","z":"715a08872a19bfab","name":"Currently Manual","property":"isManual","propertyType":"flow","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":1670,"y":540,"wires":[["1b536a2bb00fd4f1"]]},{"id":"d090e0a4c6d88c07","type":"switch","z":"715a08872a19bfab","name":"Currently Auto/Sleep","property":"isManual","propertyType":"flow","rules":[{"t":"false"}],"checkall":"true","repair":false,"outputs":1,"x":1680,"y":620,"wires":[["3d7ddb4c32fe39a9"]]},{"id":"e749bd3216acf5c2","type":"server-state-changed","z":"715a08872a19bfab","name":"Air Purifier Rotation Speed","server":"9f12f038.c14df","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"number.zhimi_rma1_48c4_favorite_level","entityidfiltertype":"exact","outputinitially":true,"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,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":170,"y":1020,"wires":[["27d3c05a2982f3e9"]]},{"id":"27d3c05a2982f3e9","type":"function","z":"715a08872a19bfab","name":"Set Rotation Speed","func":"flow.set(\"RotationSpeed\", parseInt(`${msg.payload}`) + 1);\nmsg.payload = {\n    \"RotationSpeed\": parseInt(`${msg.payload}`) + 1\n};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":510,"y":1020,"wires":[["05d1fb051adaf788"]]},{"id":"94b6163719ce6d21","type":"change","z":"715a08872a19bfab","name":"On","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"Active\":1,\"CurrentAirPurifierState\":2}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":860,"wires":[["05d1fb051adaf788"]]},{"id":"7785b31ffab75f83","type":"change","z":"715a08872a19bfab","name":"Off","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"Active\":0,\"CurrentAirPurifierState\":0}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":940,"wires":[["05d1fb051adaf788"]]},{"id":"c2ee5f06c1e5280e","type":"switch","z":"715a08872a19bfab","name":"Speed","property":"payload.RotationSpeed","propertyType":"msg","rules":[{"t":"neq","v":"RotationSpeed","vt":"flow"}],"checkall":"true","repair":false,"outputs":1,"x":1430,"y":1020,"wires":[["60509633bfa31f6d"]]},{"id":"9c0a68bddac67e60","type":"api-call-service","z":"715a08872a19bfab","name":"Set Rotation Speed","server":"9f12f038.c14df","version":5,"debugenabled":false,"domain":"number","service":"set_value","areaId":[],"deviceId":[],"entityId":["number.zhimi_rma1_48c4_favorite_level"],"data":"{\"value\": payload}","dataType":"jsonata","mergeContext":"","mustacheAltTags":true,"outputProperties":[],"queue":"none","x":1930,"y":1020,"wires":[[]]},{"id":"a98adc641d23a63d","type":"switch","z":"715a08872a19bfab","name":"Shunt","property":"payload","propertyType":"msg","rules":[{"t":"hask","v":"TargetAirPurifierState","vt":"str"},{"t":"hask","v":"LockPhysicalControls","vt":"str"},{"t":"hask","v":"Active","vt":"str"},{"t":"hask","v":"RotationSpeed","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":1210,"y":820,"wires":[["1253f12ed55e4f66"],["bcd62733e7592b73"],["1043aea1a3611c9e"],["c2ee5f06c1e5280e"]]},{"id":"60509633bfa31f6d","type":"function","z":"715a08872a19bfab","name":"Set Rotation Speed","func":"msg.payload = parseInt(`${msg.payload.RotationSpeed}`) - 1;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1670,"y":1020,"wires":[["9c0a68bddac67e60"]]},{"id":"7a55db73f815488f","type":"api-call-service","z":"715a08872a19bfab","name":"Turn On","server":"9f12f038.c14df","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.zhimi_rma1_48c4_switch_status"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1900,"y":860,"wires":[[]]},{"id":"1043aea1a3611c9e","type":"switch","z":"715a08872a19bfab","name":"Power","property":"payload.Active","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"0","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1430,"y":900,"wires":[["84e2a90146e97d38"],["23e8da2795b6f78e"]]},{"id":"b97bd36fee56569f","type":"api-call-service","z":"715a08872a19bfab","name":"Turn Off","server":"9f12f038.c14df","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.zhimi_rma1_48c4_switch_status"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1900,"y":940,"wires":[[]]},{"id":"23e8da2795b6f78e","type":"api-current-state","z":"715a08872a19bfab","name":"Currently On","server":"9f12f038.c14df","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.zhimi_rma1_48c4_switch_status","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1650,"y":940,"wires":[["b97bd36fee56569f"],[]]},{"id":"84e2a90146e97d38","type":"api-current-state","z":"715a08872a19bfab","name":"Currently Off","server":"9f12f038.c14df","version":3,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.zhimi_rma1_48c4_switch_status","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":1650,"y":860,"wires":[["7a55db73f815488f"],[]]},{"id":"cc2f8dbda894441a","type":"homekit-service","z":"715a08872a19bfab","isParent":false,"hostType":"0","bridge":"","accessoryId":"","parentService":"05d1fb051adaf788","name":"Air Purifier Air Quality","serviceName":"AirQualitySensor","topic":"","filter":false,"manufacturer":"NRCHKB","model":"1.5.0","serialNo":"Default Serial Number","firmwareRev":"1.5.0","hardwareRev":"1.5.0","softwareRev":"1.5.0","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":1280,"cameraConfigMaxHeight":720,"cameraConfigMaxFPS":10,"cameraConfigMaxBitrate":300,"cameraConfigVideoCodec":"libx264","cameraConfigAudioCodec":"libfdk_aac","cameraConfigAudio":false,"cameraConfigPacketSize":1316,"cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"scale=1280:720","cameraConfigAdditionalCommandLine":"-tune zerolatency","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{\"AirQuality\":true,\"PM2_5Density\":true}","waitForSetupMsg":false,"outputs":2,"x":1020,"y":1100,"wires":[[],[]]},{"id":"7af007e6d8eb0171","type":"function","z":"715a08872a19bfab","name":"Set Air Quality","func":"var PM2_5Density = parseInt(`${msg.payload}`);\nvar AirQuality = 0;\nif (PM2_5Density < 0) {\n    AirQuality = 0;\n} else if (PM2_5Density <= 35) {\n    AirQuality = 1;\n} else if (PM2_5Density <= 53) {\n    AirQuality = 2;\n} else if (PM2_5Density <= 70) {\n    AirQuality = 3;\n} else if (PM2_5Density <= 150) {\n    AirQuality = 4;\n} else {\n    AirQuality = 5;\n}\n\nmsg.payload = {\n    \"PM2_5Density\": PM2_5Density,\n    \"AirQuality\": AirQuality\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":500,"y":1100,"wires":[["cc2f8dbda894441a"]]},{"id":"501bed72c1b02b0e","type":"function","z":"715a08872a19bfab","name":"Set Humidity","func":"msg.payload = {\n    \"CurrentRelativeHumidity\": parseFloat(`${msg.payload}`)\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":490,"y":1180,"wires":[["0c9ba9a05651e668"]]},{"id":"0c9ba9a05651e668","type":"homekit-service","z":"715a08872a19bfab","isParent":false,"hostType":"0","bridge":"","accessoryId":"","parentService":"05d1fb051adaf788","name":"Air Purifier Humidity","serviceName":"HumiditySensor","topic":"","filter":false,"manufacturer":"NRCHKB","model":"1.5.0","serialNo":"Default Serial Number","firmwareRev":"1.5.0","hardwareRev":"1.5.0","softwareRev":"1.5.0","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":1280,"cameraConfigMaxHeight":720,"cameraConfigMaxFPS":10,"cameraConfigMaxBitrate":300,"cameraConfigVideoCodec":"libx264","cameraConfigAudioCodec":"libfdk_aac","cameraConfigAudio":false,"cameraConfigPacketSize":1316,"cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"scale=1280:720","cameraConfigAdditionalCommandLine":"-tune zerolatency","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{\"CurrentRelativeHumidity\":true}","waitForSetupMsg":false,"outputs":2,"x":1020,"y":1180,"wires":[[],[]]},{"id":"604fae4676713ffa","type":"function","z":"715a08872a19bfab","name":"Set Temperature","func":"msg.payload = {\n    \"CurrentTemperature\": parseFloat(`${msg.payload}`)\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":500,"y":1260,"wires":[["4e95cab0ef7f623c"]]},{"id":"4e95cab0ef7f623c","type":"homekit-service","z":"715a08872a19bfab","isParent":false,"hostType":"0","bridge":"","accessoryId":"","parentService":"05d1fb051adaf788","name":"Air Purifier Temperature","serviceName":"TemperatureSensor","topic":"","filter":false,"manufacturer":"NRCHKB","model":"1.5.0","serialNo":"Default Serial Number","firmwareRev":"1.5.0","hardwareRev":"1.5.0","softwareRev":"1.5.0","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":1280,"cameraConfigMaxHeight":720,"cameraConfigMaxFPS":10,"cameraConfigMaxBitrate":300,"cameraConfigVideoCodec":"libx264","cameraConfigAudioCodec":"libfdk_aac","cameraConfigAudio":false,"cameraConfigPacketSize":1316,"cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"scale=1280:720","cameraConfigAdditionalCommandLine":"-tune zerolatency","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{\"CurrentTemperature\":true}","waitForSetupMsg":false,"outputs":2,"x":1030,"y":1260,"wires":[[],[]]},{"id":"455ad0a6ff93e81a","type":"function","z":"715a08872a19bfab","name":"Set Filter Status","func":"var FilterLifeLevel = parseInt(`${msg.payload}`);\nmsg.payload = {\n    \"FilterLifeLevel\": FilterLifeLevel,\n    \"FilterChangeIndication\": FilterLifeLevel < 10\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":500,"y":1340,"wires":[["59c223ef84ced2cc"]]},{"id":"59c223ef84ced2cc","type":"homekit-service","z":"715a08872a19bfab","isParent":false,"hostType":"0","bridge":"","accessoryId":"","parentService":"05d1fb051adaf788","name":"Air Purifier Filter","serviceName":"FilterMaintenance","topic":"","filter":false,"manufacturer":"NRCHKB","model":"1.5.0","serialNo":"Default Serial Number","firmwareRev":"1.5.0","hardwareRev":"1.5.0","softwareRev":"1.5.0","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":1280,"cameraConfigMaxHeight":720,"cameraConfigMaxFPS":10,"cameraConfigMaxBitrate":300,"cameraConfigVideoCodec":"libx264","cameraConfigAudioCodec":"libfdk_aac","cameraConfigAudio":false,"cameraConfigPacketSize":1316,"cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"scale=1280:720","cameraConfigAdditionalCommandLine":"-tune zerolatency","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{\"FilterLifeLevel\":true,\"FilterChangeIndication\":true}","waitForSetupMsg":false,"outputs":2,"x":1000,"y":1340,"wires":[[],[]]},{"id":"c7688d3deed56dbe","type":"api-call-service","z":"715a08872a19bfab","name":"Set Sleep Mode","server":"9f12f038.c14df","version":5,"debugenabled":false,"domain":"fan","service":"set_preset_mode","areaId":[],"deviceId":[],"entityId":["fan.zhimi_rma1_48c4_air_purifier"],"data":"{\"preset_mode\":\"Sleep\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":2180,"y":500,"wires":[[]]},{"id":"61be908895396d61","type":"api-call-service","z":"715a08872a19bfab","name":"Set Auto Mode","server":"9f12f038.c14df","version":5,"debugenabled":false,"domain":"fan","service":"set_preset_mode","areaId":[],"deviceId":[],"entityId":["fan.zhimi_rma1_48c4_air_purifier"],"data":"{\"preset_mode\":\"Auto\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":2180,"y":580,"wires":[[]]},{"id":"1b536a2bb00fd4f1","type":"switch","z":"715a08872a19bfab","name":"Currently Set Sleep?","property":"isSleep","propertyType":"flow","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":1940,"y":540,"wires":[["c7688d3deed56dbe"],["61be908895396d61"]]},{"id":"4c544a01381c2ac3","type":"debug","z":"715a08872a19bfab","name":"Debug Node","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":190,"y":500,"wires":[]},{"id":"9f12f038.c14df","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true},{"id":"afae5d430989f1ee","type":"homekit-bridge","z":"715a08872a19bfab","bridgeName":"Test","pinCode":"600-19-015","port":"","advertiser":"bonjour-hap","allowInsecureRequest":false,"manufacturer":"NRCHKB","model":"1.5.0","serialNo":"Default Serial Number","firmwareRev":"1.5.0","hardwareRev":"1.5.0","softwareRev":"1.5.0","customMdnsConfig":false,"mdnsMulticast":true,"mdnsInterface":"","mdnsPort":"","mdnsIp":"","mdnsTtl":"","mdnsLoopback":true,"mdnsReuseAddr":true,"allowMessagePassthrough":true}]
GogoVega commented 1 year ago

Ok I see, the problem is that you cannot organize the interface of your accessory as you want. If you wish to use Air Purifier Panel as Sleep mode and Alarm you can do so provided that your other accessories (humidity, temp...) are linked to the Air Purifier service because the Switch service does not allow you to link these accessories there.

The Air Purifier service (with all your sensors linked) can be linked to the Panel but I recommend using it as Parent. If used as Linked, to access your sensors you will need to open the Panel then find Air Purifier to finally read the status of your sensors.

Note: adding a service whether with characteristic or with a linked node remains possible but depends on the added service and the linked service, the Wiki is not perfect on this point because this part (API) is managed by Apple and we have no more info. We can only test possible combinations of accessories and deduce a trend. In other words, we rely on certified accessories to understand how it works, but for the rest it's a "hack".

SongzhouYang commented 1 year ago

Thx. In fact, I don't want to add extra switches to the purifier node, but add characteristic by linked nodes.

However, it can be concluded that if you want to add characteristic to the parent node, the safest way is to manually pass in the corresponding values instead of relying on the linked sensor node. And from my own practice, relying on sensor nodes will be counterproductive.

GogoVega commented 1 year ago

Passing manually as you say depends on how you have configured your additional accessories:

Example with humidity as additional accessory: If { "CurrentRelativeHumidity": true } is defined in Air Purifier characteristic node, send humidity value to Air Purifier node. If a HumiditySensor service is linked to Air Purifier, send humidity value to this linked node.

SongzhouYang commented 1 year ago

Yes, but the fact is that the second way doesn't work, which is why I open this issue.

GogoVega commented 1 year ago

As mentioned, depending on the linked service and depending on the parent service, they don't all react the same. I'm sorry but you will have to test it one by one. The Wiki recommends method 2 because it is the least likely to bug. Checking with temperature I can already tell you that you have to use method 2 and you will have a split display (temperature will only be visible in Accessories => Temperature). Something is not allowing temperature in Air Purifier, is it Apple or HAP 🤷‍♂️

SongzhouYang commented 1 year ago

Thank you for letting me know. Since this issue cannot be addressed from NRCHKB’s side, I would prefer to use the more reliable method 1.

GogoVega commented 1 year ago

You are welcome 🙂, Me too I prefer it, I hope it will help you for your project. PS: join us on Discord if you have any other questions or need help.

SongzhouYang commented 1 year ago

All right! Thank you again for your answer. I will close this issue.