How can I open a dynamic webpage through HA?

I wan’t to have a google maps link that I can somehow open on the device that is using the web interface (meaning call service browser.browse_url does not work).

What is the options?

I tried a button on lovelace

- entity: input_boolean.car_gps_petra
      tap_action:
        action: url
        url_path: '{{ states.input_text.car_gps_petra_url.state }}'

Where the state is the URL, but it seems the template is not evaluated.

The only other way I can think of is to use actionable notification to a phone. It works but it’s not really what I want.

I don’t think you can normally use templates in Lovelace. However, there are some custom cards that add support for that, but you usually have to wrap whatever card you want to use templates with inside the custom card, e.g.

Have a look at my thread on how to use the config-template-card to dynamically load different sensors on a history graph.
Using the same procedure you can dynamically change your iframe card url, depending on your input_boolean value.

I will have a look at those.
I thought of a different solution yesterday while in bed.

If I use a static link, and this URL uses meta redirect to redirect to the dynamic URL.
If I instead visit the URL with a get command (http://URL.com?URL=something) then it should update the URL it links too.
That way I can use Node red (where I set the input_text) to do a webcall and change the redirect URL.

I will have to see which is the best solution. But this solution means it can be a button and not a separate card.
But I have not looked at the other solutions much yet. Just woke up.

Just in case someone comes across this looking for a solution, this looks promising:

1 Like