Using variables in yaml Dashboard

Good evening guys,

I am currently experimenting with some dashboards and I want to put a tablet in the hall to make some use for the whole household.
The dashboard I am trying to implement will run in kiosk mode (using kiosk-mode) to navigate between different views I implemented a button bar with buttons for every view. To make it easier to identify at which view one is looking right now I would like to change the color of the icon depicting the currently selected view.

I did not want to have to add the button bar to every view I “exported” it to a yaml which is imported by every view. Thus I thought that I could maybe identify which view is shown currently (via the url or something) and then do something like if else in yaml to show it either yellow or blue.
However I found this variable component but I do not think I could easily access the URL from there and do some if else things.

Here is the code of my “navgation bar”. There are normally some more buttons but as I expect the principle to be the same I shortened the code. This navigation bar is then imported by the different views of my dashboard.

type: grid
view_layout:
  grid-area: header
variables:
  view: "general"
square: false
cards:
  - type: button
    show_name: true
    show_icon: true
    tap_action:
      action: navigate
      navigation_path: /sensor-data/general
    name: General
    icon: mdi:home
    hold_action:
      action: none
  - type: button
    show_name: true
    show_icon: true
    tap_action:
      action: navigate
      navigation_path: /sensor-data/garden
    icon: mdi:flower
    hold_action:
      action: none
    name: Garden
  - type: button
    show_name: true
    show_icon: true
    tap_action:
      action: navigate
      navigation_path: /sensor-data/basement
    icon: mdi:washing-machine
    name: Basement
    hold_action:
      action: none
columns: 6

Hopefully someone has an idea how I could solve this problem.

Best wishes,

Tim

1 Like

Did you solve this? and how? :slight_smile:

Sadly not :frowning: