Dynamic iFrame?

Does anyone know how to make iframe with a dynamic (templated) url ?

I did my card like this and included he elements i needed

type: iframe
url: >-
  https://embed.waze.com/iframe?zoom=14&lat={{state_attr('sensor.geocode_destination','latitude')}}&lon={{state_attr('sensor.geocode_destination','longitude')}}&pin=1&desc=1
aspect_ratio: 50%

If i run this through template, it equates to the correct address (verified) but the card displays a blank map

Webpage Card’s url is not templatable.
Initially, I thought it might be possible to put an <iframe> in a markdown card, but it seems to just render it as text (probably for security reasons).
I think you might have to look for a custom card to do this. I’ve found Lovelace card-templater card (Jinja2 card templating in Lovelace!), but I haven’t tested it myself.

2 Likes
type: custom:card-templater
card:
  type: iframe
  url_template: >-
    https://embed.waze.com/iframe?zoom=14&lat={{state_attr('sensor.geocode_destination','latitude')}}&lon={{state_attr('sensor.geocode_destination','longitude')}}&pin=1&desc=1
  aspect_ratio: 50%
entities:
  - entity: sensor.geocode_destination

genius!
i initially didnt think it was working because the edit page preview didnt render it. But upon save, it worked a treat.

really appreciate you taking the time to answer.

1 Like