I have a button on my dashboard that uses the IFTTT Webhooks to trigger a switch by opening a web page. It works fine, but the web page opens on top of my dashboard. How can I get the new page to either open the page behind the dashboard, or open the page and close it right away?
i guess you have created a custom widget?
because i dont know any button that triggers a switch except the switch widget.
matbe you like to share what you are actually doing, so i can help?
I’m pretty new at this so I’ll try to explain the best I can…
I set up a weblink in HA that goes to a “maker.ifttt.com/trigger…” page. Whenever that page is accessed, it triggers a generic low voltage wifi inching relay (that uses the ewelink app) to activate my garage door opener.
Then I set up a navigate widget in HADashboard that, when pressed, opens that URL, which in turn activates my garage door opener.
The problem is, when i press the widget, it opens the new page in the same browser tab as my dashboard. So I guess what I really need is some way to either:
- go back to the dashboard automatically
- open the page in a new tab/window and close it right away
- open it BEHIND the dashboard and just leave it there.
ah oke, now i understand what you are doing.
if you cant find a more convienient way to integrate your switch in HA it will be hard to do. but maybe not impossible.
what you could try is the following:
create a new dashboard with only 1 iframe widget on it that shows your page.
in your original dashboard change the navigate to go to the new dashboard.
and specify timeout (set it to 1 sec) and return (your original dashboard.
it then would look something like:
triggerpage: widget_type: navigate title: switch dashboard: ifttttriggerdash args: timeout: 1 return: originaldash
You could also try to just load the page with an XMLHttpRequest. That way the page won’t load at all, you would just be reading the page into memory. Not sure if it would work in your case, but it seems worth trying.
var xhr = new XMLHttpRequest() url = "http://your_url" xhr.open("GET", url, false) xhr.send()
thats not something easy to do with a dashboard
and there would be 2 options that i can think of:
both way more difficult then my solution.
i just thought of 1 other possible solution.
create a html page with an url or button that loads the page with a script like tjintomas showed and open that html page in an iframe.
even more easy:
create a webpage with only that url
open it in an iframe that has a short refreshrate.
your trigger would be opened in the iframe and after the refreshtime it will go back to the page with your url.
command: 'var xhr = new XMLHttpRequest(); url = "http://your_url"; xhr.open("GET", url, false);xhr.send();'
tjntomas, That works exactly how I want it to. Thank you!
Here’s what I’ve got in my .dash file:
Sure, that would work. You can try using yaml folded style to make it easier to read:
you can call it anything you like.
Gotchya. Thank you!