<aside> 💡 THE STARTING POINT:

Inductive sensor.json

</aside>


<aside> 💡 The overall logic: each time the inductive sensor reaches a limit value, it sends a message with “1” as payload. By this we can count each part coming through.

</aside>

Untitled

  1. You start with a MQTT-IN node that runs under the topic of your inductive sensor (as defined in documentation)

    1. Define Server (vernemq…)
    2. Define topic (as in documentation)
    3. give the MQTT-IN a name
  2. After that place a json for the convertation from string to object:

    Untitled

  3. Then we need to extract the payload, as this sensor does store its value under msg.payload.PDV1

    msg.timestamp=msg.payload.timestamp_ms
    msg.payload=msg.payload.PDV1;
    return msg;
    
  4. Implement the rising edge (it will compare to the msg.payload to a limit value). The value for the threshold has to be defined out of the context in production. In this example it is 500.

    Untitled

  5. After this the payload gets redefined in the “PreventiveMaintenanceStop” function.

    Untitled

    msg.payload={
        "timestamp_ms": msg.timestamp,
        "state": 210000
    }
    msg.topic = "ia/"customerID"/"location"/"AssetID"/state"
    return msg;
    
  6. The last step is to just send this message out via a MQTT-OUT node.