Hello. Here is my roborock vacuum door automation in node red. It opens door only when previous roborock state is docked and it close door after 35 sec. I will paste flow here but donât know if its proper way to show it.
[{"id":"778a24ba49caeda8","type":"miio-roborock-event","z":"3f0bd0edbddd9955","name":"","server":"14389417df3a3acf","outputAtStartup":true,"x":120,"y":260,"wires":[["4d511f79d6032b27","c8a3f39b750d9ce3","bdbd9bfbbf448238","ceb6a2e35c97dd29"]]},{"id":"4d511f79d6032b27","type":"function","z":"3f0bd0edbddd9955","name":"is_returning?","func":"var payload=msg.payload.key;\nif (payload == \"in_returning\") {\n msg.payload=msg.payload.value\n return msg;\n}\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":370,"y":380,"wires":[["af6aca477f571a97"]]},{"id":"c8a3f39b750d9ce3","type":"function","z":"3f0bd0edbddd9955","name":"charging","func":"var payload=msg.payload.key;\nif (payload == \"state_text\" && msg.payload.value == \"charging\") {\n msg.payload=msg.payload.value\n return msg;\n}\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":360,"y":300,"wires":[["392ab6d9e87a1777"]]},{"id":"af6aca477f571a97","type":"api-call-service","z":"3f0bd0edbddd9955","name":"VacuumDoor Open","server":"79e2662a.5e8a78","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.tasmota"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":590,"y":380,"wires":[[]]},{"id":"392ab6d9e87a1777","type":"api-call-service","z":"3f0bd0edbddd9955","name":"VacuumDoor Close","server":"79e2662a.5e8a78","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.tasmota2"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":590,"y":300,"wires":[[]]},{"id":"ceb6a2e35c97dd29","type":"function","z":"3f0bd0edbddd9955","name":"going_target","func":"const globalHomeAssistant = global.get('homeassistant');\n\nvar state1 = globalHomeAssistant.homeAssistant.states[\"vacuum.roborock_vacuum_a15\"].state;\nvar payload=msg.payload.key;\nif ((payload == \"state_text\" && msg.payload.value == \"coordinates\") && (state1 === \"docked\")) {\n msg.payload = { \"service\": \"turn_on\" }\n return msg;\n}\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":370,"y":220,"wires":[["29779f4339074b0d"]]},{"id":"a68d836993c85379","type":"trigger","z":"3f0bd0edbddd9955","name":"","op1":"","op2":"{\"service\":\"turn_on\"}","op1type":"nul","op2type":"json","duration":"35","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":790,"y":180,"wires":[["2c0af1be309305e3"]]},{"id":"2c0af1be309305e3","type":"api-call-service","z":"3f0bd0edbddd9955","name":"VacuumDoor Close","server":"79e2662a.5e8a78","version":5,"debugenabled":false,"domain":"switch","service":"","areaId":[],"deviceId":[],"entityId":["switch.tasmota2"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":990,"y":180,"wires":[[]]},{"id":"29779f4339074b0d","type":"api-call-service","z":"3f0bd0edbddd9955","name":"VacuumDoor Open","server":"79e2662a.5e8a78","version":5,"debugenabled":false,"domain":"switch","service":"","areaId":[],"deviceId":[],"entityId":["switch.tasmota"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":590,"y":180,"wires":[["a68d836993c85379"]]},{"id":"bdbd9bfbbf448238","type":"function","z":"3f0bd0edbddd9955","name":"is_cleaning?","func":"const globalHomeAssistant = global.get('homeassistant');\n\nvar state1 = globalHomeAssistant.homeAssistant.states[\"vacuum.roborock_vacuum_a15\"].state;\nvar payload=msg.payload.key;\nif ((payload == \"in_cleaning\") && (state1 === \"docked\")) {\n msg.payload = { \"service\": \"turn_on\" }\n return msg;\n}\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":370,"y":140,"wires":[["29779f4339074b0d"]]},{"id":"14389417df3a3acf","type":"miio-roborock-server","name":"Rumburak","ip":"192.168.1.202","token":"3174664d326f63623138514d68477955","polling":"10"},{"id":"79e2662a.5e8a78","type":"server","name":"Home Assistant","version":4,"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"}]