How to use Switching Virtual Desktop with a button in Home assistant
There is no help available or a how to make this work, i have two entity's in Home assistant a Button and a Entity /Sensors that present me de ID's of the Virtual Desktops created, but how can i switch between the ID's or virtual desktops with the button?
Anybody van help me with this?
Thank you.
Solution:Jump to solution
okay so step 1 is to create an
ActiveDesktop
sensor and a SwitchDesktop
Command
2. open the activedesktop entity in homeassistant and switch to the blue iris desktop for about 15s
3. Copy the ID and mqtt publish it to the switchdesktop command topic in the script...20 Replies
Key commands:
Windows+Ctrl+Left Arrow
Windows+Ctrl+Right Arrow
Hope that helps.
Not sure how to make home assistant recognise which VD you're currently using
to add to this. HASS Agent would have a button keymap configured using the above to switch VD's.Thanks for the info, something to take a look at .
If anybody has more info on this that would be great. Thanks.
What are you trying to achieve? A card that can show current desktop number and switch between them?
With 2 commands and a sensor you can achieve this
I made two entities available in home assistant one button for switch_desktop and a entity what presents me the virtual desktop ID but i cant figure out how to combine those two so i can switch between them, i understand now that i can create a button with the key commands to switch from left to right. But i love to know how i can use that button with a virtual desktop ID so i can make buttons that i can select the desktop and switch to the desktop with that ID. in has agent it said when creating switchdekstop command that it can use the virtual dektop id but it does not mention how i can use that in Home assistent.
if you only have two VDs you could create an automation that when button left is pressed to change the helper for VD ID to x and when button right is pressed to change the helper for VD ID to y.
if you have more you'll have to make it more complicated
this may also help: https://superuser.com/questions/940342/how-to-change-shortcut-key-for-switching-between-virtual-desktops-in-windows-10 and then you can use a specific number to go to that VD ID
Super User
How to change shortcut key for switching between virtual desktops i...
In linux I use a shortcut to switch between 4 workspaces: win+1/2/3/4.
I would like to have something like this in Windows 10 or Windows 11.
UPDATE SOLUTION
(Step not needed for Windows 11 - only ...
Thanks for the info, that is the simple way to do if you have 2 or 3 virtual desktops, i explain what i love to see, i have a 10 inch monitor system on my desktop what i use for several things for example with kodi as tv or radio and is running the whole day but also blue iris what is running on a other virtual desktop, what i like is when a alerts is detected on one of my camera's or my reolink video doorbell is detecting a visitor or rings the doorbell it switches to the desktop what is running blue iris in chrome.
do you want it to auto switch back?
that would be nice yes. 🙂 or If i can create a button what is related to a particular virtual desktop id what seem to be possible that would be enough i then can use it in scripts so i can switch it manually back.
how would you make that work? Just curious because there's no point in working it all out just for it to not be used. Would it switch to other desktop for a certain amount of time?
because you can simply send an mqtt message to switch to a camera desktop, i use that myself right now
but if you want to also have a HA dashboard with left/right functionality it will require one of the hotkey options, or a complex HA/nodered helper setup
i like to have a automation and script if alert is detected that switch to desktop with blue iris with a delay to switch back to kodi desktop after 60 seconds or more , if i know how to make buttons with for example the id's where kodi is running or blue iris that would be great i know how to use that in scripts and automations.
I use now notifications with a snapshot from camera but have to manual switch to blue iris
Sorry but i have to ask, you did not react to my reply ... is it something i said or?
Oh no, I drafted up a long answer on my PC. On mobile now. I'll check when I'm home sorry about that
It's not too hard to setup, just difficult to explain from mobile. The basics are creating a current desktop sensor to get the IDs. Copy the id of the blue iris desktop and use the change desktop command topic to send an mqtt message with the blue iris id
I'll be able to do an in depth answer in 3 hours
No problem take all the time you need i was just curious and i am in no hurry. thanks for your reply.
Now i feel really bad 🤣
You still need help setting this up?
Yes please, don't feel bad its not a problem.
Solution
okay so step 1 is to create an
ActiveDesktop
sensor and a SwitchDesktop
Command
2. open the activedesktop entity in homeassistant and switch to the blue iris desktop for about 15s
3. Copy the ID and mqtt publish it to the switchdesktop command topic in the script4. repeat 2 and 3 to switch back
Thanks for the info.
Just ping me if it doesn't work
Works great thanks again.