Skip to content

Getting Started

Where can you find it

You can access to the Scenes Menu by clicking on Smart Scenes voice between the Data Connectors field and the Smart Actions one.

Find

What is a Scene

A Scene is a sequence of commands that perform one or more functions. These Scenes are coded with a scripting language called: Lua. Each Scene may act on a Node, a Variable, a Gatewasy or even on another Scene.

Smart Scene and Script Lua 5.1 Scene

Find

They represent a simple way to create a Scene without any particular knowledge: infact you only have to choose your Conditions that need to be met to trigger the selected Actions





They are pure Lua code inserted and executed by the User. It's not recomended for beginners.


Script Lua 5.1 Scene: example

In the Scene below, we get the Tag: Temperature from the Node with

  • AppEUI: 0C00001104151763
  • DevEUI: 0E7CD56433306500

Then we convert the Temperature into an integer type and compare it. If the Temperature is higher than 30, we call resiot_sendemail wich, obviously, send an e-mail with object and subject. If the Temperature is lower than 30, we set the value of the Variable "Temperature" to "The temperature is lower than 30°C" .

temperatureString, err = resiot_getnodevalue("0C00001104151763", "0E7CD56433306500", "Temperature")
temperature = tonumber(temperatureString)
if temperature > 30 then
  err = resiot_sendemail("test@test.com", "Temperature", "Hey, the temperature is higher than 30°C")
  if !err then
    resiot_debug("Error sending e-mail.")
   else
    resiot_debug("E-mail successfuly sent!")
   end
else
  err = resiot_setvarstr("Temperature", "The temperature is lower than 30°C")
  if !err then
    resiot_debug("Error changing variable value.")
   else
    resiot_debug("Variable successfully changed!")
   end
end