Okay then you could check http://127.0.0.1:8089/dvr and see what it says for "busy" and "clients"
Will do as soon as some recording finishes up.
{"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"}
And what exactly does the powercfg command output showing channels?
SYSTEM:
[PROCESS] \Device\HarddiskVolume1\ProgramData\ChannelsDVR\latest\channels-dvr.ex
e
AWAYMODE:
[PROCESS] \Device\HarddiskVolume1\ProgramData\ChannelsDVR\latest\channels-dvr.ex
e
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.
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.
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.
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..
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.
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.
Interesting, sounds like a bug.
Can you open http://127.0.0.1:8089/debug/stack hit file>save and email to [email protected]
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.
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.
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.
The client count is still a problem. Since I wrote 3 days ago I haven't detected the computer going to sleep at all. I do not know why it did that day. Will continue to investigate. In the meantime, having a UI show me what clients are active would really help.
I did some more investigation. I unplugged my FireTV and rebooted the computer for a fresh start.
summary
WebUI, recording, and Android app behave properly with respect to Busy and Client Count.
Amazon FireTV 4K continues to run in background keeping the client count = 1.
Force stop the Channels app allows Client Count = 0.
Drilling down to force stop every time I watch the client on FireTV is cumbersome.
I request either
- The app force stop itself when not in foreground
- be smart enough to know when in background to decrement Client Count
- Provide an exit/quit button in the app that will close it
Doug
Details
Watched Web UI on now TV.
Busy=T, client count=0, powercfg requests=Channels
Recording in progress.
Busy=T, client count=0, powercfg requests=Channels
Finished those processes.
Busy=F, client count=0, powercfg requests=none
Started Android app on phone.
Busy=F, client count=1, powercfg requests=Channels
Swiped to close android app.
Busy=F, client count=0, powercfg requests=none
Started FireTV app.
Busy=F, client count=1, powercfg requests=Channels
Return to home screen (only way to exit FireTV Channels)
Busy=F, client count=1, powercfg requests=Channels
Used utility app to view all apps running in background. Channels was.
Went to settings, apps, manage, and force stop Channels app
Busy=F, client count=0, powercfg requests=none
Will fix for next build. This is how the app behaves on Apple TV, iPhone, android tablets etc
This issue is fixed in today's 2.1.1 release.
Yes it is! Thank you very much!