Mapping json path

Hi,

I’m trying to map an object from the ID Lock 150 to put the house in home mode when unlocking it with code from the outside. For now i’ve just added a notification in the end to see if it triggers.

But it does not trigger. Any idea what could go wrong?

{
  "Id": "8w4VMb0NUlP9Icb",
  "ClassId": "8w4VMb0NUlP9Icb",
  "Author": "",
  "Version": 0,
  "CreatedAt": "2023-02-28T11:37:48.202424058+01:00",
  "UpdatedAt": "2023-02-28T14:30:47.453775116+01:00",
  "Name": "home if unlocked and away",
  "Group": "door",
  "Description": "home if unlocked and away",
  "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": "object"
        },
        "ValueJPath": "",
        "ValueJPathResultType": "",
        "VirtualServiceGroup": "",
        "VirtualServiceProps": null
      },
      "Ui": {
        "nodeType": "",
        "x": 77,
        "y": 230
      },
      "TypeAlias": "Trigger"
    },
    {
      "Id": "2",
      "Type": "transform",
      "Label": "",
      "SuccessTransition": "3",
      "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": false,
            "Path": "$.val.event",
            "TargetVariableName": "",
            "TargetVariableType": "",
            "UpdateInputVariable": false
          }
        ]
      },
      "Ui": {
        "nodeType": "",
        "x": 405,
        "y": 249
      },
      "TypeAlias": "Transform"
    },
    {
      "Id": "3",
      "Type": "if",
      "Label": "",
      "SuccessTransition": "",
      "TimeoutTransition": "",
      "ErrorTransition": "",
      "Address": "",
      "Service": "",
      "ServiceInterface": "",
      "Config": {
        "Expression": [
          {
            "BooleanOperator": "",
            "LeftVariableIsGlobal": false,
            "LeftVariableName": "",
            "Operand": "eq",
            "RightVariable": {
              "Value": "unlocked",
              "ValueType": "string"
            }
          },
          {
            "BooleanOperator": "",
            "LeftVariableIsGlobal": true,
            "LeftVariableName": "fh.home.mode",
            "Operand": "eq",
            "RightVariable": {
              "Value": "away",
              "ValueType": "string"
            }
          }
        ],
        "FalseTransition": "",
        "TrueTransition": "4"
      },
      "Ui": {
        "nodeType": "",
        "x": 980,
        "y": 429
      },
      "TypeAlias": "If condition"
    },
    {
      "Id": "4",
      "Type": "action",
      "Label": "Push notification",
      "Address": "pt:j1/mt:evt/rt:app/rn:kind_owl/ad:1",
      "Service": "kind-owl",
      "ServiceInterface": "evt.notification.report",
      "SuccessTransition": "",
      "ErrorTransition": "",
      "Config": {
        "VariableName": "",
        "IsVariableGlobal": false,
        "Props": {},
        "RegisterAsVirtualService": false,
        "VirtualServiceGroup": "",
        "VirtualServiceProps": {},
        "DefaultValue": {
          "Value": {
            "EventName": "custom",
            "MessageContent": "Hello world",
            "SiteId": "7fe610dc-3800-42e2-8853-c903f7501e15"
          },
          "ValueType": "object"
        }
      },
      "Ui": {
        "x": 935,
        "y": 211,
        "nodeType": "notification_action"
      },
      "TypeAlias": "Notification"
    }
  ],
  "Settings": null,
  "IsDisabled": false,
  "IsDefault": false,
  "ParallelExecution": "parallel"
}

@espen As far as I remember, you have created exactly this for your site? Could you help out here please? :smiley:

I’ve tried to use Espens solution, but it does not seem to work.

I solved it like this. works fine :slight_smile: Then you know the door was unlocked from the outside panel.

{
  "Id": "8w4VMb0NUlP9Icb",
  "ClassId": "8w4VMb0NUlP9Icb",
  "Author": "TrondAa",
  "Version": 0,
  "CreatedAt": "2023-02-28T11:37:48.202424058+01:00",
  "UpdatedAt": "2023-02-28T18:02:41.744176384+01:00",
  "Name": "home if unlocked and away",
  "Group": "door",
  "Description": "home if unlocked and away",
  "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": 77,
        "y": 230
      },
      "TypeAlias": "Trigger"
    },
    {
      "Id": "2",
      "Type": "transform",
      "Label": "",
      "SuccessTransition": "5",
      "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": "unlocked",
            "TargetVariableType": "string",
            "UpdateInputVariable": false
          },
          {
            "IsTargetVariableGlobal": false,
            "Path": "$.val.permission",
            "TargetVariableName": "permission",
            "TargetVariableType": "string",
            "UpdateInputVariable": false
          }
        ]
      },
      "Ui": {
        "nodeType": "",
        "x": 405,
        "y": 249
      },
      "TypeAlias": "Transform"
    },
    {
      "Id": "4",
      "Type": "action",
      "Label": "mode = home",
      "SuccessTransition": "",
      "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": 868,
        "y": 177
      },
      "TypeAlias": "Home mode"
    },
    {
      "Id": "5",
      "Type": "if",
      "Label": "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": "unlocked",
            "Operand": "eq",
            "RightVariable": {
              "Value": "unlocked",
              "ValueType": "string"
            }
          },
          {
            "BooleanOperator": "",
            "LeftVariableIsGlobal": true,
            "LeftVariableName": "fh.home.mode",
            "Operand": "eq",
            "RightVariable": {
              "Value": "away",
              "ValueType": "string"
            }
          }
        ],
        "FalseTransition": "",
        "TrueTransition": "6"
      },
      "Ui": {
        "nodeType": "",
        "x": 1054,
        "y": 425
      },
      "TypeAlias": "If condition"
    },
    {
      "Id": "6",
      "Type": "action",
      "Label": "",
      "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": 363,
        "y": 414
      },
      "TypeAlias": "Action"
    }
  ],
  "Settings": null,
  "IsDisabled": false,
  "IsDefault": false,
  "ParallelExecution": "parallel"
}

If you have the latest firmware on the ID Lock 150 you would also get user_code notifications when you lock the door from the outside panel.

Use the same code as above, but change event variable to “locked”

That way you won’t change the mode if you lock the door from inside or gets in conflict with other automation.

1 Like