GeorgeCalli 19 Posted October 24, 2024 Posted October 24, 2024 (edited) I’m trying to automate putting my PC (Windows 10, Emby Version 4.8.10.0) to sleep at an allocated time using a Script, Task Scheduler, and PowerShell, but I want to keep it awake when media (like movies or music) is playing. However, while playing media, I receive the message: “Emby Server is idle with no significant activity, putting the PC to sleep.” Emby Server’s CPU usage is 0%. I’ve tried using the Emby Server API key and localhost, but I can’t get PowerShell to recognize that Emby Server is playing movies or music even though PowerShell sees it as idle i.e. the server. I’ve even tried monitoring network traffic, CPU usage, CPU spikes or a combination thereof. Has anyone had experience with this and can offer a solution? Any suggestions on how to prevent the PC from sleeping when Emby Server is playing? Your assistance will be appreciated. Thanks. P/S Apologies: I just notice that I posted this under Android Server and not Windows. Unfortunately, I don't know how to move. Edited October 24, 2024 by GeorgeCalli
Luke 39998 Posted October 24, 2024 Posted October 24, 2024 Quote However, while playing media, I receive the message: “Emby Server is idle with no significant activity, putting the PC to sleep.” Emby Server’s CPU usage is 0%. I Hi, what gives you this message? that is not an emby message. We don't have that text anywhere.
GeorgeCalli 19 Posted October 24, 2024 Author Posted October 24, 2024 Windows Powershell gives me the message. So sorry that I wasn't clear! Thought I'd ask, maybe someone would know what of the Emby Server I needed to monitor. Apologies for not being clearer.
GeorgeCalli 19 Posted October 25, 2024 Author Posted October 25, 2024 My question in simpler terms: I'm trying to prevent my PC from going to sleep when media (like movies or music) is playing on Emby. I want the PC to sleep only via script, task scheduler, and PowerShell. Has anyone found a solution for keeping the PC awake while Emby is active?
Luke 39998 Posted October 25, 2024 Posted October 25, 2024 Quote I'm trying to prevent my PC from going to sleep when media (like movies or music) is playing on Emby. Hi, on Windows, Emby will already handle this for you.
GeorgeCalli 19 Posted October 25, 2024 Author Posted October 25, 2024 Thanks for that. I was watching a movie on TV through Emby, and PC went to sleep. Hence the reason I'm looking into this. Also, If I'm streaming music through Emby, PC also goes to sleep. I'm trying to prevent PC going to sleep if I'm streaming media.
Carlo 4552 Posted October 26, 2024 Posted October 26, 2024 All you need to do is setup windows sleep mode normally.
Luke 39998 Posted October 28, 2024 Posted October 28, 2024 On 10/25/2024 at 10:25 AM, GeorgeCalli said: Thanks for that. I was watching a movie on TV through Emby, and PC went to sleep. Hence the reason I'm looking into this. Also, If I'm streaming music through Emby, PC also goes to sleep. I'm trying to prevent PC going to sleep if I'm streaming media. By PC do you mean the same machine as the server?
GeorgeCalli 19 Posted October 28, 2024 Author Posted October 28, 2024 I did exactly that, but whilst streaming a movie, PC went to sleep and subsequently Emby and movie stopped.
GeorgeCalli 19 Posted October 28, 2024 Author Posted October 28, 2024 Yes, same machine. It's a Windows 10 computer that also runs Emby for Windows.
GeorgeCalli 19 Posted October 28, 2024 Author Posted October 28, 2024 (edited) Some feedback I reset the power settings to default and checked settings ensuring sleep is set to allocated time. Streamed music from Emby and noticed that the computer went to sleep even though music was playing. Exactly what had happened whilst playing a movie. This is what I was trying to overcome. Thank you. Edited October 28, 2024 by GeorgeCalli Grammar 1
GeorgeCalli 19 Posted October 30, 2024 Author Posted October 30, 2024 On 10/28/2024 at 2:50 AM, Luke said: By PC do you mean the same machine as the server? Yes.
Luke 39998 Posted November 1, 2024 Posted November 1, 2024 On 10/28/2024 at 9:08 AM, GeorgeCalli said: Some feedback I reset the power settings to default and checked settings ensuring sleep is set to allocated time. Streamed music from Emby and noticed that the computer went to sleep even though music was playing. Exactly what had happened whilst playing a movie. This is what I was trying to overcome. Thank you. Can we please look at a specific example? How to Report a Problem Thanks.
GeorgeCalli 19 Posted November 13, 2024 Author Posted November 13, 2024 I think I might have figured out the issue. If the PC goes to sleep via Power Plan settings by selecting a time interval to sleep, and Emby is streaming, Emby keeps the PC awake. However, if the PC is set to go to sleep at a specific time via Task Scheduler and PowerShell with the following command: Program/Script: rundll32.exe Argument: powrprof.dll,SetSuspendState 0,1,0 Emby seems not to recognize this command and thus can't prevent the PC from sleeping while streaming media. Is there perhaps an additional argument I need to add to the script, or won't this option work?
VIDE08 1 Posted November 13, 2024 Posted November 13, 2024 you need to setup windows sleep mode normally.
Luke 39998 Posted November 14, 2024 Posted November 14, 2024 11 hours ago, VIDE08 said: you need to setup windows sleep mode normally. Hi @VIDE08can you explain to him what you mean by normally? Thanks !
Luke 39998 Posted November 14, 2024 Posted November 14, 2024 Quote However, if the PC is set to go to sleep at a specific time via Task Scheduler and PowerShell with the following command: Program/Script: rundll32.exe Argument: powrprof.dll,SetSuspendState 0,1,0 Emby seems not to recognize this command and thus can't prevent the PC from sleeping while streaming media. Is there perhaps an additional argument I need to add to the script, or won't this option work? Maybe the argument is don't have it sleep this way at all? I realize you're looking at this from the point of view of thinking that this is an Emby problem, but Emby has registered a hold with the system to keep it awake. I think it is more accurate to say that the method of sleeping that you are using with the task scheduler is bypassing this.
GeorgeCalli 19 Posted November 14, 2024 Author Posted November 14, 2024 I realise that. I thought it would work with any sleep command. Don't see it as an Emby problem at all, just thought there might be a way to make it work if a specific sleep time is set. Thanks for your comments. You are right, won't have it sleep this way.
rbjtech 4990 Posted November 14, 2024 Posted November 14, 2024 On 13/11/2024 at 08:26, GeorgeCalli said: I think I might have figured out the issue. If the PC goes to sleep via Power Plan settings by selecting a time interval to sleep, and Emby is streaming, Emby keeps the PC awake. However, if the PC is set to go to sleep at a specific time via Task Scheduler and PowerShell with the following command: Program/Script: rundll32.exe Argument: powrprof.dll,SetSuspendState 0,1,0 Emby seems not to recognize this command and thus can't prevent the PC from sleeping while streaming media. Is there perhaps an additional argument I need to add to the script, or won't this option work? Can you not set a 'Condition' on the windows scheduler task to say only start the 'sleep' task if the PC is idle ? If streaming, Emby is forcing it to be 'not idle' - so your sleep task would not run. If it's not, then your sleep task would run and sleep the PC .. I haven't tested this - but this may work ..
GeorgeCalli 19 Posted November 14, 2024 Author Posted November 14, 2024 44 minutes ago, rbjtech said: Can you not set a 'Condition' on the windows scheduler task to say only start the 'sleep' task if the PC is idle ? If streaming, Emby is forcing it to be 'not idle' - so your sleep task would not run. If it's not, then your sleep task would run and sleep the PC .. I haven't tested this - but this may work .. Thanks for that. I had tried that, and to reaffirm tried it again now, unfortunately it does not work. Yet, setting PC to sleep normally via intervals, Emby keeps PC awake whilst streaming. 2
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now