No PC after bedtime

My GF and her son live with me and he can’t seem to keep himself from getting up in the middle of the night to play on his computer. Her solution was to physically remove his pc from his room before he went to bed every night. I decided to find a better one. He doesn’t have admin rights to his pc so he can’t turn off services. Followed this guide to setup WOL on his pc and within Hass.

This gave me a “Kill Switch” for his PC that also changes states to show whether the computer is actually on or not. Next came the automation part. I’m not a coder so while I probably done this within Hass using yaml, Node-Red was much easier. I created a Poll-State in my flow and set it to “true if on” then had the true output go to two time windows, one bedtime to midnight and the other midnight to 6am. If it is inside those they output to the last node that sends the signal to kill the pc. I did add one automation inside HAss that ties to a Helper “Grounded” switch. If that switch is on and he turns on his computer it will immediately send the shutdown command.
I have example code if anyone is interested. I’d also like to hear any ideas you have on how to improve or expand on this project.

Dub

2 Likes