plexconnect loses connection with aTV

Hi,

 

I have plexconnect working fine with my aTV3, but sometimes the connection drops (the DOS console shows no dns-re-routings) and i either have to restart plex, my pc, or plexconnect.. but i have not managed to work out which of these steps is needed and what causes the issue. I'll tend to end any plexscriptinghost(?), python processes etc and start everything again.

 

I can watch a whole program fine and then find when i go back to the menu at the end of it, it just says "apple trailers cannot be found" etc. this doesnt happen all the time though

 

now one thing to note is that I have my PC set to "away mode" (Win7) and I think this is working ok with plex.... my streaming continues and the I/O cuts off as far as i can tell. could this be causing one of the python processes to stop running?

 

I guess the first thing to do is disable "away mode" and see if anything improves, but any other suggestions are welcome

 

thanks

J

 

 

my settings:

 

[PlexConnect]
logpath = .
enable_dnsserver = True
ip_webserver = 192.168.0.100
prevent_atv_update = True
enable_plexconnect_autodetect = True
port_pms = 32400
port_webserver = 80
ip_plexconnect = 192.168.0.100
certfile = C:\Portable\PlexConnect\PlexConnect-master\assets\certificates railers.pem
ip_dnsmaster = 194.168.8.100
loglevel = Normal
ip_pms = 192.168.0.100
enable_plexgdm = False
port_ssl = 443
port_dnsserver = 53
enable_webserver_ssl = True

Also, aside from that, in terms of booting my pc, running plex (currently launching with windows), running plexconnect, and bringing the aTV out of sleep… What is the best order of operations there? Should the aTV really be up and running before I launch plexconnect or will plexconnect just find the aTV when it needs to?


Thanks

So I’ve just finished watching a program, in which time it seems the pc did enter away mode (the light was off, as was the screen, but my media was still streaming)


Attempting to return to the plex menu just said “accessing trailers”


So I went to the PC and made sure it was properly awake again, gave it a minute, then went back to the aTV. Started working again.


So can plexconnect/python not function in “away mode”?. I’m not sure what this mode actually does. I know it turns off various peripherals for I/O but obvious the CPU, HDD and Network interface still need to be running in order to stream.


Thanks for any advice

J

Where is you media stored? On the PC's hard drive? On a NAS type drive?

What media are you streaming? aTV native stuff? Transcoding required?

  • Media on an external USB (Iomega 2TB), H.264 mp4’s


    Not sure if it’s being transcoded.


    In the past I’ve seen the DNS requests stop showing up in the DOS console altogether… Just hangs trying to access trailers. I’m going to let this 2nd video finish playing, allow the PC to enter away mode, then see if it’s stuck again and do the wake & wait as above. I’ll let you know if it does the same again


    Thanks

    J

What is the best order of operations there?

Most network traffic from the ATV is going to be routed through the computer with PlexConnect. Without Plexconnect running, your ATV will not be able to access the internet, so it would be best to have PleX start automatically, then run PlexConnect, and then start up the ATV, but to be totally honest, it really doesn't matter. The ATV will attempt a reconnect every couple of seconds, so even if you start it first, it will connect as soon as PlexConnect is up and running.

>> * Media on an external USB (Iomega 2TB), H.264 mp4's

USB atached to your PC, some sort of Router or somewhere else?

MP4/h264 can be handled by aTV nativley, no need for transcoding (depending on the audio codec).

No the powered USB is attached directly to the PC. It’s not the media that it’s losing though, it’s the DNS forwarding I think. I’m sure plexconnect is stopping working when the PC goes into “away mode”. I left the plex browser video player on by accident the second time round which prevented the PC from going into “away”, so by the end of the video I was watching, everything was still functioning.


I’ll do a 3rd test tonight to let the PC go into “away” again and I’m assuming plexconnect will cut off again till I “wake” it. If that’s the case I’ll need to work out if it’s possible to keep plexconnect/python running properly in “away mode”… I would have thought the PC kept running everything ? (Other than peripheral I/O)

This might be worth noting, from another thread it seems Plex itself was updated so that its execution threads ran in away mode I believe. Presumably the plexconnect/python script isn’t doing that?


“Microsoft provides an easy solution to prevent this though, SetThreadExecutionState. Just need to call it with ES_CONTINUOUS | ES_SYSTEM_REQUIRED once streaming has begun, and with ES_CONTINUOUS once it’s finished. If Plex wants to be very ambitious the authors could even look into “away mode”, which would allow PMS to stream whilst the computer appears to be in standby”


