lovelace-card-templater icon indicating copy to clipboard operation
lovelace-card-templater copied to clipboard

Usable to template a URL in the iframe card?

Open bobvmierlo opened this issue 4 years ago • 1 comments

I'm trying to template a url in the iframe card. However when I try to set a url_template the card falls back to the homeassistant page in the iframe.

I'm using:

type: 'custom:card-templater'
card:
  aspect_ratio: 100%
  type: iframe
  url_template: >-
    https://www.google.com/maps/embed/v1/directions?key=AIzaSyDNiVmlNrX3WE3AM-wq_dOe9E9h7yaoOXo&origin=Address+1+Town&destination={{states("input_text.bestemming")}}

bobvmierlo avatar Jul 24 '20 19:07 bobvmierlo

Same here, in my case I use it to change grafana embebed charts theme from light to dark depending on the sun position.

type: 'custom:card-templater'
card:
  aspect_ratio: 50%
  type: iframe
  url_template: >-
    {{
    "http://192.168.X.X/d-solo/XXXX/XXXX?from=now-24h&to=now&orgId=1&theme=light&panelId=2"
    if is_state('sun.sun', 'above_horizon')
      else "http://192.168.X:X/d-solo/XXXX/XXXX?from=now-24h&to=now&orgId=1&theme=dark&panelId=2" }}
entities:
  - sun.sun

I have to force refresh site to get the charts visible.

alceasan avatar Sep 02 '20 10:09 alceasan