FireTV client not letting DVR server go to sleep


#1

I'm having a problem with Windows 7 not sleeping. I ran powercfg -requests and channels is the culprit. I do not have a web UI active. I have a FireTV but it is on the home screen, not currently running any Channels stuff. I tried to do powercfg -waketimers but I was told "An unexpected error condition has occurred. Unable to perform operation. You may not have permission to perform this operation." I opened the cmd window with run as administrator.

Any suggestions?


Windows DVR not sleeping
#2

Wake timers probably only work in Windows 8 and Windows 10.

I think there's a bug on the FireTV app that's keeping a connection open to the DVR even while it's not active. If you force quit the FireTV app (or shut down the FireTV) does the DVR PC go to sleep?


#3

I meant to put that in but forgot. I unplugged the power to the FireTV and channels still showed up in -requests.


#4

On the DVR web UI settings page, does it show anything happening in the Activity section at the top?


#5

Activity is idle.


#6

Okay then you could check http://127.0.0.1:8089/dvr and see what it says for "busy" and "clients"


#7

Will do as soon as some recording finishes up.


#8

{"activity":{},"busy":false,"clients":1,"disk":{"free":869523988480,"total":2000396742656,"used":1130872754176},"enabled":true,"extra_paths":null,"keep":{"num":"","only":""},"last_backup":"2018-11-11T01:19:37.6092899-05:00","padding":{"end":"180","start":"180"},"path":"E:\Channels DVR","stats":{"groups":18,"files":2,"jobs":35,"rules":15},"status":"running"}


#9

And what exactly does the powercfg command output showing channels?


#10

SYSTEM:
[PROCESS] \Device\HarddiskVolume1\ProgramData\ChannelsDVR\latest\channels-dvr.ex
e

AWAYMODE:
[PROCESS] \Device\HarddiskVolume1\ProgramData\ChannelsDVR\latest\channels-dvr.ex
e


#11

Thanks. I will audit the code tomorrow to see if it's working correctly.

Are you sure you want your PC to sleep? If someone tries to use a FireTV while the PC is sleeping, it won't wake up automatically and DVR recordings and features will be unavailable.


#12

It will wake up to actually record stuff, right? Everyone is used to making sure the computer is on before watching something. We've used WMC for a few years. I would like the computer to sleep for the 12-14 hours a day it's not being used. Seems a waste to let it run for hours/day doing nothing.
I'll try a reboot and see what happens. Maybe something just got out of whack. If not keeping it awake on reboot, I'll do a short recording and see if it allows sleep. I'll let you know either way, but if it seems better, I'll continue to monitor and you can skip looking at code.


#13

As soon as the system boots up, powercfg and DVR both look the same as I posted a few minutes ago.

{"activity":{},"busy":false,"clients":1,"disk":{"free":871095173120,"total":2000396742656,"used":1129301569536},"enabled":true,"extra_paths":null,"keep":{"num":"","only":""},"last_backup":"2018-11-11T22:47:17.0735893-05:00","padding":{"end":"180","start":"180"},"path":"E:\Channels DVR","stats":{"groups":18,"files":2,"jobs":35,"rules":15},"status":"running"}

SYSTEM:
[PROCESS] \Device\HarddiskVolume1\ProgramData\ChannelsDVR\latest\channels-dvr.exe

AWAYMODE:
[PROCESS] \Device\HarddiskVolume1\ProgramData\ChannelsDVR\latest\channels-dvr.exe

Also, when I attempted restart, Windows said Channels "recording engine is busy" so I forced the restart.


#14

Okay I did a quick read through the code, and it adds the awaymode+system entries as long as busy=true or clients>0

In the json you pasted earlier showed clients=1, which means either a FireTV app was connected or an active browser on some other device has the DVR page open.

I plan to add a list of clients to the DVR web UI so it's easier to see what is connected at any given time..


#15

It will be interesting to see. I unplugged the Firetv power cord, rechecked my browser, and did a force stop on my Android phone app (even though it wasn't active at the time). I don't know of any other potential clients I have. I assume the HDHomeRun doesn't count as a client.


#16

I wanted to see when FireTV counts as a client. After I plugged in FireTV it initializes to the home screen. No client count increase. Clicked the app and the count increased. Then, when I exited the app back to the home screen of FireTV the client count did not decrease. It stayed at 2. I unplugged FireTV, went through the whole process again and the count is now stuck at 3.


#17

Interesting, sounds like a bug.

Can you open http://127.0.0.1:8089/debug/stack hit file>save and email to [email protected]


#18

Tried another variation. Rebooted again and watched /dvr. After startup was finished, client count was 0 briefly. I checked powercfg and channels was there. I refreshed /dvr and sure enough, the client count had gone to 1. The fire TV was in sleep mode before the reboot and through this process. I then woke up Fire TV and started the Channels app. The client count stayed at 1. It seems like the DVR is picking up the Fire TV client even when the Fire TV app was put to sleep from the home screen.


#19

Final variation. Unplugged Fire TV, rebooted, watched client count. It stayed 0.
Plugged in Fire TV, initializes to the home screen, client count stays 0.
Start Channels app, client count is 1.

It seems like once the app is started in FireTV it is considered always running no matter if it's in the foreground or not. Or even if FireTV is in sleep mode.


#20

This morning I heard my computer wake up. Meaning it must have gone to sleep. I do not have any idea why, but this morning powercfg -requests is not showing channels DVR keeping my computer awake and the client count is 0.

I bought a harmony hub yesterday and set up FireTV. The harmony hub turned everything off last night so I thought maybe it had some secret "off" switch the official FireTV remote did not use. That's the only change I've made. So, I just started FireTV and the Channels app with Harmony Hub and the client count (as expected) went to 1. I used Harmony Hub to turn everything off and the client count stayed at 1. So no secret "off" switch.

It is a mystery how the client count got to 0. It's back to 1 now. I will check occasionally.