Problem using uri in attribute as url_path in entity

Hi!

So I’m using the Pirate weather integrations for weather alerts among other think but I created an entity that shows me how many I have and my goal is is when I click on the button for the number of alerts for it to take me to the url in the sensors attribute with the url.

type: conditional
conditions:
  - condition: state
    entity: sensor.weather_alerts
    state_not: '0'
card:
  type: custom:mushroom-template-card
  primary: Weather Alerts
  secondary: '{{ states(''sensor.weather_alerts'') }} Alerts'
  icon: mdi:alert-circle-outline
  icon_color: red
  multiline_secondary: true
  entity: sensor.weather_alerts
  tap_action:
    action: url
    url_path: |
      `{{state_attr('sensor.weather_alerts', 'uri')}}`

When I put {{state_attr('sensor.weather_alerts', 'uri')}} in Developer Tools → Template and test it, it shows the correct url but when I click on it instead of going to right website it takes me to http://192.168.1.111:8123/lovelace/%7B%7Bstate_attr('sensor.weather_alerts',%20'uri')%7D%7D and I am not sure what I am doing wrong. If anyone could help I would be greatly appreciative!

Even cards like Mushroom that accept templates elsewhere, rarely allow them in actions. The normal workaround is to move your templated logic to a script then have the card’s action call the script.

I am super new at this any change you could walk me thought it a bit please?

Sorry, my answer was not specific enough to your question regarding a url action. I don’t know if there is a way to do exactly what you are trying to do. The easiest option might be to add a Markdown card into your existing setup by using a stack card:

type: conditional
conditions:
  - condition: state
    entity: sensor.weather_alerts
    state_not: '0'
card:
  type: custom:stack-in-card
  cards:
    - type: custom:mushroom-template-card
      entity: sensor.weather_alerts
      primary: Weather Alerts
      secondary: '{{ states(entity) }} Alerts'
      icon: mdi:alert-circle-outline
      icon_color: red
      multiline_secondary: true
    - type: markdown
      content: >-
        [Active Alerts](http://{{ state_attr('sensor.weather_alerts', 'uri') }}) 

Note: I’ve used the custom Stack-In-Card above but it could also be done with the core Vertical Stack card.