setSettings does not work for all types of settings

It seems like I may have hit a bug with the Athom software:
setSettings should accept settings of “any” type according to the documentation:

However, if I have a setting defined with
“type”: “dropdown”,
as described here:

then calling setSettings will report an error as follows:

Device.onInit Error: Error: invalid_setting_type
    at Remote Process
 {
  code: 400
}

This essentially makes the dropdown setting partially useless unless there is another way to set it.

on a similar note using “type”: “label”

Then the app does not validate against level ‘debug’
When trying to run
homey app run

Seems like both “dropdown” and “label” types has issues.

How do you set the settings? Do you pass the value as string?
Are you passing a JSON object as parameter like { fieldname: “dropdown-id”}?

I had issues when more than one setting had no default value and I tried to set only one of then. So pleass make sure that every setting has a default value on devide adding.

See: device.setSettings( ) resulting in exception for valid values if other settings than this setting are not already existing in device · Issue #248 · athombv/homey-apps-sdk-issues · GitHub

2 Likes

The latest homey CLI tool still doesn’t validate if a setting has a default value :roll_eyes:

Do you have an example? I just added a new setting with a default value. I have latest CLI installed (the latest update automatically shown).

        {
          "id": "username",
          "type": "text",
          "label": {
            "en": "Username"
          },
          "hint": {
            "en": "The name of the user."
          }
        },

No default value, no errors when uploading the app to my Homey.

And no update on github. I think it has a really low priority.

How do you set the settings? Do you pass the value as string?

It turned out that I was trying to set the “dropdown” and “label” type settings to values while it was required to set them to strings.
Thanks