t6 Features > Decision Rules

Decision Rules

Decision-Rule is the event-based engine that trigger Actions following matching Conditions. Engine is watching for fact matching conditions on payloads coming from Datapoints POST, and handle Action(s) according to rules.

Tagged on #resource, #engine, #rules,

Fact measured from datapoint

The fact is actually the payload POSTed to Datapoints endpoint. This contains some attributes that can be used in the matching Conditions

NEWS : Since july 2023, Rules can be sent on the datapoint payload directly hence this is not necessary to use saved rules. This new feature is adding the custom Rule from the payload to the user Rules saved in database.

Conditions matching operators

Conditions supports combination by using all and any boolean operators. This give the ability for Rules to match multiple complex Conditions.

The following Condition will match when a datapoint is POSTed to flow_id cb518da8-xxxx-xxxx-xxxx-95b3b2bbfd8f and only when the environment is “development”.

{
    "all": [
        {
            "fact": "environment",
            "operator": "equal",
            "value": "development"
        },
        {
            "fact": "flow",
            "operator": "equal",
            "value": "cb518da8-xxxx-xxxx-xxxx-95b3b2bbfd8f"
        }
    ]
}

Operators

Operators allows to compare the value of Facts and so determine when the Rule is matching Conditions.

{"all":[{"fact":"dtepoch","operator":"isDayTime","value":true}]}
{"all":[{"fact":"value","operator":"lastEventGreaterThanInclusive","value":3600}]}
{"all":[{"fact":"value","operator":"lastEventLessThanInclusive","value":3600}]}
{"all":[{"fact":"value","operator":"anomalyGreaterThanInclusive","value":1234}]}
{"all":[{"fact":"value","operator":"anomalyLessThanInclusive","value":1234}]}
{"all":[{"fact":"value","operator":"changeGreaterThanInclusive","value":1234}]}
{"all":[{"fact":"value","operator":"changeLessThanInclusive","value":1234}]}
{"all":[{"fact":"value","operator":"sentimentScoreGreaterThanInclusive","value":2}]}
{"all":[{"fact":"value","operator":"sentimentScoreLessThanInclusive","value":-1}]}

Geofencing special behaviour : distanceGreaterThan operator used in combination with replaceWithDistance action will substitute the payload value with the distance calculated in meters.

{"all":[{"fact":"value","operator":"distanceGreaterThan","value":100}]}

Geofencing special behaviour : distanceGreaterThan operator used in combination with replaceWithDistance action will substitute the payload value with the distance calculated in meters.

{"all":[{"fact":"value","operator":"distanceLessThan","value":100}]}

Action types

Please contact us, by openning a new issue, if any other Actions would be relevant to your use-case.

Here is the available Action list :

annotate

This trigger action is used on Data-annotation process and require an additional category_id on its event parameters.

email

email action will send an email message to custom recipients and custom body.

Some variable caan be used inside body :

${value}

httpWebhook

This trigger a call to a custom url with custom parameters, so that you can handle the response on your own server.

Ifttt:

TODO

model_classify

The model_classify will trigger the payload to be evaluated on a model (the model_id must be passed as event parameter)

mqttCommand

The mqttCommand will trigger aspecial mqtt message to be sent as a command to a specific Object (the object_id must be passed as event parameter).

mqttPublish

The mqttPublish will trigger an mqtt message to be sent.

replaceWithDistance

The special replaceWithDistance action is used on geofencing situation, and will trigger the value to be substituted with the distance between Object and longitude/latitude passed on payload; calculated in meters.

serial

This will send a specific command as a serial command. the Object must be connected to t6 physically - this feature is disabled on t6 Saas.

slackMessage:

TODO

sms:

TODO

sockets

WebSockets will allows to customize and send a command to one specific Arduino device or broadcast the same message to multiple connected devices.

webPush

This action will send a custom push-notification to your own user.

Tagged on #resource, #engine, #rules,