-
Notifications
You must be signed in to change notification settings - Fork 0
Triggered Event
Event processing is done by the backed Esper (4.9) Engine. For modeling a Triggered Event Process you should know something about Event Processing Language (EPL) queries. See the EPL documentation.
There is also an online tool (not provided by Esper), which lets you play around with EPL queries.
At the moment all events can be received by the SensorEvent
class. The process will block, till a given event was received by Esper.
You can also use parameters in your query. To do so, create some StartDataPort
on the Triggered Event Process and assign a data type. Within the EPL query use the placeholder <{Your_DataType_Name}>
. The query is then parsed in the execution and the placeholder is replaced by the value from the StartDataPort.
Example:
select * from SensorEvent where value = 'ON' and deviceUid like '<{someDeviceUid}>_%'
turned to the following by PROtEUS if the StartDataPort contains the a StringType with name "someDeviceUid" and the value "homematic_gong_gong":
select * from SensorEvent where value = 'ON' and deviceUid like 'homematic_gong_gong_%'
Note: The value
is only available as string and must be cast to the required data type if no string is used.
- value (String)
the value of the event (e.g. ON, 42.5, ...) - sensing (String)
- timestamp (long)
- device (Device)
gets the device which triggers the event - datatype (Class)
- eventType (EventType)
the name of the event (e.g. temperatureEvent) - typeName (String)
- uid (String)
- location (String)
- deviceUid (String)
- deviceLocation (String)
This example will react on different health states (emergency button, low heart rate, low blood oxygen saturation).
select * from SensorEvent
where (eventType.typeName = 'HeartRateMeasurementState' and cast(value?, int) > 140)
or (eventType.typeName = 'CallHelpState' and value= 'ON')
or (eventType.typeName = 'BloodOxygenSaturationMeasurementState' and cast(value?, int) < 82 )
The NFC Tag has some random UID so we just compare the values.
select * from SensorEvent where value = '04sfdsfsdf8234' or value='04sdfsdf92es0'
Process is triggered, if someone is ringing.
In this example it is important to filter for the deviceUid
since in our setup are a lot of devices, which send the value "ON".
select * from SensorEvent where value = 'ON' and deviceUid like 'homematic_gong_gong_%'
If the light intensity exceeds given ranges.
select value from SensorEvent where device.uid = 'tinkerforge_ambientLight_ambientLight_1'
and ( cast(value?, double) < 650 or cast(value?, double) > 750 )