ioBroker.javascript
ioBroker.javascript copied to clipboard
[Enhancement] Allow setState also with "states-Namens" from object definition
For States that have object definition with "states" (1->'ON', 2'OFF') it would be great if the value for "setState" could be also the string defined by the "states" object. This makes it more easy to use for not that experienced users. setState should detect that (via datatype mismatch) and if set value is a string AND matches to one of the defined "states" it should be mapped and the numeric value should be set
Question: Is it possible to have the following situation?
(state) -> (name)
"foo" -> "bar"
"bar" -> "baz"
"baz" -> "foo"
I would guess not, but that could create some problems.
According to specs "states" is only allowed for intager values to map to a "text to be shown in dropdown" https://github.com/ioBroker/ioBroker/blob/master/doc/SCHEMA.md#state
PS: Yes example also shown sstrings ('value2') but some time ago I asked and it should only by numbers allowed as base value
It should also boolean allowed as base value !
I would also like to set the string part to the datapoint. For example: 0:Alexa; 1:Marlene; 2:Vicki; 3:Hans
I would like to set one of these names to a datapoint called "AlexaVoice"