home-assistant / ui-schema

A schema to define a user interface for Home Assistant.
Apache License 2.0
41 stars 6 forks source link

[Feature Request] Support Weblinks in Glance cards #249

Closed SeanPM5 closed 5 years ago

SeanPM5 commented 5 years ago

Currently the glance card seems to support almost everything except weblinks. It's kind of a bummer to have a clean looking glance card, and then you realize you can't put that one final entity inside it cause it's a weblink...

Here is how it could look: image Would look identical to the other icons basically, the only difference is that clicking on it would launch the weblink instead of more-info pane. This example doesn't have it, but another idea would be to add "Weblink" or "Link" underneath the icon (as the "state") to make it even more obvious.

There are a number of scenarios where it'd be useful, just a few examples:

thomasloven commented 5 years ago

Use any sensor (like sensor.time) as entity, select a custom icon, select a custom name, and set tap_action to navigate.

SeanPM5 commented 5 years ago

Use any sensor (like sensor.time) as entity, select a custom icon, select a custom name, and set tap_action to navigate.

This would be an acceptable workaround for me, but it doesn't appear to work here (unless my code is wrong).

          - entity: sensor.time
            name: Plex
            icon: mdi:plex
            tap_action:
              action: navigate
              navigation_path: "http://127.0.0.1:32400/web/index.html"

When I try clicking/tapping on the icon it does nothing.

thomasloven commented 5 years ago

Yes. I was wrong. navigatedoesn't work with external urls.

tnagels commented 5 years ago

Weblinks do work if you put them as an entity in configuration.yaml. However, they open the detail window first, so you have to click twice. If that could be resolved it would be perfect...

balloob commented 5 years ago

Weblink integration is deprecated as it's an entity that exists purely for UI purposes – it should be done via Lovelace config. So just like Entity card has different row types, glance should have the same.

tnagels commented 5 years ago

Ok - I was not aware of that. So then yes, we do need this!

iantrich commented 5 years ago

I think adding a url action is the best and coincidentally easiest solution. e.g.

tap_action:
  action: url
  url_path: http://127.0.0.1:32400/web/index.html

This is already how I'm doing it in some custom cards: https://github.com/custom-cards/custom-card-helpers/blob/master/src/handle-click.ts#L55