Adding an Action
Scenario Objective
Enhance your scenario by integrating outdoor temperature data. In this example, after setting up your basic scenario, you will add an Action
node that calls the meteomatics
plugin to fetch the outdoor temperature. This data can then be used to drive further actions in your scenario.
Tip
If you do not have meteomatics
plugin, install it from the A.V.A.T.A.R projects plugin library. You can always remove it if it doesn't suit your needs, or modify the example with one of your own plugins.
Understanding How to Call a Plugin
To call a plugin, A.V.A.T.A.R needs several pieces of information:
-
A.V.A.T.A.R-Specific Information:
These parameters are mandatory and must always be included in the task parameters:
- language: The language code used.
- client: The client that sent the task.
The
client
parameter is automatically filled based on the client you selected to send the task, while thelanguage
parameter must always be updated manually.For example, for English (
en
) and a client "Living room":const parameters = { language: "en", client: "Living room" };
Note
Another optional parameter, toClient
, may be automatically added to the A.V.A.T.A.R-specific parameters if you select a client from the "Client executing the task" list. See the Clients Tab for more details.
Plugin-Specific Information
All other parameters are defined for the plugin and the function to be executed.
None of these parameters are mandatory, including the command
parameter which is added by default to simplify additions (the majority of plugins execute functions from a command array data.action.command
).
If a plugin does not use this command array and executes directly, remove the command
parameter.
Steps to Add the Action Node
-
Modify the Scenario Layout
First, adjust your scenario layout as shown below: -
Update the
Speak
Node
Open the configuration of theSpeak
node and modify its behavior so that it works seamlessly with the newAction
node. -
Configure the
Action
Node
Open the configuration of theAction
node and update its parameters to call themeteomatics
plugin, which will provide the outdoor temperature data. -
Save Your Changes
Don’t forget to save the scenario after making these modifications. -
Refresh the Job Status
Click on theCalendar
node to refresh the job status. If the job is not running, you can restart it by clicking on it.
Congratulations! You have successfully enhanced your scenario to include outdoor temperature data from the meteomatics
plugin.