I would have thought a weather widget would already provide the means to automatically refresh. Since this one apparently doesn’t, you will need to determine how often you want the widget to refresh and set up an HA entity that changes at that interval.
One way to do this is through an input_text entity that is updated via a time_pattern trigger. When this config-template card recognizes that entity changes it will invoke the iframe/url again - this time with a timestamp that should force the browser to refresh the page.
Wow, thanks so much for this @GaryOkie. Exactly what was after - and yes a bit strange the weather widget doesn’t self-update. I’m on the road at the moment, but I’ll put this code in to action tomorrow and let you know how it goes. Cheers.
@GaryOkie, looks like your code works a dream thx. Fyi, and others benefit ,for my convoluted URL, you had a “?” Instead of a “&” before the “v=“ - because I’ve got prior parameters in the line. Otherwise it appears to do the trick nicely!
Is it possible to create a templated picture-elements card, where depending on the user (or peferably the resolution of the screen viewing) it uses image A or image B? Is this something I can achieve with this card?
Basically I have a UI built on picture-elements card and want to use one dashboard for multiple devices, based on the resolution (or user) viewing it. This way I can use either image A or image B (which have dimensions identical to the resolution of the device). Without having to write two separate picture-element cards, but just one.
Can someone help me with this card? I’m trying to use this with a picture-element card, where the variabel is the image file and the user. Basically, depending on the user that is logged in, I want it to use either image A or image B as the image (where all the elements will be tied into). This is the base code that I want to template.
I need to use that for variable right? But I don’t understand what to use for entity in this case? Do you maybe have an example how to achieve this code? I studied your examples on Github, but I’m not getting anywhere.
Hey there - I hope someone here can help me - I’m just too stupid to figure it out on my own…
I use the Bar Card and would simply like to make the target: option follow an input_number
type: 'custom:bar-card'
title: Temperature
entities:
- entity: sensor.climate_dht11_temperature
min: '10'
max: '50'
animation:
state: 'on'
target: 30 # <- this should always be the same number as input_number.set_temp
positions:
minmax: 'off'
value: inside
indicator: inside
icon: outside
name: 'off'
How do I do that? I’m trying this (and similar configurations) for days now, but have no success
EDIT: Ok, I figured part of it out:
What I initially tried to do works like this:
type: 'custom:config-template-card'
variables:
- 'states[''input_number.set_temp''].state'
entities:
- sensor.climate_dht11_temperature
- input_number.set_temp # I've added this, because that way the card refreshes instantly when changing the input_number, not only when the actual temperature changes
card:
type: 'custom:bar-card'
title: Temperatur
animation:
state: 'on'
entities:
- animation:
state: 'off'
entity: sensor.klima_dht11_temperature
max: '50'
min: '10'
target: '${vars[0]}'
positions:
icon: outside
indicator: inside
minmax: 'off'
name: 'off'
value: inside
Being completely hyped by the result, I wanted to up my template-game a bit and add variable colours to the mix - and I’m stuck again…
type: 'custom:config-template-card'
variables:
- 'states[''input_number.set_temp''].state'
entities:
- sensor.climate_dht11_temperature
- input_number.set_temp
card:
type: 'custom:bar-card'
title: Temperatur
animation:
state: 'on'
entities:
- animation:
state: 'off'
entity: sensor.klima_dht11_temperature
max: '50'
min: '10'
target: '${vars[0]}'
severity:
- color: blue
from: '0'
to: '${vars[0] - 4}'
- color: turquoise
from: '${vars[0] - 4}'
to: '${vars[0] - 2}'
- color: green # from here down the colours don't work
from: '${vars[0] - 2}'
to: '${vars[0] + 2}'
- color: orange
from: '${vars[0] + 2}'
to: '${vars[0] + 4}'
- color: red
from: '${vars[0] + 4}'
to: '50'
positions:
icon: outside
indicator: inside
minmax: 'off'
name: 'off'
value: inside
All severity colours that are lower than the input_number.set_temp work, as soon as they are higher, it goes green (default colour)
May be its a well-known issue.
Found a problem with config-template-card.
Two or more cards are not distributed properly on the screen - all of them are placed in one column.
Once again I’ve reached the limits of my understanding of Templating …
I have a couple of utility_meters and would like to show their last_period states in a pie_chart
Extracting the last_period state in a template sensor wors flawless like this: