Url from sensor

Hi Guys,

I have created a few entities card showing me the details of my tasmota devices (using the tasmota integration).


Now what I want to do is, when I click on the IP here that should take to the IP on the browser. How do I extract the sensor value here

This is what I have tried but this doesn’t seem to work

type: entities
entities:
  - entity: sensor.basic_01_ip
    tap_action:
      action: url
      url_path:
        value_template: '{{states_attr(''sensor.basic_01_ip'', ''state'')}}'

Rishab

The URL path will not take a template without using a custom-template card.

See:

Nope still redirects to
http://:8123/lovelace/[object%20Object]

I just edited my post.

Let me check and get back :slight_smile:

It will end up something like:

url_path: "${this.hass.states['sensor.basic_01_ip'].state}"

I think. It has been ages since I used it.

This is my complete entity card yaml, could you help me fix it here?
Sorry I am still a noob at this.

I did add the config-template-card.js as a resource

entities:
  - entity: sensor.basic_01_ip
    tap_action:
      action: url
      url_path:  "${this.hass.states['sensor.basic_01_ip'].state}"
  - entity: sensor.basic_01_last_restart_time
  - entity: sensor.basic_01_restart_reason
  - entity: sensor.basic_01_rssi
  - entity: sensor.basic_01_ssid
title: Basic_01
state_color: true
footer:
  type: graph
  entity: sensor.basic_01_rssi
  hours_to_show: 6
  detail: 2
show_header_toggle: false

Look at the example on the github pages. https://github.com/iantrich/config-template-card

You have no card type:, and no card: defined.

@rishabmehta7 did you get this working? I am trying to do something similar to create a button that when clicked will open a dinamic google maps link showing the position of a HA entity, but cannot make it work even using the config-template-card

Nope. Abandoned it once the device view came in.

i am also looking for a solution right now have you found a solution yet?

Nope no solution :frowning:

argh very bad… I thought really that must be possible.
Especially it works with images only not with Path URL’s

Yes, after a lot of trial and error I got it working, this is my card (hope it helps):

	  - type: custom:config-template-card
		variables:
		  - states['person.xxxxxx'].attributes.latitude
		  - states['person.xxxxxx'].attributes.longitude
		entities:
		  - person.xxxxxx
		element:
		  type: image
		  entity: person.xxxxxx
		  image: /local/Floorplan_images/xxxxxx.png
		  tap_action:
			action: url
			url_path: >-
			  ${'https://www.google.com/maps?daddr=' + vars[0] +
			  ',' + vars[1]}

The only issue is recently this has stopped working from the mobile app (google maps app is opened but it doesn´t point to the HA person entity). It still works fine from the desktop, I guest something might have changed in the latest android version so the “daddr” parameter doesn´t work from mobile, but haven´t had time to look into it.

EDIT: a quick google search proved me wrong, it seems the daddr parameter has not worked from android in a while (at least from 2017) and the recommended method by google is expained in the link mentione here: android - Google maps does not show route when opened by link - Stack Overflow
Example: Google Maps

So it´s time to update my HA card :slight_smile: