Navigate to ip address on tap action

I have a couple of esp8266 devices each running a webserver that has UI to configure those devices. Each of these devices uses the homeassistant mqtt auto discovery feature and l am able to see my lights or switches and manipulate them from homeassistant. I use default Lovelace UI nothing custom.

What l would like to achieve is when in homeassistant for example l can tap on the device name say “Kitchen Light” . This currently takes me to another screen still in homeassistant where l can look at history. Is there a way in that next screen l could tap or double tap on the name again but this time it should navigate to an external url in this case the ip address of that device as reported to mqtt. The ip address is already known due to the mqtt integration.

I want a solution that l do not need to update on each auto discovered device. Has anyone done that or offer any help.

This would prevent me from having to leave homeassistant find the ip address of the device launch browser and do my configuration and then comeback to homeassistant. The device ip addresses are on dhcp its tedious and would be nice to do it all from homeassistant.

Have a look at tap actions: https://www.home-assistant.io/lovelace/actions/#tap-action

In particular,

navigation_path which takes you to another Lovelace view, and

url_path, which links to external websites.

However these actions can only be used in certain places like Lovelace buttons, Lovelace entities cards (tapping anywhere on the whole card, not just the row item), picture glance card, etc…

Have a browse through the Lovelace cards looking for the ones that support tap actions (right hand list):

As I wrote here in your cross-post: URLs in attributes will be rendered as clickable links in the more-info starting with the next release. So with templated attributes you could probably solve it.

https://github.com/home-assistant/frontend/discussions/8239#discussioncomment-311123

Thank you looking forward to the next release. In my case the url would be dynamically created as

http://<ip-address-of-that-entity>

Where the IP address reported by mqtt is used.
Also users that do need this feature can have a check box or something to disable or enable globally. The intend being that its setup once and any future autodiscovered entity inherits the behavior without further homeassistant configuration required.

1 Like

I think that is a very niche requirement that does not apply to most users. But since you can handle that yourself with templates and the new URL rendering, that is solvable.

My view is that would be a great feature. I have lots of Tasmota devices and often want to connect to the Tasmota UI. I enable the IP address entity for devices to ensure im working with the correct tagret device and it would to simply click on the IP Address to open a new tab and access the Tasmota UI easily.

2 Likes

That is precisely I entered the use case request. For anyone who has devices that do have their own website for configurable it is a must have and should be seamlessly integrated. I am glad you also see the need for it. I hope they will add it down the road, in the initial request they had said it will be included in the next release but that was long back. Keep fingers crossed though, I know these guys are busy and they do great work.

in the initial request they had said it will be included in the next release but that was long back

Where was that stated? Did I miss something? If you refer to the automatical link rendering (if you ensure that your entities have a link attribute), that is already in HA since quite some releases ago.

Hello, Can you take a look at this link
https://github.com/home-assistant/frontend/discussions/8239#discussioncomment-311123

The information has changed but it used to say the feature would be in the next release but I do not see that now

But the thought process is very simple, if I am using MQTT it means homeassistant knows the IP address of the entity. That being the case my assumption was it should automatically be able to create a link navigable to the ip address defalut web-server. http://

This is a high use case as many entities I try to control have their own website and its a pain to have to find its IP address and then from the browser go to the webserver to do custom configuration for that entity. It would really be nice to initiate that with homeassitant.

My entities use the auto-discovery feature of homeassistant and I love that intergration, but as my entities grow I see the value of this missing functionality in homeassistant. I want to do more than on/off the entity from homeassistant.

This link is pointing to my own comment. I know what I wrote there :slight_smile: . And you can see from the edits, that I never mentioned anything there about a next release.

And as I wrote before in this thread here, the frontend already offers the required tools/features from my perspective. It is up to the backend (your entities) to provide an attribute that contains a HTTP/HTTPS link to this device website you mentioned. If the integrations that you use do not provide such a link, you can add one with template entities (but that run against your desire for auto-discovery since templating is a manual step).

For a real generic solution, the backend entity data model would need a dedicated field to contain an IP/URL to a device page. Then the frontend could use those for a dedicated navigation link. But as long as such a thing does not exist, my workaround with template entities is probalby the only option.

1 Like

interesting really I think some posts got lost. I can almost swear that is how it was stated with the statement that it was a backend story and was therefore closed from the front end and forwarded to the back end.

I can have my entities provide the link field you are talking about. Can you give an example payload that l must sent to homeassistant so the front-end can pick up automatically.

I want to avoid the route of templates

The frontend will pick all attribute values starting with “http://” or “https://” as links. Nothing special other than that is required.

1 Like

I have made the changes and included a new attribute in the mqtt payload to have a link for navigation. The homeassistant is no longer picking up the entity does not show up at all in homeassistant. the mqqt broker however has the ping packet from my entity. Here is the config data as seen from mqtt

{"~":"homeassistant/light/channel_three-13/ac67b20596ec","name":"Bedside Light : ac67b20596ec","unique_id":"light-13-ac67b20596ec","cmd_t":"~/set","stat_t":"~/state","link":"http://192.168.0.174/","schema":"json"}

is the attribute name important I just called it “link”. When I remove that attribute the entity becomes visible in homeassistant

If the MQTT attribute is added to the autodiscovery topic, and isn’t one of the allowed ones, Home Assistant autodiscovery won’t set it up. A workaround is to use the STATE topic or the HASS_STATE (with Tasmota), and you have more flexibility to add things there. You can add the json_attributes_topic attribute to the discovery for the switch to force the entity to adopt all of the attributes in STATE or HASS_STATE.

I think it would just be nice for this feature to be supported during auto-discovery.

Basically let homeassistant have a single attribute that can have the navigation_url. If the devices sends it during autodiscovery time then have that link available in homeassistant. My device polls the mqtt server to update config settings every 30 seconds. So if the ip changes for example it will be updated in 30s on homeassistant.

I don’t disagree…I did verify that if you add the URL to the STATE topic (see details below) it will show up under device attributes and be clickable, perhaps that is enough…I hate ‘losing’ devices on my LAN and having to go into my router to find the IP, on the other hand I don’t need to open the admin interface for those devices very often either.

If you’re using Tasmota, you can put

ResponseAppend_P(PSTR(","" D_ADMIN_URL “”:“http://%s.local”"), TasmotaGlobal.hostname);

in Support_Tasmota.ino, in the first code block under the MQTTShowState function and it will end up as an attribute in the state topic for the switch. This is then accessible via the front end if you’ve added the json_attributes_topic information to the discovery topic for the switch.

Of course, this is compiling your own firmware and potentially more effort then its worth, but not impossible.

1 Like

Thanks, I will have to figure out how to do that. I do not have Tasmota though. My use case is very simple however; I do not want to do any customization or templating. From the Overview screen when I click on the entity name for example under Light, it takes me to the Details/History page. I want to see the link in either of the tabs or where it is easily accessible. The auto-discovery feature is very handy and works beautifully only problem occasionally like you do I want to know the ip address of the entity I am looking at regardless of whether there is a webserver or not on the entity just knowing its IP address without a lot of work is a basic functionality I think. In the past I uploaded firmware OTA to a wrong entity simply because dhcp changed for the entity and messed up a lot of thigs.

I am a bit surprised not many people see/need this use case.

@ Brandon_Beierle
Thanks for the information, I got it to work using your recommendation for json_attributes_topic.
And it does show up under the attribute section and not only do I get my IP I can also click and navigate to the entity admin UI wallaah!

For some reason I think this should not be addressed this way. It needs to be part of the config during auto-discovery. May be I am alone in this thought.