Hello,
Ever since I got Hubitat, I have tried to integrate it with my PC as much as possible. So I decided to find a way to change lighting in the room based on the game or program that is running on my PC.
After looking into it for a while, I finally managed, so i made a guide to assist anyone who would benefit from something like this.
Step 1:
Launch Local Security Policy, then under Local Policy, then Audit Policy, and then Allow Success for Audit Process Tracking
Step 2:
Go into Rule Machine, and using the Cloud End Point as a trigger, set it to activate whichever scene you would like, or whatever need you have.
Copy the link which is generated.
Step 3:
Install curl and run the .exe file in the bin folder
Then open a Notepad and enter
curl 'Your-Link'
Then save it as a .bat file
Step 3.1:
As I didn't want the bat file to pop up everytime, i created another .vbs file
with:
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & "C:\Your-File.bat" & Chr(34), 0
Set WshShell = Nothing
And now it runs invisibly.
Step 4:
In Task Scheduler Create a New folder to organize your different automations.
Next, create a Task, and a New Trigger
Select Custom, then Edit Event filter, go to the XML tab and enable Edit query manually.
Then paste this code and enter your Game/Programs .exe
<QueryList>
<Query Id="0" Path="Security">
<Select Path="Security">
*[System[band(Keywords,9007199254740992) and (EventID=4688)]]
and
*[EventData[Data[@Name='NewProcessName'] and (Data='D:\Your-Game.exe')]]
</Select>
</Query>
</QueryList>
Then as your action you run your .bat or .vbs file.
Step 5:
If you want it to change back to another scene once the game closes, repeat the exact same steps, but only changing the Trigger code to:
<QueryList>
<Query Id="0" Path="Security">
<Select Path="Security">
*[System[band(Keywords,9007199254740992) and (EventID=4689)]]
and
*[EventData[Data[@Name='ProcessName'] and (Data='D:\Your-Game.exe')]]
</Select>
</Query>
</QueryList>
Which detects that a program closes instead of opens
That should be all, if you have any question/suggestions please ask