Examples of LCL
Due to the complexity of the real world, we cannot offer to you examples of everything, but, here are some examples of how to use LCL in real-case scenarios.
Want to contribute?
Send us an email at software@goldenm.com with your example and we will add it to the list.
Multiple tank level totalizer
For this example, we assume that your device sends the level of the tanks in tank.level.0
, tank.level.1
, tank.level.2
, and tank.level.3
. We want to calculate the total level of the tanks and send it to tank.level
.
SUM(
GET_PARAM(
CONCAT(
PRIMARY_DEVICE(),
".tank.level.0"
),
),
GET_PARAM(
CONCAT(
PRIMARY_DEVICE(),
".tank.level.1"
),
),
GET_PARAM(
CONCAT(
PRIMARY_DEVICE(),
".tank.level.2"
),
),
GET_PARAM(
CONCAT(
PRIMARY_DEVICE(),
".tank.level.3"
),
)
)
Let's look at the code above. We are using the SUM
function to calculate the total level of the tanks. We are using the GET_PARAM
function to get the level of each tank. We are using the CONCAT
function to concatenate the device ident with the tank level.
Alert when the temperature is too high
For this example, we assume that your device has a sensor with param engine.temperature
, and your tolerance of the temperature is 100 degrees
. We want to send an alert when the temperature is higher than 100 degrees
.
Important
Directly with a trigger, you cannot send a notification, you will need the combination of a trigger, an action and a operation to perform this.
GREATER_THAN(
GET_SENSOR("engine.temperature", CONSTANT(0)),
CONSTANT(100)
)
Generate an alert when Layrz Link sends a SOS
Layrz Link is our app to convert your smartphone into a GPS tracker. For this example, we will convert the SOS signal sent from the app into an alert.
Want to know more about Layrz Link?
Contact us at sales@layrz.com or via WhatsApp to +(507)-6979-3073 and we will be happy to prepare a live demo for you.
COMPARE(
GET_PARAM(
CONCAT(
PRIMARY_DEVICE(),
".alarm.event"
),
),
CONSTANT(1)
)