Hi there,
I want to be able to generate a dynamic path
This is a local picture path coming from a doorbel snapshot which I want to display on a picture card or picture entity card, but due to cache issue, the pictures are not refreshed on the dashboard, so I was told to use, at the end of the URL, and “variable” like ?v=xxxxx. By changing this variable all the time, the correct, last, new picture would be displayed.
So now I am trying to find out the correct syntax to be used in my URL path to be able for example to add the current timestap to the URL, but not succeeding.
What I have for the moment, testing from a chip card URL tap :
- type: custom:mushroom-chips-card
chips:
- type: entity
entity: person.delecole
tap_action:
action: url
url_path: https://example.com/data?v='{{now().strftime('%Y/%m/%d %H:%M:%S')}}'
but the URL that is sent is then the following one (completely wrong as it doesn’t translate):
“https://example.com/data**?v=‘{{now().strftime(’%Y/%m/%d%20%H:%M:%S’)}}%27)**”
Would you know the correct syntax to be used ?
Many thanks !
url_path: https://example.com/data?v={{now().strftime('%Y/%m/%d %H:%M:%S')}}
nope ;-(
- type: custom:mushroom-chips-card
chips:
- type: entity
entity: person.delecole
tap_action:
action: url
url_path: https://example.com/data?v={{now().strftime('%Y/%m/%d %H:%M:%S')}}
URL returned :
" https://example.com/data?v={{now().strftime(‘%Y/%m/%d%20%H:%M:%S’)}}"
Here is an example of mine (that works)
actions:
- action: URI
title: View Details
uri: >-
https://adsbfi.mud-club.com/tar1090/?icao={{states('sensor.low_level_registration')}}
Actually the spaces in the variable might not be ideal on yours…
Try this (assuming you have it set up):
{{states('sensor.date_time_iso')}}
This is also not ok :
- type: entity
entity: person.delecole
tap_action:
action: url
url_path: >-
https://example.com/data?icao={{states('sensor.225e_xdrive_charging_end_time')}}
URL returned :
“https://example.com/data?icao={{states(‘sensor.225e_xdrive_charging_end_time’)}}”
… and this also not :
- type: custom:mushroom-chips-card
chips:
- type: entity
entity: person.delecole
tap_action:
action: url
url_path: >-
https://example.com/data?icao={{states('sensor.date_time')}}
URL returned :
" https://example.com/data?icao={{states(‘sensor.date_time’)}}"
I don’t know what to suggest because I’ve not had a problem embedding variables in URLs at all. I even scripts that consume variables in the same manner.
Also it is :
{{states('sensor.date_time_iso')}}
not
{{states('sensor.date_time')}}
It may be an issue with the mushroom chip card not being able to parse the variables as opposed to an issue with the format.