setSettings results in Error: invalid_setting_type

Hi everyone,

I’m currently working on an app for Homey and encountering this issue when trying to update a settings value in the onInit() method of device.js. Specifically, I’m trying to set the IP address to a label visible in settings using the following code:

await this.setSettings({
  ip_address: "10.10.10.10",
});

Relevant code from driver.compose.json:

"settings": [
  {
    "id": "ip_address",
    "type": "label",
    "label": { "en": "IP address" },
    "value": "192.168.0.10",
    "hint": { "en": "The IP address of the device." }
  }
]

However, I’m getting the following error:

2025-03-09T13:36:32.109Z [err] [ManagerDrivers] [Driver:balboa-spa] [Device:87ddd4b4-affb-455c-ab18-807da51e8088] Device.onInit Error: Error: invalid_setting_type
    at Remote Process
    at HomeyClient.emit (/opt/homey-client/system/manager/ManagerApps/AppProcess/node_modules/@athombv/homey-apps-sdk-v3/lib/HomeyClient.js:1:312)
    at Object.emit (/opt/homey-client/system/manager/ManagerApps/AppProcess/node_modules/@athombv/homey-apps-sdk-v3/manager/drivers.js:78:54)
    at Object.emit (/opt/homey-client/system/manager/ManagerApps/AppProcess/node_modules/@athombv/homey-apps-sdk-v3/lib/Driver.js:1:1668)
    at BalboaSpa.setSettings (/opt/homey-client/system/manager/ManagerApps/AppProcess/node_modules/@athombv/homey-apps-sdk-v3/lib/Device.js:1:5033)
    at BalboaSpa.onInit (/drivers/balboa-spa/device.js:13:16)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async BalboaSpa._onInit (/opt/homey-client/system/manager/ManagerApps/AppProcess/node_modules/@athombv/homey-apps-sdk-v3/lib/Device.js:1:1682) {
  code: 400
}

I’ve tried changing the setting type to text in driver.compose.json:

"settings": [
  {
    "id": "ip_address",
    "type": "text",
    "label": { "en": "IP address" },
    "value": "192.168.0.10",
    "hint": { "en": "The IP address of the device." }
  }
]

But I’m still encountering the same issue and don’t get how the issue were resolved in this thread. Does anyone have any insights or suggestions on how to resolve this error?

Thanks in advance for your help!

IP address setting from go-e Charger

Settings definition: com.go-e.charger/.homeycompose/drivers/templates/settings.json at main · oh2th-homey/com.go-e.charger · GitHub

And setSettings in code

Thanks @OH2TH for the input! However, making my “setSettings” code identical to the app you provided as a reference did not solve the problem.

Here is the updated code below.

onInit in device.js where I test to setSettings:

  async onInit() {
    this.log(`BalboaSpa initialized: Name - ${this.getName()}, Class - ${this.getClass()}`);
    this.client = new SpaClient(this.getData().id, this.onSpaUpdate.bind(this), this.onSpaError.bind(this));
    await this.client.connect();
    registerCapabilityListeners(this);
	this.setSettings({
		address: "10.10.10.10",
	});
  }

