hass-workstation-service icon indicating copy to clipboard operation
hass-workstation-service copied to clipboard

On computer wake from sleep, SessionStateSensor remains Unknown

Open amaisano opened this issue 2 years ago • 3 comments

I have two Windows 10 machines in my office. Both exhibit this behavior.

After choosing "Sleep" from the Windows start menu, upon waking back up via a Wake On Lan command (wake on magic packet via LAN) or keyboard, HASS W doesn't report a change from the SessionStateSensor to Home Assistant.

Waking the machine puts me back into the lock screen, by the way, for security purposes.

The LastActivity sensor works (is picking up when I move my mouse), but the SessionStateSensor (InUse, Off, etc) is stuck on Unknown.

If I unlock my screen, then lock my screen again, SessionStateSensor goes to Locked. But I don't want to have to do that after waking up and unlocking the first time .

Here's the timeline

  1. Launch HASS Workstation Unknown -> InUse
  2. Click "Sleep" in Windows InUse -> Locked -> Off -> Unknown (happens over 1-2 minutes)
  3. Wake computer by tapping the keyboard or using a wake_on_lan command Unknown (no transition)
  4. Unlock and get back into Windows still Unknown (no transition, but LastActivity is working)
  5. Lock screen (Windows + L) Unknown -> Locked
  6. Unlock screen (enter password) Locked -> InUse

If it's stuck in Unknown and I edit the SessionStateSensor in the UI, (without actually changing anything) and click save, it bumps it to InUse in Home Assistant.

Any tips? It seems somewhat related to https://github.com/sleevezipper/hass-workstation-service/issues/58 and/or https://github.com/sleevezipper/hass-workstation-service/issues/46

amaisano avatar Feb 09 '22 19:02 amaisano

I have the exact same issue, exactly as described.

cromelex avatar Feb 11 '22 18:02 cromelex

Related to #168 too

HeedfulCrayon avatar Feb 11 '22 23:02 HeedfulCrayon

FYI I am using this workaround.

  1. Create a HASS WS sensor for GPU or CPU temperature.
  2. Create a template binary_sensor in HA called "PC Power" and set it to this new HASS WS sensor:
value_template: "{{ is_number(states('sensor.bebop_gpu_temp')) }}"
  1. Profit. Apparently the GPU/CPU sensor always seems to work after sleep/wake, and is instantaneous. It's either a number, or it's unknown when the PC is off (not a number).

amaisano avatar Feb 15 '22 15:02 amaisano