I haven't seen this addressed here, but I only did a quick search. Apologies if it's been covered.
Is there a way to use hotkeys on a PC to control devices in Hubitat (for instance, using the F7 key to toggle a scene on/off)?
I got the ide after running across the PCPanel device. I figured something like that would allow control over my lighting for my Zoom sessions, as well as my video switching and audio mixing, all in one place. Now I've got this idea in my head, and I want to see if I can do it.
Installing the Maker API built-in app on your HE hub and linking various device to Maker API (inside it's configuration page), allows HTTP calls to be made from outside the HE hub to interact with those devices. So for example you could link scene devices with Maker API and issue commands from your PC. You just need to work out how you want / can issue those commands. There is another thread looking at using Event Ghost, but can't remember if it can issue commands back the other way or detect hot keys like you describe.
I setup a virtual motion sensor based on activity on my laptop, but that is a batch script that just runs periodically, not triggered like you want. Perhaps a simple script on the desktop might be a good start...
I think I was able to do that as well, let me grab a link to my code for you to take a look.
Here's a link to the folder.
I think the vbs script may have been the thing that helped stop PS from opening. There was a thread here somewhere that people gave me a hand with this. Might try and find it later if you are still stuck.
Thanks. A little looking around revealed I can put 'curl' before the URL- but I still have to launch Powershell to be able to do it. Maybe I have to make a batch file that opens Powershell, then initiates the command. It's fun trying to figure all this out.
I got it working OK with a batch file. It flashes a command window for a fraction of a second, but I can deal with that. Now, I need to see if I can work the commands to make it a toggle, so I don't need a second hotkey (and batch file) to turn it off again. That's a matter for tomorrow. If I were someone who understood more scripting, I'd probably be in bed right now.
I'm sure I got this to work, in fact it is running now and doesn't show up. Let me go back through my code and the thread somewhere where I discussed it. I'm pretty sure it was why I introduced the vbs script...
Here it is, @reachjeffs posted about it on the thread for my Virtual Motion Sensor, it is the VBS script which then runs the PS script, with the sole purpose of the VBS script being to supress the PS window. I talk about having made some minor tweaks to what Jeff proposed, which I include in the original post of the thread.
This is the PC Controller thread I mentioned earlier, which only came up recently. Looks like it may include something like what you're trying to achieve @uncleflip, but can understand if you want to tinker away on it yourself All part of the fun...
Just tried that. I created a vbscript (exactly like your helper script but substituting my ps1 file for your motion sensor script). However when I launch the vbs file nothing happens to the state of my virtual device and I'm not sure why especially as there were no error messages. Pretty sure I've missed something but don't know what it is.
My ps1 file works fine when run from a batch file or via the powershell.
Going to retract my words in the post following yours and say another thanks to @sburke781. If you use his vb helper script from his github (post #5) and just substitute your powershell script then running the vbscript file like so:
Hmmm....you're teaching me more about this system. (I'm pretty new to it.) I saw that there are virtual buttons, but had no idea what their intended purpose/use was. Now I will experiment with that. Thanks for leading me to another aspect of Hubitat!
Thanks again for the VBS stuff. I have never created a VBS file, and have never knowingly used one (though I'm sure VBS files have been part of many things I've done in the past.)
Now I need to tinker with it and figure out what I'm doing. I'm sure with enough analysis, I could pare down your examples to just the bits that will suppress the PowerShell window, and hopefully also launch my batch file- or incorporate the command into the VBS itself. (As I may have mentioned, I'm not experienced at scripting....but I do tend to pick up concepts and figure things out in time.....so It will take a little trial and error, but shouldn't stop me in my tracks. It'll probably be easier than figuring out why I couldn't get a proximity sensor to properly trigger a servo unit....)
The VBscript file is all of 3 lines (exactly per @sburke781's pc motion sensor PC_VirtualMotionSensor.vbs):
Set objShell = CreateObject("Wscript.shell")
-executionpolicy bypass -File " & Chr(34) & "[insert path and name of your ps1 file here].ps1" & Chr(34), 0
Set objShell = Nothing
OK, Tried using the altered VBS to launch my batch file. True to expectation, the Powershell window did not appear. Also, the batch file failed to do anything. (It worked fine launched on its own.) Time to do more digging and figure out the problem..