Turning device off/on when PC screensaver starts/stops

I use a TV as my computer monitor. Unfortunately the TV does not switch off when the PC turns off the monitor on idle or enters standby.

I have the monitors connected to a Xiaomi smart socket which I can control via Google Home at the moment, but would like to automate it. One way would be to get a USB-CEC adaptor but they’re pretty expensive. If I could turn off the Xiaomi socket after an idle period, and turn it back on when the mouse is moved, that would be perfect.

I can configure Windows Task Scheduler to run a program when the screen saver starts and stops, but is there a way to control Home Assistant directly from Windows? Triggering with a URL? The closest I could find is this, but the poster went for the iOS app instead.

Thanks!

A webhook trigger would be the simplest method.

I use evenghost on my PC with the MQTT plugin and that can send MQTT messages to and from HA and the PC

http://www.eventghost.net/forum/viewtopic.php?f=9&t=5728&hilit=mqtt

That was too easy, thanks! I’ll give that a whirl. :slight_smile:

That looks good too, thanks, will check it out!

This gave me an idea and I’ve done similar - after 10 mins of inactivity I’ve got my TV turning off and it turns back on when I move the mouse.
Luckily, my TV is an LG with webOS so can use the media player integration for it to turn it on and off.
I used an MQTT binary sensor that gets its state from eventghost and used that in automations

1 Like

Just set it up, it works like a charm. Thanks Tinkerer!

Can you you post the solution, not familiar how to write a webhook correct?