Selected view

Hi,

I have a wallpanel where I want to be able to know which view is selected.
My first idea was to set a boolean helper when a view is selected but that doesn’t seem to work.
Something when the dashboard is loaded doesn’t seem to work either.

Is there a way to do this?

Thanks.

Maybe browser path variable of a registered browser in browser mod?

You could possibly use the JavaScript based custom:button-card

type: custom:button-card
name: |
  [[[
    let a = window.location.pathname;
    let dash = a.substring(a.lastIndexOf('/') + 1);
    return dash;
  ]]]

1 Like

Yes, this should do the job. Thanks.

1 Like

If you want to capitalize the data use this

type: custom:button-card
name: |
  [[[
    let a = window.location.pathname;
    let path = a.substring(a.lastIndexOf('/') + 1);
    return path;
  ]]]
styles:
  name:
    - text-transform: capitalize

What I actually want to achieve is when the doorbell is pressed navigate to view 5. Which is the camera. After 30 seconds return to the view that was selected.
I’m still struggling with that.