hExPY
(Marvyn Zalewski)
August 24, 2017, 3:53pm
1
Hey guys,
i try to use the habpanel selection widget with configuration loaded from the server (not in csv format in the widget config). I’am not able to set the Item.stateDescription.options value.
It is defined here:
function updateValue() {
vm.item = OHService.getItem(vm.widget.item);
if (!vm.item || vm.item.state === vm.value) return;
vm.value = vm.item.transformedState || vm.item.state;
vm.state = vm.item.state;
if (!vm.choices) {
switch (vm.widget.choices_source) {
case 'server':
vm.choices = vm.item.stateDescription.options.map(function (option) {
return { cmd: option.value, label: option.label };
});
break;
case 'csv':
vm.choices = vm.widget.choices.split(',').map(function (choice) {
choice = choice.split('=');
if (choice.length === 2) {
return { cmd: choice[0], label: choice[1] };
} else {
return { cmd: choice[0], label: choice[0] };
The rest api responded with:
{
"link": "http://xxx:8080/rest/items/home_wz_ambilight_effect",
"state": "NULL",
"transformedState": "\"TV\"",
"stateDescription": {
"pattern": "",
"readOnly": false,
"options": []
},
"type": "String",
"name": "home_wz_ambilight_effect",
"label": "Current Effect",
"tags": [],
"groupNames": []
}
Can anyone tell me how to define the desired variable.
I use the text configuration.
Kind regards,
2 Likes
hExPY
(Marvyn Zalewski)
October 25, 2017, 4:39pm
2