Skip to content

Match thing variable_name with dashboard variable_id #128

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

Merged
merged 2 commits into from
Oct 5, 2022

Conversation

pennam
Copy link
Collaborator

@pennam pennam commented Oct 3, 2022

Motivation

When creating a dashboard variable_id is matched with name instead of variable_name

Change description

Match variable_id with variable_name

Additional Notes

Reviewer checklist

  • PR address a single concern.
  • PR title and description are properly filled.
  • Changes will be merged in main.
  • Changes are covered by tests.
  • Logging is meaningful in case of troubleshooting.
  • History is clean, commit messages are meaningful (see CONTRIBUTING.md) and are well formatted.

@pennam pennam requested a review from polldo October 3, 2022 07:38
@polldo
Copy link
Contributor

polldo commented Oct 4, 2022

Let me understand: why do you expect a match with VariableName instead of Name ?

Where VariableName is "The sketch variable name of the property".
And Name is "The friendly name of the property".

@pennam
Copy link
Collaborator Author

pennam commented Oct 4, 2022

Because is my understandig that the variable_id value of a dashboard contains the VariableName value of the Thing template and not the Name.

Assuming this is your thing template

variables:
    - name: Temperature
      permission: READ_ONLY
      type: FLOAT
      update_parameter: 0
      update_strategy: ON_CHANGE
      variable_name: temperature
    - name: Led
      permission: READ_ONLY
      type: STATUS
      update_parameter: 0
      update_strategy: ON_CHANGE
      variable_name: led

and this your dashboard template

widgets:
- height: 4
  height_mobile: 4
  name: Temperature
  options:
    showThing: true
  type: Value
  variables:
  - thing_id: x-template
    variable_id: temperature
  width: 4
  width_mobile: 4
  x: 4
  x_mobile: 4
  "y": 0
  y_mobile: 0
- height: 4
  height_mobile: 4
  name: Led
  options:
    frameless: false
    mode: Color 2
    showThing: true
  type: LED
  variables:
  - thing_id: x-template
    variable_id: led
  width: 4
  width_mobile: 4
  x: 0
  x_mobile: 0
  "y": 0
  y_mobile: 0

The matching procedure will not work because is trying to mach dashboard variable_id: temperature with thing name:Temperature

@polldo
Copy link
Contributor

polldo commented Oct 4, 2022

Ohh ok, so when a dashboard is extracted the variable_id fields are filled with VariableName. However when they're imported to create a dashboard the field name is used instead.

Right, so to fix the inconsistency we have to decide if we want to use VariableName (as you did) or Name.
I don't see problems with your proposal.

Unfortunately all the "templating" part is really confusing and needs to be redesigned.

@manchoz
Copy link
Collaborator

manchoz commented Oct 5, 2022

Tested and it works.

@polldo polldo merged commit 34d139e into arduino:main Oct 5, 2022
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

Successfully merging this pull request may close these issues.

3 participants