button-card
button-card copied to clipboard
(help) How to create asynchronous navigate tap action?
I want to wait for an async call before navigating.
I am doing:
type: custom:button-card
name: call living room
tap_action:
action: custom
multi_calls: |
[[[
const wrapperFunction = async () => {
const delay = (ms) => {
return new Promise(resolve => setTimeout(resolve, ms));
}
await hass.callService(
"rest_command",
"call_tablet",
{}
);
await delay(1000);
window.location.href = 'https://xxx.xxx.xxx/dashboard-overview/calls?call=101#call-popup';
}
return wrapperFunction()
]]]
this works perfect in the web, but for companion app, it opens the link in the default phone browser. I want it to behave like the areas card, wherein when you click it, it just switches to that area tab.
using command_webview does reroute it to the specified path, but completely ignores the #call-popup in the URL.