Hei!
Det er en liten begrensing i Thingsplex for å filtrere på map of strings etc. Jeg fant en gammel flow som jeg mener skal fungere (har ikke kompatibel enhet tilgjengelig her og nå for test).
Importer gjerne denne og test ut (du må bytte på de ulike addressene, samt opprette to globale variabler);
{
"Id": "0721nJczIZzxTfK",
"ClassId": "kKfOIAraY9RB30x",
"Author": "espenh.no",
"Version": 1,
"CreatedAt": "2022-02-04T13:55:09.105627365+01:00",
"UpdatedAt": "2022-02-04T23:28:04.846577564+01:00",
"Name": "When water leakage is detected turn off water ",
"Group": "water leakage",
"Description": "When water leakage is detected turn off water ",
"Nodes": [
{
"Id": "2",
"Type": "action",
"Label": "Slå av vann",
"SuccessTransition": "4",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "pt:j1/mt:cmd/rt:dev/rn:zw/ad:1/sv:out_bin_switch/ad:27_1",
"Service": "out_bin_switch",
"ServiceInterface": "cmd.binary.set",
"Config": {
"DefaultValue": {
"Value": false,
"ValueType": "bool"
},
"IsVariableGlobal": false,
"Props": {},
"RegisterAsVirtualService": false,
"ResponseToTopic": "",
"VariableName": "",
"VirtualServiceGroup": "",
"VirtualServiceProps": {}
},
"Ui": {
"nodeType": "",
"x": 664,
"y": 445
},
"TypeAlias": "Action"
},
{
"Id": "3",
"Type": "trigger",
"Label": "Fibaro vannsensor",
"SuccessTransition": "6",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "pt:j1/mt:evt/rt:dev/rn:zw/ad:1/sv:alarm_water/ad:84_0",
"Service": "alarm_water",
"ServiceInterface": "evt.alarm.report",
"Config": {
"IsValueFilterEnabled": false,
"LookupServiceNameAndLocation": false,
"RegisterAsVirtualService": false,
"Timeout": 0,
"ValueFilter": {
"Value": "",
"ValueType": ""
},
"VirtualServiceGroup": "ch_0",
"VirtualServiceProps": {}
},
"Ui": {
"nodeType": "",
"x": 101,
"y": 264
},
"TypeAlias": "Trigger"
},
{
"Id": "4",
"Type": "action",
"Label": "Push notification",
"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": "Vannet er slått av!",
"SiteId": "unknown"
},
"ValueType": "object"
},
"IsVariableGlobal": false,
"Props": {},
"RegisterAsVirtualService": false,
"VariableName": "",
"VirtualServiceGroup": "",
"VirtualServiceProps": {}
},
"Ui": {
"nodeType": "notification_action",
"x": 579,
"y": 605
},
"TypeAlias": "Notification"
},
{
"Id": "5",
"Type": "transform",
"Label": "extractVal",
"SuccessTransition": "7",
"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": [],
"XPathMapping": [
{
"IsTargetVariableGlobal": true,
"Path": "$.val.event",
"TargetVariableName": "alarm",
"TargetVariableType": "string",
"UpdateInputVariable": false
},
{
"IsTargetVariableGlobal": true,
"Path": "$.val.status",
"TargetVariableName": "alarm_leak",
"TargetVariableType": "string",
"UpdateInputVariable": false
}
]
},
"Ui": {
"nodeType": "",
"x": 167,
"y": 598
},
"TypeAlias": "Transform"
},
{
"Id": "6",
"Type": "rate_limit",
"Label": "rateLimit",
"SuccessTransition": "5",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "",
"Service": "",
"ServiceInterface": "",
"Config": {
"Action": "skip",
"Limit": 1,
"TimeInterval": 1
},
"Ui": {
"nodeType": "",
"x": 134,
"y": 423
},
"TypeAlias": "Rate limit"
},
{
"Id": "7",
"Type": "if",
"Label": "if leak & activ",
"SuccessTransition": "",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "",
"Service": "",
"ServiceInterface": "",
"Config": {
"Expression": [
{
"BooleanOperator": "and",
"LeftVariableIsGlobal": true,
"LeftVariableName": "alarm",
"Operand": "eq",
"RightVariable": {
"Value": "leak",
"ValueType": "string"
}
},
{
"BooleanOperator": "",
"LeftVariableIsGlobal": true,
"LeftVariableName": "alarm_leak",
"Operand": "eq",
"RightVariable": {
"Value": "activ",
"ValueType": "string"
}
}
],
"FalseTransition": "8",
"TrueTransition": "2"
},
"Ui": {
"nodeType": "",
"x": 829,
"y": 254
},
"TypeAlias": "If condition"
},
{
"Id": "8",
"Type": "action",
"Label": "Slå på vann",
"SuccessTransition": "9",
"TimeoutTransition": "",
"ErrorTransition": "",
"Address": "pt:j1/mt:cmd/rt:dev/rn:zw/ad:1/sv:out_bin_switch/ad:27_1",
"Service": "out_bin_switch",
"ServiceInterface": "cmd.binary.set",
"Config": {
"DefaultValue": {
"Value": true,
"ValueType": "bool"
},
"IsVariableGlobal": false,
"Props": {},
"RegisterAsVirtualService": false,
"ResponseToTopic": "",
"VariableName": "",
"VirtualServiceGroup": "",
"VirtualServiceProps": {}
},
"Ui": {
"nodeType": "",
"x": 961,
"y": 452
},
"TypeAlias": "Action"
},
{
"Id": "9",
"Type": "action",
"Label": "Push notification",
"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": "Vannet er slått på!",
"SiteId": "unknown"
},
"ValueType": "object"
},
"IsVariableGlobal": false,
"Props": {},
"RegisterAsVirtualService": false,
"VariableName": "",
"VirtualServiceGroup": "",
"VirtualServiceProps": {}
},
"Ui": {
"nodeType": "notification_action",
"x": 1079,
"y": 613
},
"TypeAlias": "Notification"
}
],
"Settings": null,
"IsDisabled": false,
"IsDefault": false,
"ParallelExecution": "parallel"
}