settings in driver.compose.json:

  "settings": [
    {
      "id": "address",
      "type": "text",
      "label": {
        "en": "IP address",
        "nl": "IP adres",
        "de": "IP-Adresse",
        "fr": "Adresse IP"
      },
      "value": "0.0.0.0",
      "hint": {
        "en": "Fixed IP address of the device.",
        "nl": "Vast IP adres van het apparaat.",
        "de": "Feste IP-Adresse des Geräts.",
        "fr": "Adresse IP fixe de l'appareil."
      }
    },
    {
      "id": "sync_time",
      "type": "dropdown",
      "label": {
        "en": "Sync Time"
      },
      "hint": {
        "en": "Select to sync the current time"
      },
      "values": [
        {
          "id": "no_sync",
          "label": {
            "en": ""
          }
        },
        {
          "id": "sync",
          "label": {
            "en": "Sync Now"
          }
        }
      ]
    },
    {
      "type": "group",
      "label": { "en": "Show/Hide Sensors" },
      "children": [
        {
          "id": "pump1",
          "type": "checkbox",
          "label": { "en": "Show Pump 1" },
          "value": true
        },
        {
          "id": "pump2",
          "type": "checkbox",
          "label": { "en": "Show Pump 2" },
          "value": true
        },
        {
          "id": "pump3",
          "type": "checkbox",
          "label": { "en": "Show Pump 3" },
          "value": true
        },
        {
          "id": "pump4",
          "type": "checkbox",
          "label": { "en": "Show Pump 4" },
          "value": true
        },
        {
          "id": "pump5",
          "type": "checkbox",
          "label": { "en": "Show Pump 5" },
          "value": true
        },
        {
          "id": "pump6",
          "type": "checkbox",
          "label": { "en": "Show Pump 6" },
          "value": true
        }
      ]
    }

Error message:

2025-03-09T18:27:03.637Z [log] [ManagerDrivers] [Driver:balboa-spa] [Device:f5a60b6c-fd55-4b64-8257-9daa81063deb] BalboaSpa initialized: Name - BWGSPA (192.168.20.39), Class - thermostat
2025-03-09T18:27:03.864Z [err] Unhandled Rejection at: Promise {
  <rejected> Error: invalid_setting_type
      at Remote Process
      at HomeyClient.emit (/opt/homey-client/system/manager/ManagerApps/AppProcess/node_modules/@athombv/homey-apps-sdk-v3/lib/HomeyClient.js:1:312)
      at Object.emit (/opt/homey-client/system/manager/ManagerApps/AppProcess/node_modules/@athombv/homey-apps-sdk-v3/manager/drivers.js:78:54)
      at Object.emit (/opt/homey-client/system/manager/ManagerApps/AppProcess/node_modules/@athombv/homey-apps-sdk-v3/lib/Driver.js:1:1668)
      at BalboaSpa.setSettings (/opt/homey-client/system/manager/ManagerApps/AppProcess/node_modules/@athombv/homey-apps-sdk-v3/lib/Device.js:1:5033)
      at BalboaSpa.onInit (/drivers/balboa-spa/device.js:13:8)
      at async BalboaSpa._onInit (/opt/homey-client/system/manager/ManagerApps/AppProcess/node_modules/@athombv/homey-apps-sdk-v3/lib/Device.js:1:1682) {
    code: 400
  }
} reason: Error: invalid_setting_type
    at Remote Process
    at HomeyClient.emit (/opt/homey-client/system/manager/ManagerApps/AppProcess/node_modules/@athombv/homey-apps-sdk-v3/lib/HomeyClient.js:1:312)
    at Object.emit (/opt/homey-client/system/manager/ManagerApps/AppProcess/node_modules/@athombv/homey-apps-sdk-v3/manager/drivers.js:78:54)
    at Object.emit (/opt/homey-client/system/manager/ManagerApps/AppProcess/node_modules/@athombv/homey-apps-sdk-v3/lib/Driver.js:1:1668) 
    at BalboaSpa.setSettings (/opt/homey-client/system/manager/ManagerApps/AppProcess/node_modules/@athombv/homey-apps-sdk-v3/lib/Device.js:1:5033)
    at BalboaSpa.onInit (/drivers/balboa-spa/device.js:13:8)
    at async BalboaSpa._onInit (/opt/homey-client/system/manager/ManagerApps/AppProcess/node_modules/@athombv/homey-apps-sdk-v3/lib/Device.js:1:1682) {
  code: 400
}

Have done some more troubleshooting and I am now even more confused.

I am able to set the settings for “sync_time”, see code below.

device.js:
this.setSettings({ sync_time: "no_sync" });

driver.compose.json:

    {
      "id": "sync_time",
      "type": "dropdown",
      "label": {
        "en": "Sync Time"
      },
      "hint": {
        "en": "Select to sync the current time"
      },
      "values": [
        {
          "id": "no_sync",
          "label": {
            "en": ""
          }
        },
        {
          "id": "sync",
          "label": {
            "en": "Sync Now"
          }
        }
      ]
    },

But if I duplicate this settings and just add the number 2 after the name, sync_time2, I get the error invalid_setting_type…

device.js:
this.setSettings({ sync_time2: "no_sync" });

driver.compose.json:

    {
      "id": "sync_time2",
      "type": "dropdown",
      "label": {
        "en": "Sync Time"
      },
      "hint": {
        "en": "Select to sync the current time"
      },
      "values": [
        {
          "id": "no_sync",
          "label": {
            "en": ""
          }
        },
        {
          "id": "sync",
          "label": {
            "en": "Sync Now"
          }
        }
      ]
    },

It’s like the app don’t get the compose update.

You can check the generated app.json file.

Also, I assume you’re deleting the device every time you’ve changed the compose file?

Hi @robertklep,

I just got it working.

I deleted the defined settings in the driver.compose.json, created a driver.settings.compose.json and carefully rewrote the defined settings based on Settings | Homey Apps SDK and now it suddenly works.

I always remove the device before testing. But could it still have been cached? Or did I make a rookie mistake in writing the compose.json? Either way, good point to double check the app.json. Will do so if the problem occurs again.

Thanks!