AssetData sample - Interacting via airvantage

I have set-up and run the the assetData sample app provided in Legato Framework 17.07.
The Room information is successfully being pushed to airvantage and is showing up in the communication timeline.

What I am wondering is, how do I now interact with this app via airvantage (i.e trigger commands, push data back to mangoh).

The application definition specifies that AirVantage can do the following actions:
* Retrieve the name of the room, the current room temperature and the current status of the AC (On or Off)
* Set the target temperature of the room, the AC is automatically switched On
* Trigger a command to turn off the AC

Thanks

Hi,

For you application model which upload to AirVantage, probably you need to add something like:

< command path=“light” default-label=“Light pole”>
< parameter id=“isOn” default-label=“Light control” type=“boolean”/>

After that you can create a widget to push data back to the module.
On the source code of your sample application, you need to register the handler like below:(be careful of the path below)

static void ExecLightCtrlCmd
(
const char* path,
le_avdata_AccessType_t accessType,
le_avdata_ArgumentListRef_t argumentList,
void* contextPtr
)

{

bool isOn = false;


le_avdata_GetBoolArg(argumentList, "isOn", &isOn);
  
LE_INFO("ExecLightCtrlCmd isOn=%d",isOn);


// Reply the AirVantage server with the command execution result.

le_avdata_ReplyExecResult(argumentList, LE_OK);

}

}

le_result_t resultCreateLightCmd = le_avdata_CreateResource(“/mangoh/light”, LE_AVDATA_ACCESS_COMMAND);

if (LE_FAULT == resultCreateLightCmd)

{

LE_ERROR("Error in creating /mangoh/light");

}

le_avdata_AddResourceEventHandler(“/mangoh/light”, ExecLightCtrlCmd, NULL);

1 Like

Thanks for your help! worked perfectly. Do you happen to know how to fetch the data that has been pushed already via the rest api?
Thank you

Hi,

Can you see it in the timeline in AVMS server after your module pushed the data to AVMS server?

Hey yeah I can see it in the timeline

You can have a look on here to see how to add the widget the show the data:
https://doc.airvantage.net/av/reference/dashboard/howtos/customizeDataDisplay/

Thank you, but I am trying to display the data on another website. So what I am wondering is, can I fetch this data via a HTTP request? Do you know if the Airvantage REST api let’s you do this?