Nybegynner med Flows

Har prøvd å lage en flow her -Det som skal skje er at ved trigging av modus AWAY, skal dør låses etter 30 sekunder, HVIS dørkontakten er lukket. Er den åpen, skal døren ikke låses. årsaken til denne flow er at ved trigging av away modus, så låses dør med en gang. dette er noe upraktisk hvis en trykker på modusbryter i gangen, og skal ut døren etter å ha trykket :stuck_out_tongue:

Dette er sikkert helt på jordet, men påpek gjerne alle mine feil, og hva rettelsene betyr i praksis:

{
“Id”: “nQaOPVjdSvxfN75”,
“ClassId”: “nQaOPVjdSvxfN75”,
“Author”: “”,
“Version”: 0,
“CreatedAt”: “2020-08-25T23:57:13.412175269+02:00”,
“UpdatedAt”: “2020-08-25T23:57:13.412175269+02:00”,
“Name”: “testflow”,
“Nodes”: [
{
“Id”: “1”,
“Type”: “vinc_trigger”,
“Label”: “Home event trigger”,
“Address”: “”,
“Service”: “”,
“ServiceInterface”: “”,
“SuccessTransition”: “2”,
“ErrorTransition”: “”,
“Config”: {
“Timeout”: 0,
“ValueFilter”: “away”,
“IsValueFilterEnabled”: false,
“EventType”: “mode”
},
“Ui”: {
“x”: 777,
“y”: 66,
“nodeType”: “”
}
},
{
“Id”: “2”,
“Type”: “wait”,
“Label”: “30 sec”,
“Address”: “”,
“Service”: “”,
“ServiceInterface”: “”,
“SuccessTransition”: “6”,
“ErrorTransition”: “”,
“Config”: 3000,
“Ui”: {
“x”: 775,
“y”: 236,
“nodeType”: “”
}
},
{
“Id”: “6”,
“Type”: “if”,
“Label”: “”,
“Address”: “”,
“Service”: “”,
“ServiceInterface”: “”,
“SuccessTransition”: “”,
“ErrorTransition”: “”,
“Config”: {
“TrueTransition”: “7”,
“FalseTransition”: “9”,
“Expression”: [
{
“Operand”: “eq”,
“LeftVariableName”: “”,
“LeftVariableIsGlobal”: false,
“RightVariable”: {
“Value”: 100,
“ValueType”: “int”
},
“BooleanOperator”: “”
}
]
},
“Ui”: {
“x”: 773,
“y”: 390,
“nodeType”: “”
}
},
{
“Id”: “7”,
“Type”: “action”,
“Label”: “Door_sensor_open_false”,
“Address”: “pt:j1/mt:evt/rt:dev/rn:zw/ad:1/sv:sensor_contact/ad:120_0”,
“Service”: “sensor_contact”,
“ServiceInterface”: “evt.open.report”,
“SuccessTransition”: “8”,
“ErrorTransition”: “”,
“Config”: {
“VariableName”: “”,
“IsVariableGlobal”: false,
“Props”: {},
“RegisterAsVirtualService”: false,
“VirtualServiceGroup”: “”,
“VirtualServiceProps”: {},
“ResponseToTopic”: “”,
“DefaultValue”: {
“Value”: false,
“ValueType”: “bool”
}
},
“Ui”: {
“x”: 597,
“y”: 538,
“nodeType”: “”
}
},
{
“Id”: “8”,
“Type”: “action”,
“Label”: “door lock_true”,
“Address”: “pt:j1/mt:cmd/rt:dev/rn:zw/ad:1/sv:door_lock/ad:122_0”,
“Service”: “door_lock”,
“ServiceInterface”: “cmd.lock.set”,
“SuccessTransition”: “”,
“ErrorTransition”: “”,
“Config”: {
“VariableName”: “”,
“IsVariableGlobal”: false,
“Props”: {},
“RegisterAsVirtualService”: false,
“VirtualServiceGroup”: “”,
“VirtualServiceProps”: {},
“ResponseToTopic”: “”,
“DefaultValue”: {
“Value”: true,
“ValueType”: “bool”
}
},
“Ui”: {
“x”: 365,
“y”: 539,
“nodeType”: “”
}
},
{
“Id”: “9”,
“Type”: “action”,
“Label”: “Door_sensor_open_true”,
“Address”: “pt:j1/mt:evt/rt:dev/rn:zw/ad:1/sv:sensor_contact/ad:120_0”,
“Service”: “sensor_contact”,
“ServiceInterface”: “evt.open.report”,
“SuccessTransition”: “10”,
“ErrorTransition”: “”,
“Config”: {
“VariableName”: “”,
“IsVariableGlobal”: false,
“Props”: {},
“RegisterAsVirtualService”: false,
“VirtualServiceGroup”: “”,
“VirtualServiceProps”: {},
“ResponseToTopic”: “”,
“DefaultValue”: {
“Value”: true,
“ValueType”: “bool”
}
},
“Ui”: {
“x”: 916,
“y”: 546,
“nodeType”: “”
}
},
{
“Id”: “10”,
“Type”: “action”,
“Label”: “door lock_false”,
“Address”: “pt:j1/mt:cmd/rt:dev/rn:zw/ad:1/sv:door_lock/ad:122_0”,
“Service”: “door_lock”,
“ServiceInterface”: “cmd.lock.set”,
“SuccessTransition”: “”,
“ErrorTransition”: “”,
“Config”: {
“VariableName”: “”,
“IsVariableGlobal”: false,
“Props”: {},
“RegisterAsVirtualService”: false,
“VirtualServiceGroup”: “”,
“VirtualServiceProps”: {},
“ResponseToTopic”: “”,
“DefaultValue”: {
“Value”: false,
“ValueType”: “bool”
}
},
“Ui”: {
“x”: 1168,
“y”: 546,
“nodeType”: “”
}
}
],
“Settings”: null,
“IsDisabled”: false,
“IsDefault”: false,
“ParallelExecution”: “”
}

