Advertisement
dykandDK

HA - NR - Vacuum Automation Examples

Oct 4th, 2020 (edited)
594
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 32.93 KB | None | 0 0
  1. [
  2.     {
  3.         "id": "967995f2.033478",
  4.         "type": "tab",
  5.         "label": "Vacuum Control",
  6.         "disabled": false,
  7.         "info": "## **Flow for automation of Xioami vacuum**\n**By Anders Lukic**\n\n---\n<br>\n\n---\n### **Functionality**\n---\n\nThis flow automates control over my S5 robot vacuum cleaner. It does the following:\n\n * Use actionable notification to ask if cleaning should start when nobody is home\n * Pause cleaning when the doorbell is pressed\n * Use actionable notification to ask to empty dustbin when the robot has cleaned 200m2 or more\n\n---\n### **Requirements**\n---\nThis flow requires the following additional configuration to work:\n\n * Definition of IOS push categories for actionable notifications\n * Definition of input booleans for room selection\n\nSee this link for example configuration definitions:\n\nhttps://pastebin.com/raw/DFrUZKe1"
  8.     },
  9.     {
  10.         "id": "674c2c16.545254",
  11.         "type": "server-events",
  12.         "z": "967995f2.033478",
  13.         "name": "IOS Action?",
  14.         "server": "3bebce79.1e0962",
  15.         "event_type": "ios.notification_action_fired",
  16.         "exposeToHomeAssistant": false,
  17.         "haConfig": [
  18.             {
  19.                 "property": "name",
  20.                 "value": ""
  21.             },
  22.             {
  23.                 "property": "icon",
  24.                 "value": ""
  25.             }
  26.         ],
  27.         "x": 90,
  28.         "y": 280,
  29.         "wires": [
  30.             [
  31.                 "448ac56c.397d4c"
  32.             ]
  33.         ]
  34.     },
  35.     {
  36.         "id": "448ac56c.397d4c",
  37.         "type": "switch",
  38.         "z": "967995f2.033478",
  39.         "name": "Time for vacuuming?",
  40.         "property": "payload.event.actionName",
  41.         "propertyType": "msg",
  42.         "rules": [
  43.             {
  44.                 "t": "eq",
  45.                 "v": "VACUUM_ASK_LATER",
  46.                 "vt": "str"
  47.             },
  48.             {
  49.                 "t": "eq",
  50.                 "v": "VACUUM_FULL_CLEAN",
  51.                 "vt": "str"
  52.             },
  53.             {
  54.                 "t": "eq",
  55.                 "v": "VACUUM_ROOM_CLEAN",
  56.                 "vt": "str"
  57.             },
  58.             {
  59.                 "t": "eq",
  60.                 "v": "VACUUM_POSTPONE",
  61.                 "vt": "str"
  62.             }
  63.         ],
  64.         "checkall": "false",
  65.         "repair": false,
  66.         "outputs": 4,
  67.         "x": 280,
  68.         "y": 280,
  69.         "wires": [
  70.             [
  71.                 "6aa3e92f.656be8"
  72.             ],
  73.             [
  74.                 "198ee6b5.4e85a9"
  75.             ],
  76.             [
  77.                 "a8f42787.5a4068"
  78.             ],
  79.             []
  80.         ],
  81.         "outputLabels": [
  82.             "Remind me later (in 15 mins)",
  83.             "Clean entire house",
  84.             "Clean selected rooms only",
  85.             "Postpone cleaning (do nothing"
  86.         ]
  87.     },
  88.     {
  89.         "id": "730084a.e6b177c",
  90.         "type": "comment",
  91.         "z": "967995f2.033478",
  92.         "name": "Ask to start vacuum when away",
  93.         "info": "",
  94.         "x": 150,
  95.         "y": 120,
  96.         "wires": []
  97.     },
  98.     {
  99.         "id": "198ee6b5.4e85a9",
  100.         "type": "api-call-service",
  101.         "z": "967995f2.033478",
  102.         "name": "Start full clean",
  103.         "server": "3bebce79.1e0962",
  104.         "version": 1,
  105.         "debugenabled": false,
  106.         "service_domain": "vacuum",
  107.         "service": "start",
  108.         "entityId": "vacuum.xiaomi_vacuum_cleaner",
  109.         "data": "",
  110.         "dataType": "json",
  111.         "mergecontext": "",
  112.         "output_location": "payload",
  113.         "output_location_type": "msg",
  114.         "mustacheAltTags": false,
  115.         "x": 500,
  116.         "y": 260,
  117.         "wires": [
  118.             []
  119.         ]
  120.     },
  121.     {
  122.         "id": "72fb6ed9.18238",
  123.         "type": "json",
  124.         "z": "967995f2.033478",
  125.         "name": "Format as JSON",
  126.         "property": "payload",
  127.         "action": "",
  128.         "pretty": false,
  129.         "x": 1110,
  130.         "y": 300,
  131.         "wires": [
  132.             [
  133.                 "b4d3b4d0.6ef6c8"
  134.             ]
  135.         ]
  136.     },
  137.     {
  138.         "id": "a8f42787.5a4068",
  139.         "type": "ha-get-entities",
  140.         "z": "967995f2.033478",
  141.         "server": "3bebce79.1e0962",
  142.         "name": "Get selected rooms",
  143.         "rules": [
  144.             {
  145.                 "property": "entity_id",
  146.                 "logic": "starts_with",
  147.                 "value": "input_boolean.clean_room",
  148.                 "valueType": "str"
  149.             },
  150.             {
  151.                 "property": "state",
  152.                 "logic": "is",
  153.                 "value": "on",
  154.                 "valueType": "str"
  155.             }
  156.         ],
  157.         "output_type": "split",
  158.         "output_empty_results": false,
  159.         "output_location_type": "msg",
  160.         "output_location": "payload",
  161.         "output_results_count": 1,
  162.         "x": 510,
  163.         "y": 300,
  164.         "wires": [
  165.             [
  166.                 "4741293b.54d968",
  167.                 "7524e6b5.738128"
  168.             ]
  169.         ]
  170.     },
  171.     {
  172.         "id": "4741293b.54d968",
  173.         "type": "change",
  174.         "z": "967995f2.033478",
  175.         "name": "Get room IDs only",
  176.         "rules": [
  177.             {
  178.                 "t": "set",
  179.                 "p": "payload",
  180.                 "pt": "msg",
  181.                 "to": "payload.entity_id",
  182.                 "tot": "msg"
  183.             },
  184.             {
  185.                 "t": "change",
  186.                 "p": "payload",
  187.                 "pt": "msg",
  188.                 "from": "input_boolean.clean_room_",
  189.                 "fromt": "str",
  190.                 "to": "",
  191.                 "tot": "str"
  192.             }
  193.         ],
  194.         "action": "",
  195.         "property": "",
  196.         "from": "",
  197.         "to": "",
  198.         "reg": false,
  199.         "x": 710,
  200.         "y": 300,
  201.         "wires": [
  202.             [
  203.                 "9b8316e8.d15c18"
  204.             ]
  205.         ]
  206.     },
  207.     {
  208.         "id": "9b8316e8.d15c18",
  209.         "type": "join",
  210.         "z": "967995f2.033478",
  211.         "name": "Combine to array",
  212.         "mode": "auto",
  213.         "build": "object",
  214.         "property": "payload",
  215.         "propertyType": "msg",
  216.         "key": "",
  217.         "joiner": ",",
  218.         "joinerType": "str",
  219.         "accumulate": false,
  220.         "timeout": "",
  221.         "count": "",
  222.         "reduceRight": false,
  223.         "reduceExp": "",
  224.         "reduceInit": "",
  225.         "reduceInitType": "",
  226.         "reduceFixup": "",
  227.         "x": 910,
  228.         "y": 300,
  229.         "wires": [
  230.             [
  231.                 "72fb6ed9.18238"
  232.             ]
  233.         ]
  234.     },
  235.     {
  236.         "id": "b4d3b4d0.6ef6c8",
  237.         "type": "api-call-service",
  238.         "z": "967995f2.033478",
  239.         "name": "Start room cleaning",
  240.         "server": "3bebce79.1e0962",
  241.         "version": 1,
  242.         "debugenabled": false,
  243.         "service_domain": "vacuum",
  244.         "service": "send_command",
  245.         "entityId": "vacuum.xiaomi_vacuum_cleaner",
  246.         "data": "{    \"command\": \"app_segment_clean\",    \"params\": [{{payload}}]}",
  247.         "dataType": "json",
  248.         "mergecontext": "",
  249.         "output_location": "payload",
  250.         "output_location_type": "msg",
  251.         "mustacheAltTags": false,
  252.         "x": 1310,
  253.         "y": 300,
  254.         "wires": [
  255.             []
  256.         ]
  257.     },
  258.     {
  259.         "id": "7524e6b5.738128",
  260.         "type": "template",
  261.         "z": "967995f2.033478",
  262.         "name": "Entity names",
  263.         "field": "payload",
  264.         "fieldType": "msg",
  265.         "format": "handlebars",
  266.         "syntax": "mustache",
  267.         "template": "{{payload.attributes.friendly_name}}",
  268.         "output": "str",
  269.         "x": 690,
  270.         "y": 340,
  271.         "wires": [
  272.             [
  273.                 "8ebff89f.02d438"
  274.             ]
  275.         ]
  276.     },
  277.     {
  278.         "id": "8ebff89f.02d438",
  279.         "type": "join",
  280.         "z": "967995f2.033478",
  281.         "name": "combine msgs",
  282.         "mode": "custom",
  283.         "build": "string",
  284.         "property": "payload",
  285.         "propertyType": "msg",
  286.         "key": "topic",
  287.         "joiner": "[92,110]",
  288.         "joinerType": "bin",
  289.         "accumulate": false,
  290.         "timeout": "",
  291.         "count": "",
  292.         "reduceRight": false,
  293.         "reduceExp": "",
  294.         "reduceInit": "",
  295.         "reduceInitType": "",
  296.         "reduceFixup": "",
  297.         "x": 860,
  298.         "y": 340,
  299.         "wires": [
  300.             [
  301.                 "6bce24e7.7cfb8c"
  302.             ]
  303.         ]
  304.     },
  305.     {
  306.         "id": "9605b4db.a7a878",
  307.         "type": "api-call-service",
  308.         "z": "967995f2.033478",
  309.         "name": "Confirm start",
  310.         "server": "3bebce79.1e0962",
  311.         "version": 1,
  312.         "debugenabled": false,
  313.         "service_domain": "notify",
  314.         "service": "mobile_app_anders_iphone",
  315.         "entityId": "",
  316.         "data": "{\"message\":\"Støvsugning starter i:\\n\\n {{payload}}\"}",
  317.         "dataType": "json",
  318.         "mergecontext": "",
  319.         "output_location": "",
  320.         "output_location_type": "none",
  321.         "mustacheAltTags": false,
  322.         "x": 1190,
  323.         "y": 340,
  324.         "wires": [
  325.             []
  326.         ]
  327.     },
  328.     {
  329.         "id": "6bce24e7.7cfb8c",
  330.         "type": "change",
  331.         "z": "967995f2.033478",
  332.         "name": "Clean names",
  333.         "rules": [
  334.             {
  335.                 "t": "change",
  336.                 "p": "payload",
  337.                 "pt": "msg",
  338.                 "from": "Støvsug ",
  339.                 "fromt": "str",
  340.                 "to": "",
  341.                 "tot": "str"
  342.             }
  343.         ],
  344.         "action": "",
  345.         "property": "",
  346.         "from": "",
  347.         "to": "",
  348.         "reg": false,
  349.         "x": 1030,
  350.         "y": 340,
  351.         "wires": [
  352.             [
  353.                 "9605b4db.a7a878"
  354.             ]
  355.         ]
  356.     },
  357.     {
  358.         "id": "6aa3e92f.656be8",
  359.         "type": "delay",
  360.         "z": "967995f2.033478",
  361.         "name": "Ask again in 15 mins.",
  362.         "pauseType": "delay",
  363.         "timeout": "30",
  364.         "timeoutUnits": "seconds",
  365.         "rate": "1",
  366.         "nbRateUnits": "1",
  367.         "rateUnits": "second",
  368.         "randomFirst": "1",
  369.         "randomLast": "5",
  370.         "randomUnits": "seconds",
  371.         "drop": false,
  372.         "x": 520,
  373.         "y": 220,
  374.         "wires": [
  375.             [
  376.                 "cd40bece.b140b"
  377.             ]
  378.         ]
  379.     },
  380.     {
  381.         "id": "34984a6c.b675c6",
  382.         "type": "switch",
  383.         "z": "967995f2.033478",
  384.         "name": "Doorbell",
  385.         "property": "payload.event.id",
  386.         "propertyType": "msg",
  387.         "rules": [
  388.             {
  389.                 "t": "eq",
  390.                 "v": "hue_smart_button1",
  391.                 "vt": "str"
  392.             }
  393.         ],
  394.         "checkall": "true",
  395.         "repair": false,
  396.         "outputs": 1,
  397.         "x": 260,
  398.         "y": 440,
  399.         "wires": [
  400.             [
  401.                 "d2c7107c.d1909"
  402.             ]
  403.         ]
  404.     },
  405.     {
  406.         "id": "18c1908e.db781f",
  407.         "type": "server-events",
  408.         "z": "967995f2.033478",
  409.         "name": "Deconz events",
  410.         "server": "3bebce79.1e0962",
  411.         "event_type": "deconz_event",
  412.         "exposeToHomeAssistant": false,
  413.         "haConfig": [
  414.             {
  415.                 "property": "name",
  416.                 "value": ""
  417.             },
  418.             {
  419.                 "property": "icon",
  420.                 "value": ""
  421.             }
  422.         ],
  423.         "x": 100,
  424.         "y": 440,
  425.         "wires": [
  426.             [
  427.                 "34984a6c.b675c6"
  428.             ]
  429.         ]
  430.     },
  431.     {
  432.         "id": "301dd639.58180a",
  433.         "type": "api-current-state",
  434.         "z": "967995f2.033478",
  435.         "name": "Is vacuumingr?",
  436.         "server": "3bebce79.1e0962",
  437.         "version": 1,
  438.         "outputs": 2,
  439.         "halt_if": "cleaning",
  440.         "halt_if_type": "str",
  441.         "halt_if_compare": "is",
  442.         "override_topic": false,
  443.         "entity_id": "vacuum.xiaomi_vacuum_cleaner",
  444.         "state_type": "str",
  445.         "state_location": "payload",
  446.         "override_payload": "msg",
  447.         "entity_location": "data",
  448.         "override_data": "msg",
  449.         "blockInputOverrides": false,
  450.         "x": 620,
  451.         "y": 440,
  452.         "wires": [
  453.             [
  454.                 "dc889be8.cd09d8"
  455.             ],
  456.             []
  457.         ],
  458.         "outputLabels": [
  459.             "Ja",
  460.             "Nej"
  461.         ]
  462.     },
  463.     {
  464.         "id": "dc889be8.cd09d8",
  465.         "type": "api-call-service",
  466.         "z": "967995f2.033478",
  467.         "name": "Pause vacuum",
  468.         "server": "3bebce79.1e0962",
  469.         "version": 1,
  470.         "debugenabled": false,
  471.         "service_domain": "vacuum",
  472.         "service": "pause",
  473.         "entityId": "vacuum.xiaomi_vacuum_cleaner",
  474.         "data": "",
  475.         "dataType": "json",
  476.         "mergecontext": "",
  477.         "output_location": "",
  478.         "output_location_type": "none",
  479.         "mustacheAltTags": false,
  480.         "x": 800,
  481.         "y": 440,
  482.         "wires": [
  483.             []
  484.         ]
  485.     },
  486.     {
  487.         "id": "d2c7107c.d1909",
  488.         "type": "api-current-state",
  489.         "z": "967995f2.033478",
  490.         "name": "Someone home?",
  491.         "server": "3bebce79.1e0962",
  492.         "version": 1,
  493.         "outputs": 2,
  494.         "halt_if": "home",
  495.         "halt_if_type": "str",
  496.         "halt_if_compare": "is",
  497.         "override_topic": false,
  498.         "entity_id": "person.alle",
  499.         "state_type": "str",
  500.         "state_location": "payload",
  501.         "override_payload": "msg",
  502.         "entity_location": "data",
  503.         "override_data": "msg",
  504.         "blockInputOverrides": false,
  505.         "x": 430,
  506.         "y": 440,
  507.         "wires": [
  508.             [
  509.                 "301dd639.58180a"
  510.             ],
  511.             []
  512.         ]
  513.     },
  514.     {
  515.         "id": "d2106db8.edb2",
  516.         "type": "comment",
  517.         "z": "967995f2.033478",
  518.         "name": "Pause cleaning when doorbell is pressed",
  519.         "info": "",
  520.         "x": 180,
  521.         "y": 400,
  522.         "wires": []
  523.     },
  524.     {
  525.         "id": "ffff7569.bfbd88",
  526.         "type": "inject",
  527.         "z": "967995f2.033478",
  528.         "name": "timestamp",
  529.         "props": [
  530.             {
  531.                 "p": "payload"
  532.             },
  533.             {
  534.                 "p": "topic",
  535.                 "vt": "str"
  536.             }
  537.         ],
  538.         "repeat": "",
  539.         "crontab": "45 18 * * 1,2,3,4,5,0",
  540.         "once": false,
  541.         "onceDelay": "",
  542.         "topic": "",
  543.         "payload": "",
  544.         "payloadType": "date",
  545.         "x": 110,
  546.         "y": 620,
  547.         "wires": [
  548.             [
  549.                 "20bb71d8.9dc3ae"
  550.             ]
  551.         ]
  552.     },
  553.     {
  554.         "id": "349b5e95.5a1932",
  555.         "type": "comment",
  556.         "z": "967995f2.033478",
  557.         "name": "Ask to send vacuum to dustbin for manual emptying",
  558.         "info": "",
  559.         "x": 210,
  560.         "y": 540,
  561.         "wires": []
  562.     },
  563.     {
  564.         "id": "20bb71d8.9dc3ae",
  565.         "type": "api-current-state",
  566.         "z": "967995f2.033478",
  567.         "name": "Someone home?",
  568.         "server": "3bebce79.1e0962",
  569.         "version": 1,
  570.         "outputs": 2,
  571.         "halt_if": "home",
  572.         "halt_if_type": "str",
  573.         "halt_if_compare": "is",
  574.         "override_topic": false,
  575.         "entity_id": "person.alle",
  576.         "state_type": "str",
  577.         "state_location": "payload",
  578.         "override_payload": "msg",
  579.         "entity_location": "data",
  580.         "override_data": "msg",
  581.         "blockInputOverrides": false,
  582.         "x": 290,
  583.         "y": 620,
  584.         "wires": [
  585.             [
  586.                 "881c801.8789b8"
  587.             ],
  588.             []
  589.         ]
  590.     },
  591.     {
  592.         "id": "2872b879.7cc788",
  593.         "type": "api-call-service",
  594.         "z": "967995f2.033478",
  595.         "name": "Set last empty",
  596.         "server": "3bebce79.1e0962",
  597.         "version": 1,
  598.         "debugenabled": true,
  599.         "service_domain": "input_number",
  600.         "service": "set_value",
  601.         "entityId": "input_number.last_vaccuum_reset_m2",
  602.         "data": "{       \"value\": {{payload}}}",
  603.         "dataType": "json",
  604.         "mergecontext": "",
  605.         "output_location": "payload",
  606.         "output_location_type": "msg",
  607.         "mustacheAltTags": false,
  608.         "x": 860,
  609.         "y": 700,
  610.         "wires": [
  611.             []
  612.         ]
  613.     },
  614.     {
  615.         "id": "881c801.8789b8",
  616.         "type": "api-current-state",
  617.         "z": "967995f2.033478",
  618.         "name": "Vacuum state",
  619.         "server": "3bebce79.1e0962",
  620.         "version": 1,
  621.         "outputs": 1,
  622.         "halt_if": "",
  623.         "halt_if_type": "str",
  624.         "halt_if_compare": "is",
  625.         "override_topic": false,
  626.         "entity_id": "vacuum.xiaomi_vacuum_cleaner",
  627.         "state_type": "str",
  628.         "state_location": "payload1",
  629.         "override_payload": "msg",
  630.         "entity_location": "data1",
  631.         "override_data": "msg",
  632.         "blockInputOverrides": false,
  633.         "x": 480,
  634.         "y": 620,
  635.         "wires": [
  636.             [
  637.                 "a4ecc108.9a555"
  638.             ]
  639.         ]
  640.     },
  641.     {
  642.         "id": "a4ecc108.9a555",
  643.         "type": "api-current-state",
  644.         "z": "967995f2.033478",
  645.         "name": "Last reset count",
  646.         "server": "3bebce79.1e0962",
  647.         "version": 1,
  648.         "outputs": 1,
  649.         "halt_if": "",
  650.         "halt_if_type": "str",
  651.         "halt_if_compare": "is",
  652.         "override_topic": false,
  653.         "entity_id": "input_number.last_vaccuum_reset_m2",
  654.         "state_type": "str",
  655.         "state_location": "payload2",
  656.         "override_payload": "msg",
  657.         "entity_location": "data2",
  658.         "override_data": "msg",
  659.         "blockInputOverrides": false,
  660.         "x": 660,
  661.         "y": 620,
  662.         "wires": [
  663.             [
  664.                 "b578a632.767998"
  665.             ]
  666.         ]
  667.     },
  668.     {
  669.         "id": "b578a632.767998",
  670.         "type": "function",
  671.         "z": "967995f2.033478",
  672.         "name": "area since last empty",
  673.         "func": "let lastempty=msg.payload2;\nlet cleanarea=msg.data1.attributes.total_cleaned_area;\nlet diff=cleanarea-lastempty\nmsg.payload = diff;\nreturn msg;",
  674.         "outputs": 1,
  675.         "noerr": 0,
  676.         "initialize": "",
  677.         "finalize": "",
  678.         "x": 860,
  679.         "y": 620,
  680.         "wires": [
  681.             [
  682.                 "24e3946b.cb13cc"
  683.             ]
  684.         ]
  685.     },
  686.     {
  687.         "id": "24e3946b.cb13cc",
  688.         "type": "switch",
  689.         "z": "967995f2.033478",
  690.         "name": "Time to empty?",
  691.         "property": "payload",
  692.         "propertyType": "msg",
  693.         "rules": [
  694.             {
  695.                 "t": "gt",
  696.                 "v": "181",
  697.                 "vt": "num"
  698.             }
  699.         ],
  700.         "checkall": "true",
  701.         "repair": false,
  702.         "outputs": 1,
  703.         "x": 1060,
  704.         "y": 620,
  705.         "wires": [
  706.             [
  707.                 "5861ed94.9ccc24"
  708.             ]
  709.         ]
  710.     },
  711.     {
  712.         "id": "5861ed94.9ccc24",
  713.         "type": "api-call-service",
  714.         "z": "967995f2.033478",
  715.         "name": "Send notifcation",
  716.         "server": "3bebce79.1e0962",
  717.         "version": 1,
  718.         "debugenabled": false,
  719.         "service_domain": "notify",
  720.         "service": "mobile_app_anders_iphone",
  721.         "entityId": "",
  722.         "data": "{\"title\":\"Tøm støvsuger?\",\"message\":\"Vil du tømme støvsugeren, der har kørt {{payload}} m2 siden sidste tømning?\",\"data\":{\"push\":{\"category\":\"vacuum_empty_notification\"}}}",
  723.         "dataType": "json",
  724.         "mergecontext": "",
  725.         "output_location": "",
  726.         "output_location_type": "none",
  727.         "mustacheAltTags": false,
  728.         "x": 1240,
  729.         "y": 620,
  730.         "wires": [
  731.             []
  732.         ]
  733.     },
  734.     {
  735.         "id": "ea903d2c.3a64c",
  736.         "type": "server-events",
  737.         "z": "967995f2.033478",
  738.         "name": "IOS Action?",
  739.         "server": "3bebce79.1e0962",
  740.         "event_type": "ios.notification_action_fired",
  741.         "exposeToHomeAssistant": false,
  742.         "haConfig": [
  743.             {
  744.                 "property": "name",
  745.                 "value": ""
  746.             },
  747.             {
  748.                 "property": "icon",
  749.                 "value": ""
  750.             }
  751.         ],
  752.         "x": 90,
  753.         "y": 740,
  754.         "wires": [
  755.             [
  756.                 "ee169cb9.e013e"
  757.             ]
  758.         ]
  759.     },
  760.     {
  761.         "id": "ee169cb9.e013e",
  762.         "type": "switch",
  763.         "z": "967995f2.033478",
  764.         "name": "Time to empty?",
  765.         "property": "payload.event.actionName",
  766.         "propertyType": "msg",
  767.         "rules": [
  768.             {
  769.                 "t": "eq",
  770.                 "v": "VACUUM_EMPTY_ASK_LATER",
  771.                 "vt": "str"
  772.             },
  773.             {
  774.                 "t": "eq",
  775.                 "v": "VACUUM_EMPTY_YES",
  776.                 "vt": "str"
  777.             }
  778.         ],
  779.         "checkall": "false",
  780.         "repair": false,
  781.         "outputs": 2,
  782.         "x": 260,
  783.         "y": 740,
  784.         "wires": [
  785.             [
  786.                 "7d69a4f4.60a48c"
  787.             ],
  788.             [
  789.                 "5a232d93.5e95c4"
  790.             ]
  791.         ],
  792.         "outputLabels": [
  793.             "Remind me later",
  794.             "Yes - Send robot to dustbin"
  795.         ]
  796.     },
  797.     {
  798.         "id": "7d69a4f4.60a48c",
  799.         "type": "delay",
  800.         "z": "967995f2.033478",
  801.         "name": "Ask again in 15 mins.",
  802.         "pauseType": "delay",
  803.         "timeout": "15",
  804.         "timeoutUnits": "minutes",
  805.         "rate": "1",
  806.         "nbRateUnits": "1",
  807.         "rateUnits": "second",
  808.         "randomFirst": "1",
  809.         "randomLast": "5",
  810.         "randomUnits": "seconds",
  811.         "drop": false,
  812.         "x": 480,
  813.         "y": 700,
  814.         "wires": [
  815.             [
  816.                 "5861ed94.9ccc24"
  817.             ]
  818.         ]
  819.     },
  820.     {
  821.         "id": "5a232d93.5e95c4",
  822.         "type": "api-current-state",
  823.         "z": "967995f2.033478",
  824.         "name": "Vacuum state",
  825.         "server": "3bebce79.1e0962",
  826.         "version": 1,
  827.         "outputs": 1,
  828.         "halt_if": "",
  829.         "halt_if_type": "str",
  830.         "halt_if_compare": "is",
  831.         "override_topic": false,
  832.         "entity_id": "vacuum.xiaomi_vacuum_cleaner",
  833.         "state_type": "str",
  834.         "state_location": "payload1",
  835.         "override_payload": "msg",
  836.         "entity_location": "data1",
  837.         "override_data": "msg",
  838.         "blockInputOverrides": false,
  839.         "x": 460,
  840.         "y": 740,
  841.         "wires": [
  842.             [
  843.                 "2651ec5f.c46fc4"
  844.             ]
  845.         ]
  846.     },
  847.     {
  848.         "id": "700750af.2b8da",
  849.         "type": "api-call-service",
  850.         "z": "967995f2.033478",
  851.         "name": "Goto dustbin",
  852.         "server": "3bebce79.1e0962",
  853.         "version": 1,
  854.         "debugenabled": true,
  855.         "service_domain": "xiaomi_miio",
  856.         "service": "vacuum_goto",
  857.         "entityId": "vacuum.xiaomi_vacuum_cleaner",
  858.         "data": "{\"x_coord\":20200,\"y_coord\":27000}",
  859.         "dataType": "json",
  860.         "mergecontext": "",
  861.         "output_location": "payload",
  862.         "output_location_type": "msg",
  863.         "mustacheAltTags": false,
  864.         "x": 850,
  865.         "y": 780,
  866.         "wires": [
  867.             []
  868.         ]
  869.     },
  870.     {
  871.         "id": "7923d8a6.963d48",
  872.         "type": "server-state-changed",
  873.         "z": "967995f2.033478",
  874.         "name": "Vacuum is returning?",
  875.         "server": "3bebce79.1e0962",
  876.         "version": 1,
  877.         "exposeToHomeAssistant": false,
  878.         "haConfig": [
  879.             {
  880.                 "property": "name",
  881.                 "value": ""
  882.             },
  883.             {
  884.                 "property": "icon",
  885.                 "value": ""
  886.             }
  887.         ],
  888.         "entityidfilter": "vacuum.xiaomi_vacuum_cleaner",
  889.         "entityidfiltertype": "exact",
  890.         "outputinitially": false,
  891.         "state_type": "str",
  892.         "haltifstate": "returning",
  893.         "halt_if_type": "str",
  894.         "halt_if_compare": "is",
  895.         "outputs": 2,
  896.         "output_only_on_state_change": true,
  897.         "x": 120,
  898.         "y": 580,
  899.         "wires": [
  900.             [
  901.                 "20bb71d8.9dc3ae"
  902.             ],
  903.             []
  904.         ]
  905.     },
  906.     {
  907.         "id": "2651ec5f.c46fc4",
  908.         "type": "change",
  909.         "z": "967995f2.033478",
  910.         "name": "Get cleaned area",
  911.         "rules": [
  912.             {
  913.                 "t": "set",
  914.                 "p": "payload",
  915.                 "pt": "msg",
  916.                 "to": "msg.data1.attributes.total_cleaned_area",
  917.                 "tot": "msg"
  918.             }
  919.         ],
  920.         "action": "",
  921.         "property": "",
  922.         "from": "",
  923.         "to": "",
  924.         "reg": false,
  925.         "x": 670,
  926.         "y": 740,
  927.         "wires": [
  928.             [
  929.                 "2872b879.7cc788",
  930.                 "700750af.2b8da"
  931.             ]
  932.         ]
  933.     },
  934.     {
  935.         "id": "1619e493.c1e5cb",
  936.         "type": "trigger-state",
  937.         "z": "967995f2.033478",
  938.         "name": "Home state changed",
  939.         "server": "3bebce79.1e0962",
  940.         "exposeToHomeAssistant": false,
  941.         "haConfig": [
  942.             {
  943.                 "property": "name",
  944.                 "value": ""
  945.             },
  946.             {
  947.                 "property": "icon",
  948.                 "value": ""
  949.             }
  950.         ],
  951.         "entityid": "person.alle",
  952.         "entityidfiltertype": "exact",
  953.         "debugenabled": false,
  954.         "constraints": [],
  955.         "outputs": 2,
  956.         "customoutputs": [],
  957.         "outputinitially": false,
  958.         "state_type": "str",
  959.         "x": 120,
  960.         "y": 160,
  961.         "wires": [
  962.             [
  963.                 "39b74814.c4faa8"
  964.             ],
  965.             []
  966.         ]
  967.     },
  968.     {
  969.         "id": "39b74814.c4faa8",
  970.         "type": "ha-get-entities",
  971.         "z": "967995f2.033478",
  972.         "server": "3bebce79.1e0962",
  973.         "name": "Count home",
  974.         "rules": [
  975.             {
  976.                 "property": "entity_id",
  977.                 "logic": "starts_with",
  978.                 "value": "person.",
  979.                 "valueType": "str"
  980.             },
  981.             {
  982.                 "property": "state",
  983.                 "logic": "is",
  984.                 "value": "home",
  985.                 "valueType": "str"
  986.             }
  987.         ],
  988.         "output_type": "count",
  989.         "output_empty_results": false,
  990.         "output_location_type": "msg",
  991.         "output_location": "payload",
  992.         "output_results_count": 1,
  993.         "x": 330,
  994.         "y": 160,
  995.         "wires": [
  996.             [
  997.                 "93c8e379.38e76"
  998.             ]
  999.         ]
  1000.     },
  1001.     {
  1002.         "id": "93c8e379.38e76",
  1003.         "type": "switch",
  1004.         "z": "967995f2.033478",
  1005.         "name": "Nobody home?",
  1006.         "property": "payload",
  1007.         "propertyType": "msg",
  1008.         "rules": [
  1009.             {
  1010.                 "t": "eq",
  1011.                 "v": "0",
  1012.                 "vt": "num"
  1013.             },
  1014.             {
  1015.                 "t": "else"
  1016.             }
  1017.         ],
  1018.         "checkall": "true",
  1019.         "repair": false,
  1020.         "outputs": 2,
  1021.         "x": 520,
  1022.         "y": 160,
  1023.         "wires": [
  1024.             [
  1025.                 "cd40bece.b140b"
  1026.             ],
  1027.             []
  1028.         ]
  1029.     },
  1030.     {
  1031.         "id": "cd40bece.b140b",
  1032.         "type": "api-call-service",
  1033.         "z": "967995f2.033478",
  1034.         "name": "Send notifcation",
  1035.         "server": "3bebce79.1e0962",
  1036.         "version": 1,
  1037.         "debugenabled": false,
  1038.         "service_domain": "notify",
  1039.         "service": "mobile_app_anders_iphone",
  1040.         "entityId": "",
  1041.         "data": "{\"message\":\"Der er ingen hjemme. Skal jeg klare støvsugningen, mens I er væk?\",\"data\":{\"push\":{\"category\":\"vacuum_notification\"}}}",
  1042.         "dataType": "json",
  1043.         "mergecontext": "",
  1044.         "output_location": "",
  1045.         "output_location_type": "none",
  1046.         "mustacheAltTags": false,
  1047.         "x": 740,
  1048.         "y": 160,
  1049.         "wires": [
  1050.             []
  1051.         ]
  1052.     },
  1053.     {
  1054.         "id": "a6a7cdf0.b8d69",
  1055.         "type": "comment",
  1056.         "z": "967995f2.033478",
  1057.         "name": "Start cleaning from Lovelace via Dummy script",
  1058.         "info": "",
  1059.         "x": 190,
  1060.         "y": 30,
  1061.         "wires": []
  1062.     },
  1063.     {
  1064.         "id": "a7dc1ca.eaedde",
  1065.         "type": "change",
  1066.         "z": "967995f2.033478",
  1067.         "name": "Get room IDs only",
  1068.         "rules": [
  1069.             {
  1070.                 "t": "set",
  1071.                 "p": "payload",
  1072.                 "pt": "msg",
  1073.                 "to": "payload.entity_id",
  1074.                 "tot": "msg"
  1075.             },
  1076.             {
  1077.                 "t": "change",
  1078.                 "p": "payload",
  1079.                 "pt": "msg",
  1080.                 "from": "input_boolean.clean_room_",
  1081.                 "fromt": "str",
  1082.                 "to": "",
  1083.                 "tot": "str"
  1084.             }
  1085.         ],
  1086.         "action": "",
  1087.         "property": "",
  1088.         "from": "",
  1089.         "to": "",
  1090.         "reg": false,
  1091.         "x": 690,
  1092.         "y": 70,
  1093.         "wires": [
  1094.             [
  1095.                 "cbc1c759.a32698"
  1096.             ]
  1097.         ]
  1098.     },
  1099.     {
  1100.         "id": "cbc1c759.a32698",
  1101.         "type": "join",
  1102.         "z": "967995f2.033478",
  1103.         "name": "Combine to array",
  1104.         "mode": "auto",
  1105.         "build": "object",
  1106.         "property": "payload",
  1107.         "propertyType": "msg",
  1108.         "key": "",
  1109.         "joiner": ",",
  1110.         "joinerType": "str",
  1111.         "accumulate": false,
  1112.         "timeout": "",
  1113.         "count": "",
  1114.         "reduceRight": false,
  1115.         "reduceExp": "",
  1116.         "reduceInit": "",
  1117.         "reduceInitType": "",
  1118.         "reduceFixup": "",
  1119.         "x": 890,
  1120.         "y": 70,
  1121.         "wires": [
  1122.             [
  1123.                 "f0fe8062.94cdb"
  1124.             ]
  1125.         ]
  1126.     },
  1127.     {
  1128.         "id": "f0fe8062.94cdb",
  1129.         "type": "json",
  1130.         "z": "967995f2.033478",
  1131.         "name": "Format as JSON",
  1132.         "property": "payload",
  1133.         "action": "",
  1134.         "pretty": false,
  1135.         "x": 1090,
  1136.         "y": 70,
  1137.         "wires": [
  1138.             [
  1139.                 "69523ea5.71763"
  1140.             ]
  1141.         ]
  1142.     },
  1143.     {
  1144.         "id": "69523ea5.71763",
  1145.         "type": "api-call-service",
  1146.         "z": "967995f2.033478",
  1147.         "name": "Start room cleaning",
  1148.         "server": "3bebce79.1e0962",
  1149.         "version": 1,
  1150.         "debugenabled": false,
  1151.         "service_domain": "vacuum",
  1152.         "service": "send_command",
  1153.         "entityId": "vacuum.xiaomi_vacuum_cleaner",
  1154.         "data": "{    \"command\": \"app_segment_clean\",    \"params\": [{{payload}}]}",
  1155.         "dataType": "json",
  1156.         "mergecontext": "",
  1157.         "output_location": "payload",
  1158.         "output_location_type": "msg",
  1159.         "mustacheAltTags": false,
  1160.         "x": 1290,
  1161.         "y": 70,
  1162.         "wires": [
  1163.             []
  1164.         ]
  1165.     },
  1166.     {
  1167.         "id": "29b6f561.0a57da",
  1168.         "type": "server-events",
  1169.         "z": "967995f2.033478",
  1170.         "name": "",
  1171.         "server": "3bebce79.1e0962",
  1172.         "event_type": "call_service",
  1173.         "exposeToHomeAssistant": false,
  1174.         "haConfig": [
  1175.             {
  1176.                 "property": "name",
  1177.                 "value": ""
  1178.             },
  1179.             {
  1180.                 "property": "icon",
  1181.                 "value": ""
  1182.             }
  1183.         ],
  1184.         "waitForRunning": true,
  1185.         "x": 110,
  1186.         "y": 70,
  1187.         "wires": [
  1188.             [
  1189.                 "fd3ab97b.bf6ac8"
  1190.             ]
  1191.         ]
  1192.     },
  1193.     {
  1194.         "id": "fd3ab97b.bf6ac8",
  1195.         "type": "switch",
  1196.         "z": "967995f2.033478",
  1197.         "name": "Vacuum script",
  1198.         "property": "payload.event.service",
  1199.         "propertyType": "msg",
  1200.         "rules": [
  1201.             {
  1202.                 "t": "eq",
  1203.                 "v": "nodered_vacuum",
  1204.                 "vt": "str"
  1205.             }
  1206.         ],
  1207.         "checkall": "true",
  1208.         "repair": false,
  1209.         "outputs": 1,
  1210.         "x": 300,
  1211.         "y": 70,
  1212.         "wires": [
  1213.             [
  1214.                 "240d3b30.3ae6c4"
  1215.             ]
  1216.         ]
  1217.     },
  1218.     {
  1219.         "id": "240d3b30.3ae6c4",
  1220.         "type": "ha-get-entities",
  1221.         "z": "967995f2.033478",
  1222.         "server": "3bebce79.1e0962",
  1223.         "name": "Get selected rooms",
  1224.         "rules": [
  1225.             {
  1226.                 "property": "entity_id",
  1227.                 "logic": "starts_with",
  1228.                 "value": "input_boolean.clean_room",
  1229.                 "valueType": "str"
  1230.             },
  1231.             {
  1232.                 "property": "state",
  1233.                 "logic": "is",
  1234.                 "value": "on",
  1235.                 "valueType": "str"
  1236.             }
  1237.         ],
  1238.         "output_type": "split",
  1239.         "output_empty_results": false,
  1240.         "output_location_type": "msg",
  1241.         "output_location": "payload",
  1242.         "output_results_count": 1,
  1243.         "x": 490,
  1244.         "y": 70,
  1245.         "wires": [
  1246.             [
  1247.                 "a7dc1ca.eaedde"
  1248.             ]
  1249.         ]
  1250.     },
  1251.     {
  1252.         "id": "3bebce79.1e0962",
  1253.         "type": "server",
  1254.         "name": "Home Assistant",
  1255.         "addon": true
  1256.     }
  1257. ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement