Jeg har en flow som trigges når service User_Code og Interface evt.usercode.access_report fyres.
her parser jeg json og henter ut event, permission og identification.
jeg har testet flow med å bare sende push, og det funker, men det tuller seg til når jeg legger til endring av home mode. det virker som smarthub låser seg, og reagerer ikke på at det skal endre modus om den er i gang med en prosess.
jeg har prøvd å kjøre flow i paralell, beholde ny instans og avbryte gammel instans, samt beholde gammel og ignorere ny instans.
hvordan kan jeg gjøre dette optimalt og tilpasse flow slik at jeg unngår at ting låser seg. Typisk scenario er om noen låser døren, glemmer noe og åpener den igjen. I appen går det fint å bytte mellom ulike home modes uten at ting låser seg helt.
Flow:
{
"Id": "8w4VMb0NUlP9Icb",
"ClassId": "8w4VMb0NUlP9Icb",
"Author": "TSA",
"Version": 0,
"CreatedAt": "2023-02-28T11:37:48.202424058+01:00",
"UpdatedAt": "2023-08-15T23:10:39.511044487+02:00",
"Name": "Home mode if door",
"Group": "door",
"Description": "Home mode if door",
"Nodes": [
{
"Id": "1",
"Type": "trigger",
"Label": "Door is unlocked with code",
"SuccessTransition": "2",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "pt:j1/mt:evt/rt:dev/rn:zw/ad:1/sv:user_code/ad:82_0",
"Service": "user_code",
"ServiceInterface": "evt.usercode.access_report",
"Config": {
"ConnectorID": "",
"InputVariableType": "",
"IsValueFilterEnabled": false,
"LookupServiceNameAndLocation": false,
"PropFilterName": "",
"PropFilterValue": "",
"RegisterAsVirtualService": false,
"Timeout": 0,
"ValueFilter": {
"Value": null,
"ValueType": ""
},
"ValueJPath": "",
"ValueJPathResultType": "",
"VirtualServiceGroup": "",
"VirtualServiceProps": null
},
"Ui": {
"nodeType": "",
"x": 74,
"y": 201
},
"TypeAlias": "Trigger"
},
{
"Id": "2",
"Type": "transform",
"Label": "",
"SuccessTransition": "12",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "",
"Service": "",
"ServiceInterface": "",
"Config": {
"Expression": "",
"IsLVariableGlobal": false,
"IsRVariableGlobal": false,
"IsTargetVariableGlobal": false,
"IsTargetVariableInMemory": true,
"LVariableName": "",
"RValue": {
"Value": 0,
"ValueType": "int"
},
"RVariableName": "",
"Rtype": "var",
"TargetVariableName": "",
"TargetVariableType": "",
"Template": "",
"TransformType": "jpath",
"ValueMapping": [
{
"LValue": {
"Value": 0,
"ValueType": "int"
},
"RValue": {
"Value": 0,
"ValueType": "int"
}
}
],
"XPathMapping": [
{
"IsTargetVariableGlobal": false,
"Path": "$.val.event",
"TargetVariableName": "locked",
"TargetVariableType": "string",
"UpdateInputVariable": false
},
{
"IsTargetVariableGlobal": false,
"Path": "$.val.permission",
"TargetVariableName": "permission",
"TargetVariableType": "string",
"UpdateInputVariable": false
},
{
"IsTargetVariableGlobal": false,
"Path": "$.val.identification",
"TargetVariableName": "identification",
"TargetVariableType": "string",
"UpdateInputVariable": false
}
]
},
"Ui": {
"nodeType": "",
"x": 100,
"y": 449
},
"TypeAlias": "Transform"
},
{
"Id": "4",
"Type": "action",
"Label": "mode = home",
"SuccessTransition": "9",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "pt:j1/mt:cmd/rt:app/rn:vinculum/ad:1",
"Service": "vinculum",
"ServiceInterface": "cmd.pd7.request",
"Config": {
"DefaultValue": {
"Value": {
"cmd": "set",
"component": "mode",
"id": "home",
"param": {},
"requestId": 1
},
"ValueType": "object"
},
"IsVariableGlobal": false,
"Props": {},
"RegisterAsVirtualService": false,
"ResponseToTopic": "pt:j1/mt:rsp/rt:app/rn:tpflow/ad:1",
"VariableName": "",
"VirtualServiceGroup": "",
"VirtualServiceProps": {}
},
"Ui": {
"nodeType": "vinc_action",
"x": 581,
"y": 337
},
"TypeAlias": "Home mode"
},
{
"Id": "6",
"Type": "action",
"Label": "lys skitten inngang",
"SuccessTransition": "4",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "pt:j1/mt:cmd/rt:dev/rn:zw/ad:1/sv:out_lvl_switch/ad:45_1",
"Service": "out_lvl_switch",
"ServiceInterface": "cmd.binary.set",
"Config": {
"DefaultValue": {
"Value": true,
"ValueType": "bool"
},
"IsVariableGlobal": false,
"Props": {},
"RegisterAsVirtualService": false,
"ResponseToTopic": "",
"VariableName": "",
"VirtualServiceGroup": "",
"VirtualServiceProps": {}
},
"Ui": {
"nodeType": "",
"x": 396,
"y": 154
},
"TypeAlias": "Action"
},
{
"Id": "9",
"Type": "action",
"Label": "home",
"SuccessTransition": "",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "pt:j1/mt:evt/rt:app/rn:kind_owl/ad:1",
"Service": "kind-owl",
"ServiceInterface": "evt.notification.report",
"Config": {
"DefaultValue": {
"Value": {
"EventName": "custom",
"MessageContent": "Huset er satt i Hjemme",
"SiteId": "7fe610dc-3800-42e2-8853-c903f7501e15"
},
"ValueType": "object"
},
"IsVariableGlobal": false,
"Props": {},
"RegisterAsVirtualService": false,
"VariableName": "",
"VirtualServiceGroup": "",
"VirtualServiceProps": {}
},
"Ui": {
"nodeType": "notification_action",
"x": 809,
"y": 343
},
"TypeAlias": "Notification"
},
{
"Id": "10",
"Type": "action",
"Label": "away",
"SuccessTransition": "",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "pt:j1/mt:evt/rt:app/rn:kind_owl/ad:1",
"Service": "kind-owl",
"ServiceInterface": "evt.notification.report",
"Config": {
"DefaultValue": {
"Value": {
"EventName": "custom",
"MessageContent": "Huset er satt i Borte",
"SiteId": "7fe610dc-3800-42e2-8853-c903f7501e15"
},
"ValueType": "object"
},
"IsVariableGlobal": false,
"Props": {},
"RegisterAsVirtualService": false,
"VariableName": "",
"VirtualServiceGroup": "",
"VirtualServiceProps": {}
},
"Ui": {
"nodeType": "notification_action",
"x": 1105,
"y": 677
},
"TypeAlias": "Notification"
},
{
"Id": "12",
"Type": "if",
"Label": "door is locked",
"SuccessTransition": "",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "",
"Service": "",
"ServiceInterface": "",
"Config": {
"Expression": [
{
"BooleanOperator": "and",
"LeftVariableIsGlobal": false,
"LeftVariableName": "permission",
"Operand": "eq",
"RightVariable": {
"Value": "granted",
"ValueType": "string"
}
},
{
"BooleanOperator": "and",
"LeftVariableIsGlobal": false,
"LeftVariableName": "identification",
"Operand": "eq",
"RightVariable": {
"Value": "pin",
"ValueType": "string"
}
},
{
"BooleanOperator": "not",
"LeftVariableIsGlobal": false,
"LeftVariableName": "locked",
"Operand": "eq",
"RightVariable": {
"Value": "locked",
"ValueType": "string"
}
},
{
"BooleanOperator": "",
"LeftVariableIsGlobal": true,
"LeftVariableName": "fh.home.mode",
"Operand": "eq",
"RightVariable": {
"Value": "away",
"ValueType": "string"
}
}
],
"FalseTransition": "14",
"TrueTransition": "15"
},
"Ui": {
"nodeType": "",
"x": 209,
"y": 671
},
"TypeAlias": "If condition"
},
{
"Id": "14",
"Type": "if",
"Label": "door is unlocked",
"SuccessTransition": "",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "",
"Service": "",
"ServiceInterface": "",
"Config": {
"Expression": [
{
"BooleanOperator": "and",
"LeftVariableIsGlobal": false,
"LeftVariableName": "permission",
"Operand": "eq",
"RightVariable": {
"Value": "granted",
"ValueType": "string"
}
},
{
"BooleanOperator": "and",
"LeftVariableIsGlobal": false,
"LeftVariableName": "identification",
"Operand": "eq",
"RightVariable": {
"Value": "pin",
"ValueType": "string"
}
},
{
"BooleanOperator": "not",
"LeftVariableIsGlobal": false,
"LeftVariableName": "locked",
"Operand": "eq",
"RightVariable": {
"Value": "unlocked",
"ValueType": "string"
}
},
{
"BooleanOperator": "",
"LeftVariableIsGlobal": true,
"LeftVariableName": "fh.home.mode",
"Operand": "eq",
"RightVariable": {
"Value": "home",
"ValueType": "string"
}
}
],
"FalseTransition": "",
"TrueTransition": "6"
},
"Ui": {
"nodeType": "",
"x": 705,
"y": 691
},
"TypeAlias": "If condition"
},
{
"Id": "15",
"Type": "action",
"Label": "Mode = Away",
"SuccessTransition": "10",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "pt:j1/mt:cmd/rt:app/rn:vinculum/ad:1",
"Service": "vinculum",
"ServiceInterface": "cmd.pd7.request",
"Config": {
"DefaultValue": {
"Value": {
"cmd": "set",
"component": "mode",
"id": "away",
"param": {},
"requestId": 1
},
"ValueType": "object"
},
"IsVariableGlobal": false,
"Props": {},
"RegisterAsVirtualService": false,
"ResponseToTopic": "pt:j1/mt:rsp/rt:app/rn:tpflow/ad:1",
"VariableName": "",
"VirtualServiceGroup": "",
"VirtualServiceProps": {}
},
"Ui": {
"nodeType": "vinc_action",
"x": 1120,
"y": 420
},
"TypeAlias": "Home mode"
}
],
"Settings": null,
"IsDisabled": false,
"IsDefault": false,
"ParallelExecution": "parallel"
}