ingen? :frowning:

Jeg får ikke importert den:( Kan du prøve å dele koden på nytt? Muligens noe som ikke har blitt med

Tror det har med måten " blir håndtert på. Har prøvd å endre skrift type, men ser ikke ut til å være en innstilling for det. Det er kanskje best å bruke en pastebin tjeneste på nett, f.eks gist eller noe når man deler source code

La til en guide hvordan du bør dele kode:

{
  "Id": "HyQSnqBRoRYFvFA",
  "ClassId": "HyQSnqBRoRYFvFA",
  "Author": "",
  "Version": 0,
  "CreatedAt": "2020-08-27T09:53:09.436582617+02:00",
  "UpdatedAt": "2020-08-27T09:53:09.436582617+02:00",
  "Name": "Away_doorlock",
  "Description": "Locking door - with timedelay - but only if door is closed",
  "Nodes": [
    {
      "Id": "3",
      "Type": "wait",
      "Label": "wait 30sek",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "SuccessTransition": "4",
      "ErrorTransition": "",
      "Config": 3000,
      "Ui": {
        "x": 923,
        "y": 217,
        "nodeType": ""
      }
    },
    {
      "Id": "4",
      "Type": "if",
      "Label": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "SuccessTransition": "",
      "ErrorTransition": "",
      "Config": {
        "TrueTransition": "6",
        "FalseTransition": "5",
        "Expression": [
          {
            "Operand": "eq",
            "LeftVariableName": "",
            "LeftVariableIsGlobal": false,
            "RightVariable": {
              "Value": 100,
              "ValueType": "int"
            },
            "BooleanOperator": ""
          }
        ]
      },
      "Ui": {
        "x": 1144,
        "y": 169,
        "nodeType": ""
      }
    },
    {
      "Id": "5",
      "Type": "if",
      "Label": "or",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "SuccessTransition": "",
      "ErrorTransition": "",
      "Config": {
        "TrueTransition": "7",
        "FalseTransition": "",
        "Expression": [
          {
            "Operand": "eq",
            "LeftVariableName": "",
            "LeftVariableIsGlobal": true,
            "RightVariable": {
              "Value": 100,
              "ValueType": "int"
            },
            "BooleanOperator": "or"
          },
          {
            "Operand": "eq",
            "LeftVariableName": "",
            "LeftVariableIsGlobal": false,
            "RightVariable": {
              "Value": 100,
              "ValueType": "int"
            },
            "BooleanOperator": ""
          }
        ]
      },
      "Ui": {
        "x": 1373,
        "y": 126,
        "nodeType": ""
      }
    },
    {
      "Id": "6",
      "Type": "action",
      "Label": "Sensor_open",
      "Address": "pt:j1/mt:evt/rt:dev/rn:zw/ad:1/sv:sensor_contact/ad:120_0",
      "Service": "sensor_contact",
      "ServiceInterface": "evt.open.report",
      "SuccessTransition": "9",
      "ErrorTransition": "",
      "Config": {
        "VariableName": "",
        "IsVariableGlobal": false,
        "Props": {},
        "RegisterAsVirtualService": false,
        "VirtualServiceGroup": "",
        "VirtualServiceProps": {},
        "ResponseToTopic": "",
        "DefaultValue": {
          "Value": true,
          "ValueType": "bool"
        }
      },
      "Ui": {
        "x": 1104,
        "y": 381,
        "nodeType": ""
      }
    },
    {
      "Id": "7",
      "Type": "action",
      "Label": "Sensor_closed",
      "Address": "pt:j1/mt:evt/rt:dev/rn:zw/ad:1/sv:sensor_contact/ad:120_0",
      "Service": "sensor_contact",
      "ServiceInterface": "evt.open.report",
      "SuccessTransition": "",
      "ErrorTransition": "",
      "Config": {
        "VariableName": "",
        "IsVariableGlobal": false,
        "Props": {},
        "RegisterAsVirtualService": false,
        "VirtualServiceGroup": "",
        "VirtualServiceProps": {},
        "ResponseToTopic": "",
        "DefaultValue": {
          "Value": false,
          "ValueType": "bool"
        }
      },
      "Ui": {
        "x": 1333,
        "y": 380,
        "nodeType": ""
      }
    },
    {
      "Id": "8",
      "Type": "vinc_trigger",
      "Label": "Away mode",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "SuccessTransition": "3",
      "ErrorTransition": "",
      "Config": {
        "Timeout": 0,
        "ValueFilter": "away",
        "IsValueFilterEnabled": false,
        "EventType": "mode"
      },
      "Ui": {
        "x": 626,
        "y": 264,
        "nodeType": ""
      }
    },
    {
      "Id": "9",
      "Type": "action",
      "Label": "Door_locks = false",
      "Address": "pt:j1/mt:cmd/rt:dev/rn:zw/ad:1/sv:door_lock/ad:122_0",
      "Service": "door_lock",
      "ServiceInterface": "cmd.lock.set",
      "SuccessTransition": "",
      "ErrorTransition": "",
      "Config": {
        "VariableName": "",
        "IsVariableGlobal": false,
        "Props": {},
        "RegisterAsVirtualService": false,
        "VirtualServiceGroup": "",
        "VirtualServiceProps": {},
        "ResponseToTopic": "",
        "DefaultValue": {
          "Value": false,
          "ValueType": "bool"
        }
      },
      "Ui": {
        "x": 1101,
        "y": 540,
        "nodeType": ""
      }
    },
    {
      "Id": "10",
      "Type": "action",
      "Label": "Door_locks = true",
      "Address": "pt:j1/mt:cmd/rt:dev/rn:zw/ad:1/sv:door_lock/ad:122_0",
      "Service": "door_lock",
      "ServiceInterface": "cmd.lock.set",
      "SuccessTransition": "",
      "ErrorTransition": "",
      "Config": {
        "VariableName": "",
        "IsVariableGlobal": false,
        "Props": {},
        "RegisterAsVirtualService": false,
        "VirtualServiceGroup": "",
        "VirtualServiceProps": {},
        "ResponseToTopic": "",
        "DefaultValue": {
          "Value": true,
          "ValueType": "bool"
        }
      },
      "Ui": {
        "x": 1336,
        "y": 544,
        "nodeType": ""
      }
    },
    {
      "Id": "11",
      "Type": "trigger",
      "Label": "Namron_switch_away",
      "Address": "pt:j1/mt:cmd/rt:dev/rn:zw/ad:1/sv:scene_ctrl/ad:101_0",
      "Service": "scene_ctrl",
      "ServiceInterface": "cmd.scene.set",
      "SuccessTransition": "8",
      "ErrorTransition": "",
      "Config": {
        "Timeout": 0,
        "VirtualServiceGroup": "ch_0",
        "VirtualServiceProps": {},
        "RegisterAsVirtualService": false,
        "LookupServiceNameAndLocation": false,
        "ValueFilter": {
          "Value": "2.0",
          "ValueType": "string"
        },
        "IsValueFilterEnabled": false
      },
      "Ui": {
        "x": 312,
        "y": 265,
        "nodeType": ""
      }
    }
  ],
  "Settings": null,
  "IsDisabled": false,
  "IsDefault": false,
  "ParallelExecution": ""
}

? Bumpebump

Jeg kan prøve å få sett på den over helga😊

2 Likes

Doorsensor trigger kun flow når kontakt lukkes, deretter sjekker om modus er “away” og da eventuelt låser dør. Altså du kan sette bortemodus, åpne døren, og når døren igjen blir lukket, så sendes låse kommando.

{
  "Id": "Ty7Jk8z32sMvt4p",
  "ClassId": "Ty7Jk8z32sMvt4p",
  "Author": "espenh.no",
  "Version": 0,
  "CreatedAt": "2020-09-02T10:22:38.095773177+02:00",
  "UpdatedAt": "2020-09-02T10:25:20.106447956+02:00",
  "Name": "lock door in away",
  "Group": "doorlock",
  "Description": "lock door in away mode, and door is closed",
  "Nodes": [
    {
      "Id": "1",
      "Type": "trigger",
      "Label": "doorsensor",
      "SuccessTransition": "2",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "pt:j1/mt:evt/rt:dev/rn:zw/ad:1/sv:sensor_contact/ad:39_0",
      "Service": "sensor_contact",
      "ServiceInterface": "evt.open.report",
      "Config": {
        "IsValueFilterEnabled": true,
        "LookupServiceNameAndLocation": false,
        "RegisterAsVirtualService": false,
        "Timeout": 0,
        "ValueFilter": {
          "Value": false,
          "ValueType": "bool"
        },
        "VirtualServiceGroup": "ch_0",
        "VirtualServiceProps": {}
      },
      "Ui": {
        "nodeType": "",
        "x": 70,
        "y": 170
      }
    },
    {
      "Id": "2",
      "Type": "if",
      "Label": "if away",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "SuccessTransition": "",
      "ErrorTransition": "",
      "Config": {
        "TrueTransition": "3",
        "FalseTransition": "",
        "Expression": [
          {
            "Operand": "eq",
            "LeftVariableName": "fh.home.mode",
            "LeftVariableIsGlobal": true,
            "RightVariable": {
              "Value": "away",
              "ValueType": "string"
            },
            "BooleanOperator": ""
          }
        ]
      },
      "Ui": {
        "x": 126,
        "y": 356,
        "nodeType": ""
      }
    },
    {
      "Id": "3",
      "Type": "action",
      "Label": "lock door",
      "Address": "pt:j1/mt:cmd/rt:dev/rn:zw/ad:1/sv:door_lock/ad:50_0",
      "Service": "door_lock",
      "ServiceInterface": "cmd.lock.set",
      "SuccessTransition": "",
      "ErrorTransition": "",
      "Config": {
        "VariableName": "",
        "IsVariableGlobal": false,
        "Props": {},
        "RegisterAsVirtualService": false,
        "VirtualServiceGroup": "",
        "VirtualServiceProps": {},
        "ResponseToTopic": "",
        "DefaultValue": {
          "Value": true,
          "ValueType": "bool"
        }
      },
      "Ui": {
        "x": 177,
        "y": 534,
        "nodeType": ""
      }
    }
  ],
  "Settings": null,
  "IsDisabled": false,
  "IsDefault": false,
  "ParallelExecution": "keep_last"
}

Kan en kode lages der det er delay på 10sec før dør låses? Pga små unger, og typisk “jeg glemte noe”.

Men i selve away modus i app, setter jeg da dør til “ikke gjør noe” ? Og så håndterer flow det utenom?

Ah, leste litt raskt. Det oppsettet der bør gjøre susen😅

1 Like