Device does not apply the value of the property with Arduino IoT Cloud API

I have a question Arduino IoT Cloud API.

I wrote this code to light up the LED controlled by the .ino side, but the LED does not light up on the device side even though the values are applied on the dashboard.

device: Arduino MKR WIFI 1010
nodejs version: 14.17.3
"@arduino/arduino-iot-client": "1.3.8",
"request-promise": "4.2.6"

js code is here

var IotApi = require("@arduino/arduino-iot-client");
var rp = require("request-promise");

async function getToken() {
  var options = {
    method: "POST",
    url: "",
    headers: { "content-type": "application/x-www-form-urlencoded" },
    json: true,
    form: {
      grant_type: "client_credentials",
      client_id: "~~~~~~~~",
      client_secret: "~~~~~~~~",
      audience: "",

  try {
    const response = await rp(options);
    return response["access_token"];
  } catch (error) {
    console.error("Failed getting an access token: " + error);

async function run() {
  var client = IotApi.ApiClient.instance;
  // Configure OAuth2 access token for authorization: oauth2
  var oauth2 = client.authentications["oauth2"];
  oauth2.accessToken = await getToken();

  var apip = new IotApi.PropertiesV2Api();
  var id ="~~~~~~~~" // thing id
  var pid ="~~~~~~~~" // property id
  var did="~~~~~~~~" // device id
  // it's move
  var opts = {
    showDeleted: true, // {Boolean} If true, shows the soft deleted properties
  apip.propertiesV2List(id, opts).then(
    function (data) {
        "API called successfully. Returned data: " + JSON.stringify(data)
    function (error) {

  const _sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
  await _sleep(1000);

  // console shows "API called successfully." but device is not move.
  var propertyValue = {
    "device_id": did,
    value: true,

    apip.propertiesV2Publish(id, pid, propertyValue).then(
      function () {
        console.log("API called successfully.");
      function (error) {


This program turns on the LED by changing the bool value of a property that is linked to the LED. Since we have already checked that the LED lights up from the dashboard, we think that there is no problem on .ino code side.

Also, we have confirmed that the value is applied in the Arduino IoT Cloud property by this code from the dashboard. However, the value is not reflected in the LED on the device.

If you have any advice, please let me know.


This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.