Analysis with Blueprint dashboards

Analysis with Blueprint dashboards

Greetings:

I'm attempting to implement a very simple analysis that reads a device parameter, acts on it, and writes a new parameter back to the device. This is exactly what the "Operate data from devices" example snippet appears to do.

In my case, I wish to use this analysis with a Blueprint dashboard when called from a Push Button widget.

I have changed the original:
const env_vars = Utils.envToJson(context.environment);
const device = new Device({ token: env_vars.device_token });

To:
const variable = scope[0];
const device_id = variable.device;
const device = new Device({ token: context.token, id: device_id });


But the script is unable to find the device parameters. Any suggestions?