Help with configuring slider range in asset attribute

Hi all,

I’m successfully using a switch icon by creating a Boolean attribute and adding a format configuration item like this:

{
“asOnOff”: true
}

Likewise, I’m able to create a slider using a Number attribute with the following format:

{
“asSlider”: true
}

However, I’m having trouble setting the slider range. I’d like to set a minimum of 0 and maximum of 100, but the slider currently appears maxed out at 100% with no visible variability or ability to set a different value.

I’ve tried using constraints like this:

{
“minimum”: 0,
“maximum”: 100
}

But this results in a “Failed to save asset” error. Has anyone managed to set a range successfully for a slider? Any advice would be appreciated.

Thanks

Any response to this would be appreciated.

Thanks
Clint

Hey @Clint,

The JSON configuration items can be a bit tricky as they don’t describe what you can fill in.

The value for the Format configuration item would be:

{
  "asSlider": true,
  "asOnOff": true
}

The value for the Constraints configuration item would be:

[
  {
    "type": "min",
    "min": 0
  },
  {
    "type": "max"
    "max": 100
  }
]

I’m currently working on some functionality that will help show you what can be entered.

If you would like to try it out and know how to get the manager up and running you can try it by going to this git branch GitHub - openremote/openremote at dynamic-json-forms/generic.

Thanks @Koen - much appreciated.

That worked. For the slider I used:

{
“asSlider”: true
}

Note I corrected the typo i.e. missing comma in the Constraints JSON example:
[
{
“type”: “min”,
“min”: 0
},
{
“type”: “max”,
“max”: 100
}
]

I’ll check out the GIT branch.

Thanks again