Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Datapoint selectInput and surroundMode are not in correct format #316

Open
dirkhe opened this issue Apr 16, 2023 · 1 comment
Open

Datapoint selectInput and surroundMode are not in correct format #316

dirkhe opened this issue Apr 16, 2023 · 1 comment

Comments

@dirkhe
Copy link

dirkhe commented Apr 16, 2023

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

@foxriver76
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants