Since some time I work on my movies library dashboard being integrated into HA. Basically it works quite fine, but I’m struggling with one functionality; I want to add an actionable link that would change value of helper to take some additional action based on this value. Purpose is to select specific movie top be able to display more detailed innfo about this movie. So far my solution works as follows:
- I created a table with list of movies in library using markdown card
- I created HA webhook that receives message with IMDB identifier (ttxxxx)
- I created automation that puls from reference JSON file details of selected movie.
- based on selected number I can display additional movie info, like poster , rating, cast, plot…
I tested format of webhook and if I post resulting URL in browser address bar it is properly received by HA and actions are taken. The problem is how to send this webhook from markdown card. If I just use regular link (using href tag) it tries to either initiate download (which does not exist) or opens the blank page (that also is undesired result). This is because link in markdown uses GET instead of POST. To create a POST request from URL it should be possible to use PING attribute, as in sample code below (using just simplified code to show only htis specific functionality:
type: markdown
content: >-
<a href="#" ping="http://hassio.mydomain/api/webhook/movie_selection/message=tt15314262">Beekeeper</a>
<a href="#" ping="http://hassio.mydomain/api/webhook/movie_selection message=tt0848228">Avengers</a>
So structure of this link is href="#"
to self reference the page I’m on (not to redraw or go to other page) and ping="http://hassio.mydomain/api/webhook/movie_selection message=tt084822"
is the ping command to POST actual webhook in the format that works with HA.
But it does not work
When I inspect the page with this specific link I can see that ping attribute is striped away and only href and link name are kept:
So the questions are:
Am I doing something wrong, should ping be used different way?
If the link I create is OK, then is this HA bug or is it done by purpose?
Is there any other way to achieve what I want to get to (have actionable link in markdown card)?