ioBroker.denon icon indicating copy to clipboard operation
ioBroker.denon copied to clipboard

Datapoint selectInput and surroundMode are not in correct format

Open dirkhe opened this issue 1 year ago • 1 comments

Describe the bug the datapoints selectInput and surroundMode are from type string, but the have a state list. If you change the datapoint via admin, you get the list and choose one. Here the number of List (key) is set to Datapoint. In the readme you say also, set the key:

Beispiel:

 setState('denon.0.zoneMain.selectInput', '5'); // Selects TV as input for Main Zone  

But in you code you set the string:

   } else if (/^Z\d.*/g.test(command)) {
            // Encode Input Source
            const obj = await adapter.getObjectAsync('zoneMain.selectInput');
            let zoneSi = data.substring(2);
            zoneSi = zoneSi.replace(' ', ''); // Remove blank
            for (const j of Object.keys(obj!.common.states)) {
                // Check if command contains one of the possible Select Inputs
                if (helper.decodeState(obj!.common.states, j.toString()) === zoneSi) {
                    ensureAttrInStates(`zone${zoneNumber}.selectInput`, zoneSi);
                    adapter.setState(`zone${zoneNumber}.selectInput`, zoneSi, true);
                    return;

So, I think, here you have to set the key instead. A possibility could be, to return in ensureAttrInStates the index and use them in setState

The reason, why I asked to do this is because I want to use it in iQontrol and this uses a State list as selectbox, but if the "key" not found, it shows only the string.

To Reproduce Steps to reproduce the behavior:

  1. change input on device and check the datapoint in iobroker admin
  2. change the input in admin to see, how it is stored than

Expected behavior the datapoint is set with key instead of value

Screenshots & Logfiles grafik grafik grafik

dirkhe avatar Apr 16 '23 15:04 dirkhe

The problem is, that the value which is sent back from the AVR is often not one of the list, thus this datapoint woudl need to be split in two dps. It is a bit historically grown unfortunately.

foxriver76 avatar Jun 02 '23 06:06 foxriver76