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

Some of the configuration parameters are ignored when adding a channel #2978

Closed
lolodomo opened this issue Jan 4, 2025 · 3 comments
Closed
Labels
bug Something isn't working main ui Main UI

Comments

@lolodomo
Copy link
Contributor

lolodomo commented Jan 4, 2025

The problem

Main UI is calling the REST API with an invalid thing parameter. By invalid, I mean some of the channel configuration parameters are missing.

Expected behavior

The REST API should be called with a valid parameter containing all channel configuration parameters.

Steps to reproduce

Using the netatmo binding, I use Main UI to add a channel:

image

As you can see, there are two configuration parameters.

Here is what contains the API call.

image

As you can see, there is only one of both parameters:

image

I am also surprised to see two calls to the PUT API which are identical. Any reason to call the API twice?

Here is how is defined the thing type:

{
  "parameters": [
    {
      "default": "MIN",
      "description": "Définit la limite demandée.",
      "label": "Limite",
      "name": "limit",
      "required": false,
      "type": "TEXT",
      "readOnly": false,
      "multiple": false,
      "advanced": false,
      "verify": false,
      "limitToOptions": true,
      "options": [
        {
          "label": "Minimum",
          "value": "MIN"
        },
        {
          "label": "Maximum",
          "value": "MAX"
        }
      ],
      "filterCriteria": []
    },
    {
      "default": "1week",
      "description": "Période d’observation pour la limite recherchée.",
      "label": "Période",
      "name": "period",
      "required": false,
      "type": "TEXT",
      "readOnly": false,
      "multiple": false,
      "advanced": false,
      "verify": false,
      "limitToOptions": true,
      "options": [
        {
          "label": "30 minutes",
          "value": "30min"
        },
        {
          "label": "1 heure",
          "value": "1hour"
        },
        {
          "label": "3 heures",
          "value": "3hours"
        },
        {
          "label": "Aujourd'hui",
          "value": "1day"
        },
        {
          "label": "Cette semaine",
          "value": "1week"
        },
        {
          "label": "Ce mois",
          "value": "1month"
        }
      ],
      "filterCriteria": []
    }
  ],
  "parameterGroups": [],
  "label": "CO2 Measurement",
  "itemType": "Number:Dimensionless",
  "kind": "STATE",
  "stateDescription": {
    "pattern": "%.0f %unit%",
    "readOnly": true,
    "options": []
  },
  "tags": [],
  "UID": "netatmo:co2-measurement",
  "advanced": false
}

Here is channel in the thing JSON file:

        {
          "uid": "netatmo:weather-station:compte:70ee5004c64a:min-co2-hour",
          "id": "min-co2-hour",
          "channelTypeUID": "netatmo:co2-measurement",
          "itemType": "Number:Dimensionless",
          "kind": "STATE",
          "label": "CO2 Measurement",
          "description": "",
          "defaultTags": [],
          "properties": {},
          "configuration": {
            "period": "1hour"
          }
        }

What I can notice is that depending on the channel I am creating on this thing, this is not always the same parameter that is finally kept, but I always have only one of both expected parameters.

@lolodomo lolodomo added bug Something isn't working main ui Main UI labels Jan 4, 2025
@lolodomo
Copy link
Contributor Author

lolodomo commented Jan 4, 2025

@florian-h05 : can you have a look, I am surprised to find such a bug. That would mean no one is creating channel with several parameters using Main UI.

@florian-h05
Copy link
Contributor

Main UI is behaving correctly here:
It is only setting the period parameter explicitly, because you selected a value different from the default.
The limit parameter is not changed away from its default value, that is declared as MIN.

Applying config defaults is not the job of the UI, but rather of the one saying this is the default, i.e. the binding.

@lolodomo
Copy link
Contributor Author

lolodomo commented Jan 4, 2025

Oh you're right, I did not take care about the default values.

@lolodomo lolodomo closed this as completed Jan 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working main ui Main UI
Projects
None yet
Development

No branches or pull requests

2 participants