Hi everyone, I don't quite understand how to set up and use actions. Does an action publish a topic to an end device? I read all the examples but if someone could give me a clearer explanation, thanks.
Answers
-
Hi Jean-Pierre.
Actions allow you to manage a queue of requests to your device following this API structure.Following the example in this tutorial, imagine you want to define an action to switch the lamp on and off.Once you have defined your action:"actions": { "toggle": { "description" : "Turn the lamp on or off" } },
You can type ON or OFF in the input gap of your action and press the run button. You will see that the action appears in the Call History section with the status pending.The last thing you need to do is define the logic behind that action. In this example, the function code will manage that every time the run button in the action is pressed, based on the input data (ON or OFF) a request to the light needs to be made to actually turn it ON/OFF.
In the end, the actions interface will allow you to have a log history of the actions performed as well as an easy way to trigger the actions.
I hope you find this information useful, and thanks for your feedback
0 -
Thank you very much Paloma for these explanations, I made a conclusive test.
0