[Solved] Basic latch not being reset


#1

Hi

I have been using latches for some time now.
However at the moment trying to create even a basic new workflow with a latch, I am finding the reset expression whilst evaluated and the latch debug info suggests the latch has been reset, the stored value for the latch is not being reset.

A very basic expression as per the example

latch {{data.state}} > 100

reset {{data.state}} < 50

It latches fine, however on reset the stored value of the latch state is still True

Here is the debug showing the latch results after a payload that should reset, and it does suggest it was evaluated correctly.

However we can see in the latch storage that the latched state is still true.

As I said at the beginning I have used latches before and was having trouble so restarted with a basic example from the docs, and the latch is still not being reset. (Maybe it’s been a long week and I am missing something really basic :wink:

Thanks

T


#2

Tim, are you using a custom latch identifier? Because according to that debug output both “wasLatched” and “isLatched” are false, which suggests it is not actually reading the workflow storage key you have in your screenshot (since if it was, at the very least “wasLatched” would have been true).


#3

Hi

Yes I am using a custom latch id, as multiple devices need to use the workflow

The debug after triggering is

Full payload:

{
  "time": "2016-12-22T01:20:35.595Z",
  "data": {
    "state": 120,
    "asset": "ABC",
    "latchResult": true,
    "resetResult": false,
    "wasLatched": false,
    "isLatched": true,
    "latchBranch": true
  },
  "applicationId": "584a0a610c252601003ca65e",
  "triggerId": "585b2210795d32010083d880-BJSoGi_El",
  "triggerType": "virtualButton",
  "relayId": "57749260cabe830100a24bb6",
  "relayType": "user",
  "flowId": "585b2210795d32010083d880",
  "flowName": "Pumping State",
  "applicationName": "Petri Paper Mill",
  "globals": {}
}

Which suggests it is latched.

However as you pointed out the reset isn’t seeing it as latched

Full payload:

{
  "time": "2016-12-22T01:21:53.189Z",
  "data": {
    "state": 40,
    "asset": "ABC",
    "latchResult": false,
    "resetResult": true,
    "wasLatched": false,
    "isLatched": false,
    "latchBranch": false
  },
  "applicationId": "584a0a610c252601003ca65e",
  "triggerId": "585b2210795d32010083d880-SJlnVMouNe",
  "triggerType": "virtualButton",
  "relayId": "57749260cabe830100a24bb6",
  "relayType": "user",
  "flowId": "585b2210795d32010083d880",
  "flowName": "Pumping State",
  "applicationName": "Petri Paper Mill",
  "globals": {}
}

Ahh of course each button has a different trigger id.

Damn I am stupid.


#4

Using the latch identifier template definitely makes things harder to think about!

So you are all set, things are working as expected (now that you know what is matching against what)?


#5

Yep.

My problem was introducing virtualbuttons to emulate real devices and not thinking about the fact {{triggerID}} would be different.

My bad :wink:

T