http://forums.plexapp.com/index.php/topic/30351-pms-does-not-prevent-windows-from-entering-standby/


J

presumably it would actually need this rather than ES_SYSTEM_REQUIRED
 

ES_AWAYMODE_REQUIRED 0x00000040

Enables away mode. This value must be specified with ES_CONTINUOUS.

Away mode should be used only by media-recording and media-distribution applications that must perform critical background processing on desktop computers while the computer appears to be sleeping. See Remarks.

Windows Server 2003 and Windows XP:  ES_AWAYMODE_REQUIRED is not supported.

http://msdn.microsoft.com/en-us/library/windows/desktop/aa373208(v=vs.85).aspx

 

 

i think it can be used within python script? eg

https://gist.github.com/CBWhiz/5258552

 

definitely "away mode" issue. i tried to put some of the stuff from https://gist.github.com/CBWhiz/5258552 into the plexconnect scripts, but I've no real idea what i'm doing! n00b guesswork. put it into some of the "run" functions... didn't work anyway. worth a try!

be great if someone was able to implement this, as currently i'm having to send a WOL packet at the end of each video to "wake" the PC back up, and then wait briefly for plexconnect to kick in again.

thanks

j

ios or droid devices have wol apps, why not just set your power save to a higher limit like 3hrs or shut it off completely.

Hi thanks I am currently using mWOL on my iPhone.

however "Away Mode" is designed as a low power state for Windows media-servers. Support has been built into plex itself looking at developer comments, but plexconnect scripts run as a separate process. I'm specifically asking how to get the plexconnect python scripts to continue running in "Away Mode" sorry. 

I was going to change the forum topic to specifically relate to "Away Mode" but I am unable to edit it.

thanks

J

There is no way to disable “away mode”?

sorry just to clarify. i'm *choosing* to have my PC go into "away mode" by setting it in the power balancing options.  i'm trying to resolve what happens from there.

I would disable it personally and call it a day. There is no other option such as sleep you can use instead?

"sleep" would turn the whole thing off and i wouldnt be able to watch anything.! sorry the requirement here is to retain streaming services  & interactivty witht he AppleTV whilst the PC powers-down slightly (Away Mode)... Plex itself does it, PlexConnect doesnt. so currently whilst I'm watching video, my pc will happily go into the "Away" low power state and Plex will carry on streaming. it's just PlexConnect that disconnects because it's not running with ES_AWAYMODE_REQUIRED

yes the simplest option is to disable sleep/away and just leave the PC on full power. here's some info on "Away Mode" anyway
http://www.pcworld.com/article/261390/improve_your_media_center_pcs_power_management_with_away_mode.html

and the original thread about Plex's implementation
http://forums.plexapp.com/index.php/topic/30351-pms-does-not-prevent-windows-from-entering-standby/

thanks

J

Since pms works try debugging from there. Maybe you need to make plexconnect run differently at statup such as a windows service etc.


Are you starting plexconnect using this method: WINDOWS Add Plexconnect.py to your Windows Startup menu folder? What version of windows are you running exactly? Server?

Windows 7.

I know you can run python scripts in the background by changing the .py to .pyw but i think that just prevents the console window.

AFAIK the python process would need to be running with the ES_AWAYMODE_REQUIRED flag in order for it to continue running in away mode. i tried putting that (as per https://gist.github.com/CBWhiz/5258552 ) in the various run() functions but that doesnt do anything, and to be honest i dont know python or windows that well to be doing anything other than guesswork.

i think you're probably right that it may need to run as a service eg http://stackoverflow.com/questions/32404/can-i-run-a-python-script-as-a-service-in-windows-how but that's beyond anything i know how to implement.

here's a better explanation of what it does

http://blogs.msdn.com/b/david_fleischman/archive/2005/10/21/483637.aspx
 

Away Mode does the following when invoked:

  • Shuts down the video signal at the port
  • Mutes all system audio
  • Blocks HID and PS/2 input devices (so your cat does not walk across the “delete” key and delete your library)
  • Puts the CPU into “adaptive” mode, which may save power depending on what’s running
  • Notifies kernel-mode and user-mode components of the transition (enables HW like video cards to clock-down or front-panel displays to change content, enables SW to do “smart” things like IM going to “away”)
  • Notifies the BIOS through an ACPI control method of the transition (enables the power LED to change from green to whatever, enables a different thermal profile to be put in place if the OEM decides)
  • Wakes back up when flash devices (USB FOB, flash card) are inserted
  • Wakes back up when an optical disc is inserted in the drive