Note: We have updated this post for ARTIK Cloud. Read it here!
In this post we discuss a SAMI Rules feature that is one of the least visible, yet most powerful. With this feature, device fields can be more than Rule triggers; you can also use them as parameter values in the commands sent to devices.
In the previous post I built a simple Rule from a SmartThings motion sensor (
motion field) and button (
You may have discovered another feature while writing THEN conditions for your own Rules. Any device Action that has a parameter can use the values from device fields as parameter values. Here are two examples of using device fields in a parameter.
Motion sensor sends an email notification
Create a new Rule with the same IF condition we used the first time: SmartThings motion sensor
motion is equal to “moving”.
Select “Send Email” for the THEN condition (it’s under Other Actions). In the dialog that expands below, notice the buttons next to “subject” and “body”. This button calls up a list of your devices, with recent devices (like the motion sensor we have just placed in the IF pane) sorted to the top.
Here we can select the same
motion field used in the IF statement. The motion state will be the subject of the email. You can also mix the field with regular text, as shown here in the email body:
You can remove any device field in a parameter dialog by clicking the “X” control or simply pressing backspace.
In this way you can observe directly what values are changing on the device, rather than having to infer this from the Actions that result in other devices.
Below is how the Rule incorporates the motion sensor field:
IF SmartThings Fibaro Motion Sensor motion is moving THEN send email with to="email@example.com","subject"="[SmartThings Fibaro Motion Sensor]motion","body"="Hello. You might want to know that [SmartThings Fibaro Motion Sensor]motion has been detected.
And here is how the Rule comes together:
Tizen TV displays a phone caller
In this Rule, a Tizen TV is instructed to display the incoming phone number when you receive calls.
The Rule is triggered whenever the
callingNumber field of the MyCallerID device is not blank. This sends a
setText Action to the Tizen TV. The “text” dialog can be populated with any text, but here we simply display the value of
Let us know what Rules you have created, and stay tuned for more about SAMI Rules!