Nice one! Thanks for the tip!
You need to remove âbrowser_id: THISâ and than it works across all devices/browser/apps.
Yes, thanks! Works. Forgot it was deprecated with a specific version of browser mod. Typical copy & paste mistake.
Now I mapped it on a hold_action of a button.
confirmed working by remving indeed browser: THIS
finally a workaround for menubar again
Hey there, just passing by and wanted to thank you for the solution ! Woekinf for le on android! Hoping it just temporary !
I was missing some of the basics on how to reproduce this solution, so after figuring out the missing steps posting this for other newbies like me here is a script for reference; once script is created just add it to dashboard.
- Install âbrowser_mod 2â from HACS
- Create below script
- Add script to your dashboard (HA Show Sidebar), position it to the top ideally.
alias: HA Show Sidebar
sequence:
- service: browser_mod.javascript
data:
code: >-
document.querySelector('body >
home-assistant').shadowRoot.querySelector('home-assistant-main').dispatchEvent(new
CustomEvent('hass-toggle-menu', {detail: {open: true}}));
mode: single
icon: phu:playback-button
Have you any idea if we can use the same approach to open the voice-dialog?
Hi @StickyClient I have had a quick look and this should work for your voice assist. It just emulates a force click on the voice assist menu item.
tap_action:
action: fire-dom-event
browser_mod:
service: browser_mod.javascript
data:
code: "document.querySelector('body > home-assistant').shadowRoot.querySelector('home-assistant-main').shadowRoot.querySelector('ha-drawer > partial-panel-resolver > ha-panel-lovelace').shadowRoot.querySelector('hui-root').shadowRoot.querySelector('div > div.header > div > div > ha-button-menu > mwc-list-item:nth-child(3)').click();"
Let me know if it works. It seems to work on my system
Yea sorry. I have a wall mounted tablet and it would pop up the sidebar for the tablet whenever i used the command anywhere else.
If you set up your device in browser_mod as an entity then it should work on that particular device with browser_id: THIS and not all of your devices at the same time
Thanks! It works but opens the unused entities page instead of the assist popup.
Edit: Seems to work on mobile but not on desktop, the path changes at dimensions (871x482). So in the meanwhile i figured out that this works for desktop/tablet.
tap_action:
action: "fire-dom-event"
browser_mod:
service: "browser_mod.javascript"
data:
code: "document.querySelector('body > home-assistant').shadowRoot.querySelector('home-assistant-main').shadowRoot.querySelector('ha-drawer > partial-panel-resolver > ha-panel-lovelace').shadowRoot.querySelector('hui-root').shadowRoot.querySelector('div > div.header > div > div > ha-icon-button:nth-child(2)').shadowRoot.querySelector('mwc-icon-button').shadowRoot.querySelector('button').click();"
Hey everyone, I started playing around a bit with listening to edge swipes (similar to Swipe Navigation - GitHub - zanna-37/hass-swipe-navigation: âď¸ Swipe through Home Assistant Dashboard views on mobile.) and triggering the sidebar open via the command noted in prior comments. The code is definitely not ready for prime-time but it seems to at least work well enough in my early testing.
Oops I dont have the top bar showing so didnt realise it changes to buttons or menu items according to the screen size. Try this code. It finds the menu item more directly and should work.
Let me know how you go.
tap_action:
action: fire-dom-event
browser_mod:
service: browser_mod.javascript
data:
code: >-
let assist = document.querySelector('body > home-assistant').shadowRoot.querySelector('home-assistant-main').shadowRoot.querySelector('ha-drawer > partial-panel-resolver > ha-panel-lovelace').shadowRoot.querySelector('hui-root').shadowRoot.querySelector('div > div.header > div').querySelector('[data-selector="ASSIST"]');
if (assist == null) {
assist = document.querySelector('body > home-assistant').shadowRoot.querySelector('home-assistant-main').shadowRoot.querySelector('ha-drawer > partial-panel-resolver > ha-panel-lovelace').shadowRoot.querySelector('hui-root').shadowRoot.querySelector('div > div.header > div > div > ha-button-menu').querySelector('[data-selector="ASSIST"]');
}
assist.click();
Thanks for the input but it seems not working, tested on different screen dimensions but itâs not working on any.
If anyone is interested, I just pushed up what Iâve been using locally to restore edge swiping. Iâd like to eventually add some customization options for swipe distance thresholds, disabling the back swipe gesture to close, etc., but I havenât had time to really expand it beyond the base functionality. I also make no guarantees as to functionality and compatibility with any particular configuration, custom cards, etc. I do use the swipe navigation library and from my (and my familyâs) testing, it doesnât seem to interfere.
I know the library could have been even smaller, but I like reactive patterns, especially for ui events.
Sorry, was planning on adding documentation once I got it a bit further along (e.g. with some customization options, etc.). To use it, you just need to add hass-sidebar-swipe.js to your dashboard resources. I believe Registering Resources | Home Assistant Developer Docs has the general instructions on how to do so. You would just follow those and use the hass-sidebar-swipe.js file located at Releases ¡ breakthestatic/hass-sidebar-swipe ¡ GitHub. Hopefully that helps.
Thank you for the explanation, unfortunately it doesnât work for me. But Iâm looking forward to further development.
Pushed up a new alpha release that adds some basic user-customization support. You should now be able to configure start/end thresholds and disable some of the extra processing that is currently performed to make the experience better on my own devices/hass setup.
@Ralfi1982, if you want to debug this further, shoot me a direct message and maybe we can go through the setup/config to see what might be causing your failures. So far youâre the only person outside my family that has tried using this, so any troubleshooting/feedback would definitely be welcome!
Work perfect, Android and App companion
Works Thank you
(On Android , Poco X3 Pro)
/local/hass-sidebar-swipe/hass-sidebar-swipe.js