core
core copied to clipboard
Cannot open relative URLs via Fully Kiosk integration
The problem
Home Assistant Lovelace frontend is a SPA. To change tabs you don't need/want to navigate to another full URL, but just navigate to relative path like:
/lovelace/home
This way you won't reload whole application, but just change the SPA route – changing the tab.
Yet current Fully Kiosk integration doesn't allow to set relative URLs like this. Trying to call a fully_kiosk.load_url
with relative URL results in:
Call-service error. ('Error', 'Invalid URL /lovelace/home')
Fully Kiosk integration shall allow to navigate to relative URLs.
What version of Home Assistant Core has the issue?
20221102.1
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant Container
Integration causing the issue
fully_kiosk
Link to integration documentation on our website
https://www.home-assistant.io/integrations/fully_kiosk
Diagnostics information
No response
Example YAML snippet
{
"url": "/lovelace/home"
}
Anything in the logs that might be useful for us?
No response
Additional information
No response
Hey there @cgarwood, mind taking a look at this issue as it has been labeled with an integration (fully_kiosk
) you are listed as a code owner for? Thanks!
Code owner commands
Code owners of fully_kiosk
can trigger bot actions by commenting:
-
@home-assistant close
Closes the issue. -
@home-assistant rename Awesome new title
Change the title of the issue. -
@home-assistant reopen
Reopen the issue. -
@home-assistant unassign fully_kiosk
Removes the current integration label and assignees on the issue, add the integration domain after the command.
(message by CodeOwnersMention)
fully_kiosk documentation fully_kiosk source (message by IssueLinks)
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
Problem still exists
The way to do this is in javascript:
history.pushState(null, "", path);
window.dispatchEvent(new CustomEvent("location-changed"));
this allows home assistant to navigate without reloading the user interface, which is many times faster than invoking the fully http api
The way to do this is in javascript:
history.pushState(null, "", path); window.dispatchEvent(new CustomEvent("location-changed"));
this allows home assistant to navigate without reloading the user interface, which is many times faster than invoking the fully http api
And how to do this remotely? Is this possible via Command "Load URL"?
service: fully_kiosk.load_url
data:
url: >-
javascript:history.pushState(null,"","/lovelace/home");window.dispatchEvent(new CustomEvent("location-changed"));
target:
device_id:
- your_fully_device_id
Works in fully browser with android chromium webview. Solves the problem without mucking anything else up. In my case, it also puts me one function away from removing browser_mod from my system entirely. May require the paid version, if it doesn't work for you, throw the man a chicken wing
Works for me :) Really nice solution. I have been looking for this for a very Long Time.
Feature request for Fully Developer: Can you provide an additional Service for the Fully device Like "Load URL"? Something Like "Load Dashboard" or "Goto Dashboard"? Input for this Service could be the Name or the relative URL of the desired Dashboard. Dropdown List for selecting the Dashboard would be nice too. This would be more User friendly than "Load URL" and coding from @markfrancisonly
@markfrancisonly is a steely-eyed missile man. That's genius.
I like the idea of a "Load Dashboard" service. Unfortunately, there's no selector for dashboards. I'll look into creating a "Change Location" service that takes a string as a parameter and employs @markfrancisonly's javascript:
URL.
I use the following to open a specific kiosk dashboard on a kiosk in the same room as my alexa echo via voice routine. No touching required. Requires that you setup a group with your echos, and both an alexa media_player and a fully kiosk device must be added to the same Area
script:
alias: Alexa wallpanel navigate
sequence:
- service: script.alexa_wait_for_last_called_update
data: {}
- service: fully_kiosk.load_url
data:
url: >-
javascript:history.pushState(null,"","{{path}}");window.dispatchEvent(new
CustomEvent("location-changed"));
target:
device_id: "{{ states('sensor.last_alexa_fully_kiosk_device_id') }}"
- service: switch.turn_on
data: {}
target:
entity_id: >
{{ device_entities(states("sensor.last_alexa_fully_kiosk_device_id"))
|select('match', '.*_screen$') |list |first}}
mode: single
fields:
path:
description: dashboard path
icon: mdi:open-in-app
alias: Alexa wait for last called update
sequence:
- service: alexa_media.update_last_called
data: {}
- wait_template: >-
{{ now()|as_timestamp() -
(state_attr('sensor.last_alexa','last_called_timestamp')|default(0,true) /
1000) < 20 }}
continue_on_timeout: true
timeout: "00:00:05"
mode: single
icon: mdi:update
template:
- sensor:
- name: Last Alexa
state: >
{% set last_alexa = expand('group.alexa') |selectattr('attributes.last_called','eq',True) |map(attribute='entity_id') |list %}
{{ last_alexa[0] if last_alexa|length else none }}
availability: >
{% set last_alexa = expand('group.alexa') |selectattr('attributes.last_called','eq',True) |map(attribute='entity_id') |list %}
{{ last_alexa|length > 0 }}
attributes:
last_called_timestamp: >
{% set last_alexa = expand('group.alexa') |selectattr('attributes.last_called','eq',True) |map(attribute='entity_id') |list %}
{{ state_attr(last_alexa[0],'last_called_timestamp') if last_alexa|length else none }}
last_called_summary: >
{% set last_alexa = expand('group.alexa') |selectattr('attributes.last_called','eq',True) |map(attribute='entity_id') |list %}
{{ state_attr(last_alexa[0],'last_called_summary') if last_alexa|length else none }}
- name: Last Alexa Fully Kiosk Device ID
state: >
{% set last_alexa = expand('group.alexa') |selectattr('attributes.last_called','eq',True) |map(attribute='entity_id') |list %}
{% if last_alexa|length > 0 %}
{%
set fully_kiosk = expand(integration_entities('fully_kiosk'))
|selectattr('entity_id', 'match', '.*_screen$')
|selectattr('entity_id', 'in', area_entities(area_name(last_alexa[0])))
|map(attribute='entity_id')
|list
%}
{{ device_id(fully_kiosk[0]) if fully_kiosk|length else none }}
{% else %}
{{ none }}
{% endif %}
I have a PR ready that implements a change_location
service but it depends on #88647. Once #88647 gets merged, I'll push up the code for the change_location
service and create a PR.
Well I tried to add a change_location
server to HA but I'm not going to jump through hoops just to make HA more usable when I'm perfectly content to keep manually building the javascript:
URL for my own automations. If someone else wants to do this, please go ahead.
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.