commit
98a0c46ed7
@ -0,0 +1,43 @@
|
||||
# Commands
|
||||
|
||||
Commands can be used to trigger certain things on the client. For each command, a switch will be available in Home Assistant. Turning on the switch fires the command on the client and it will turn the switch off when it's done. Turning it off will cancel the running command.
|
||||
|
||||
### ShutdownCommand
|
||||
|
||||
This command shuts down the computer immediately. It runs `shutdown /s`.
|
||||
|
||||
### RestartCommand
|
||||
|
||||
This command restarts the computer immediately. It runs `shutdown /r`.
|
||||
|
||||
### LogOffCommand
|
||||
|
||||
This command logs off the current user. It runs `shutdown /l`.
|
||||
|
||||
### CustomCommand
|
||||
|
||||
This command allows you to run any Windows Commands. The command will be run in a hidden Command Prompt. Some examples:
|
||||
|
||||
|Command|Explanation|
|
||||
|---|---|
|
||||
|shutdown /s /f /t 000|Forcefully shutdown the PC immediately.|
|
||||
|Rundll32.exe user32.dll,LockWorkStation|This locks the current session.|
|
||||
|shutdown /s /t 300|Shuts the PC down after 5 minutes (300 seconds).|
|
||||
|C:\path\to\your\batchfile.bat|Run the specified batch file.|
|
||||
|
||||
### KeyCommand
|
||||
|
||||
Sends a keystroke with the specified key. You can pick [any of these](https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes) key codes.
|
||||
|
||||
### Media Commands
|
||||
|
||||
There's several media commands available that allow you to control media playback. You can combine them into a media player entity as shown [here](https://pastebin.com/1VdL5iQm).
|
||||
|
||||
|Command|use|
|
||||
|---|---|
|
||||
|Play/Pause|The same as pressing the play/pause media key|
|
||||
|Next|skip to next track|
|
||||
|Previous|skip to previous track|
|
||||
|Volume up|Increase system master volume|
|
||||
|Volume down|Decrease system master volume|
|
||||
|Mute (toggle)|Mute the system|
|
@ -0,0 +1,86 @@
|
||||
# Sensors
|
||||
|
||||
Sensors are used to transfer data about the host system to an automation hub, where it can be processed. `hass-workstation-service` provides many sensors, and they are lisited below in the same order as listed in the configuration GUI.
|
||||
|
||||
### ActiveWindowSensor
|
||||
|
||||
The active window sensor returns the title of the currently selected window, and is the same value shown when hovering over the icon in the windows task bar.
|
||||
|
||||
This sensor is commonly used to trigger automations when a specific program is in use, such as pausing audio during a skype call. This sensor can be unreliable when used with applications such as web browsers that update their title based on the current context. You can partially resolve this using regular expressions.
|
||||
|
||||
### CPULoadSensor
|
||||
|
||||
The CPU load sensor is used to determine the current utilization of the CPU, and returns a percentage value.
|
||||
|
||||
### CurrentClockSpeedSensor
|
||||
|
||||
The current clock speed sensor returns the base system clock as configured in the bios. **It does not return the current operating frequency of the CPU**
|
||||
|
||||
### CurrentVolumeSensor
|
||||
|
||||
This sensor returns the current volume of playing audio. **It does not return the master volume.** If you have no sound playing the value will be 0.
|
||||
|
||||
### DummySensor
|
||||
|
||||
This sensor produces a random output every second, and is intended to test latency and connectivity.
|
||||
|
||||
### GPULoadSensor
|
||||
|
||||
This is the same as the [CPULoadSensor](https://github.com/sleevezipper/hass-workstation-service/new/master/documentation#cpuloadsensor), but for the GPU.
|
||||
|
||||
### GPUTemperatureSensor
|
||||
|
||||
The GPU temperature returns the current operating temperature of the GPU. This sensor is useful for controling external cooling systems such as air conditioning.
|
||||
|
||||
### LastActiveSensor
|
||||
|
||||
The last active sensor returns the time when the workstation was last active (last keyboard and mouse input). It is useful as a form of presence detection when combined with motion sensors or software such as room assistant, although may not be reliable if used with auto clickers or other macro software commonly used for video game automation.
|
||||
|
||||
### LastBootSensor
|
||||
|
||||
The last boot sensor returns the time the windows computer booted. It can be used to calculate uptime, if combined with another sensor to detect system shutdowns.
|
||||
|
||||
### MemoryUsageSensor
|
||||
|
||||
This returns the amount of system memory used as a percentage value, as indicated by the task manager.
|
||||
|
||||
### MicrophoneActiveSensor
|
||||
|
||||
This is a binary sensor that can be used to detect if the microphone is in use. **It does not return what process is using it**
|
||||
|
||||
### NamedWindowSensor
|
||||
|
||||
The named window sensor is similar to the [ActiveWindowSensor](https://github.com/sleevezipper/hass-workstation-service/new/master/documentation#activewindowsensor), however it is a binary sensor that returns true if a window with a title matching a pre determined value is detected.
|
||||
|
||||
### SessionStateSensor
|
||||
|
||||
The session state sensor can be used to detect if someone is logged in. It has the following values :
|
||||
|
||||
|State|Explanation|
|
||||
|---|---|
|
||||
|Locked|All user sessions are locked.|
|
||||
|LoggedOff|No users are logged in.|
|
||||
|InUse|A user is currently logged in.|
|
||||
|Unknown|Something went wrong while getting the status.|
|
||||
|
||||
### UserNotificationState
|
||||
|
||||
This sensor watches the UserNotificationState. This is normally used in applications to determine if it is appropriate to send a notification but we can use it to expose this state. Notice that this status does not watch Focus Assist. It has the following possible states:
|
||||
|
||||
|State|Explanation|
|
||||
|---|---|
|
||||
|NotPresent|A screen saver is displayed, the machine is locked, or a nonactive Fast User Switching session is in progress. |
|
||||
|Busy|A full-screen application is running or Presentation Settings are applied. Presentation Settings allow a user to put their machine into a state fit for an uninterrupted presentation, such as a set of PowerPoint slides, with a single click.|
|
||||
|RunningDirect3dFullScreen|A full-screen (exclusive mode) Direct3D application is running.|
|
||||
|PresentationMode|The user has activated Windows presentation settings to block notifications and pop-up messages.|
|
||||
|AcceptsNotifications|None of the other states are found, notifications can be freely sent.|
|
||||
|QuietTime|Introduced in Windows 7. The current user is in "quiet time", which is the first hour after a new user logs into his or her account for the first time. During this time, most notifications should not be sent or shown. This lets a user become accustomed to a new computer system without those distractions. Quiet time also occurs for each user after an operating system upgrade or clean installation.|
|
||||
|RunningWindowsStoreApp|A Windows Store app is running.|
|
||||
|
||||
### WebcamActiveSensor
|
||||
|
||||
The webcam active sensor returns the status of the webcam.
|
||||
|
||||
### WMIQuerySensor
|
||||
|
||||
Please see the specific documentaion page [here](https://github.com/sleevezipper/hass-workstation-service/blob/master/documentation/WMIQuery.md#wmiquerysensor).
|
@ -0,0 +1,28 @@
|
||||
# WMIQuerySensor
|
||||
|
||||
The WMI query sensor is and advanced sensor that executes a user defined [WMI query](https://docs.microsoft.com/en-us/windows/win32/wmisdk/wmi-and-sql) and exposes the result. It should return a single value.
|
||||
|
||||
For example, If you wanted to find the current CPU frequency, the command :
|
||||
|
||||
```sql
|
||||
SELECT * FROM Win32_Processor
|
||||
```
|
||||
|
||||
returns
|
||||
|
||||
`|64|9|To Be Filled By O.E.M.|3|Intel64 Family 6 Model 94 Stepping 3|252|1|Win32_Processor|4008|12|64|Intel64 Family 6 Model 94 Stepping 3|CPU0|100|198|1024|8192|0|6|4|GenuineIntel|4008|Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz|4|4|8|To Be Filled By O.E.M.|False|BFEBFBFF000506E3|3|24067|CPU|False|To Be Filled By O.E.M.|U3E1|OK|3|Win32_ComputerSystem|GAME-PC-2016|8|1|False|False|`
|
||||
|
||||
This query cannot be used, and instead you should try
|
||||
|
||||
```sql
|
||||
SELECT CurrentClockSpeed FROM Win32_Processor
|
||||
```
|
||||
|
||||
which results in `4008` for my PC. Because this query retuens a single value (CPU frequency in MHz), it can be used with the current WMI query sensor implementation.
|
||||
|
||||
You can use [WMI Explorer](https://github.com/vinaypamnani/wmie2/tree/v2.0.0.2) to find see what data is available, or alternatively look at the user submited sensors below:
|
||||
|
||||
|
||||
|Query|Explanation|Submitted by|
|
||||
|---|---|---|
|
||||
|`SELECT username FROM Win32_ComputerSystem`|Shows the current user|@grizzlyjere|
|
Loading…
Reference in new issue