Author Topic: Turn off MD based on idle time  (Read 1655 times)

Dap-P

  • Veteran
  • ***
  • Posts: 89
    • View Profile
Turn off MD based on idle time
« on: October 16, 2013, 01:24:17 am »
I've been looking into this, and personally i would like to see the idle timer used for the screensaver also user to turn off my MD's.

In my opinion, this has base setting (maybe 1 hour) and adjustable from the webadmin (like the screensaver)

I am willing to research and try to implement this myself, just need some pointers where to start from the LMCE Gods, and some free time.

Anton

sambuca

  • Guru
  • ****
  • Posts: 449
    • View Profile
Re: Turn off MD based on idle time
« Reply #1 on: October 16, 2013, 07:43:32 am »
On a related note, you can also try to suspend your MDs instead of turning them off completely. If this works or not, depends on your hardware and is not enabled by default.
Details are in the wiki.

Generally speaking, the whole system has been designed to stay on at all times, so if you implement this, be sure to make it an option (with the default being like today imo).

I'd say that this could be added to the Orbiter code - I believe it is the one that controls the idle timeout today.

br,
sambuca

posde

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 3062
  • Wastes Life On LinuxMCE Since 2007
    • View Profile
    • My Home
Re: Turn off MD based on idle time
« Reply #2 on: October 16, 2013, 11:50:54 am »
I used to have the MD be turned off at night (at around 2am).

But it took the MD too long to power-on so I just leave it running. One other thing that can't work is the turning on of the pipes after power-on.

For example, atm, when the MD is powered off, and you say: Play TV, the MD will get powered on, but as the DCERouter is stateless, the Play TV never will reach its recipient. So what happens is: The MD will turn on. Full stop. Nothing more. That is not nice. And there is no easy way around this atm, due to the mentioned stateless-ness.

So, all in all, nice idea, but not doable with LinuxMCE without some MAJOR rewrite of the internals.

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5505
  • DOES work for LinuxMCE.
    • View Profile
Re: Turn off MD based on idle time
« Reply #3 on: October 16, 2013, 08:06:26 pm »
Actually... *gerbil-wheel-creaking* ;)

-Thom

Dap-P

  • Veteran
  • ***
  • Posts: 89
    • View Profile
Re: Turn off MD based on idle time
« Reply #4 on: October 16, 2013, 09:59:05 pm »
@posde
Big what if...
What if the core would know if the md is off? i think it already knows. and when play a video, check if md is off, if so, send power on command. when the md is booted, the md sends a "Ready for commands" message. and the core send the command to play media

@LMCE gods
I've looked through the orbiter.h and orbiter.cpp but i dont see how it works. any advise would be appreciated

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5505
  • DOES work for LinuxMCE.
    • View Profile
Re: Turn off MD based on idle time
« Reply #5 on: October 16, 2013, 10:03:04 pm »
Orbiter is a DCE device, just like everything else in LinuxMCE.

The Orbiter class (as defined in Orbiter.cpp/.h), is a decendent of Command_Impl, and if you look, you'll actually see a list of commands that are implemented. This is where the bulk of a DCE device's logic is. Orbiter's complexity comes from its abstraction, so that it can be ported to other graphics toolkits and rendering/windowing systems.

If you want to see how to make a DCE device, look at Developing a DCE device, and try to do it...You'll see how a simple DCE device works, and eventually be able to pick apart how Orbiter works.

If you have more specific questions, we will try to answer them.

-Thom

Dap-P

  • Veteran
  • ***
  • Posts: 89
    • View Profile
Re: Turn off MD based on idle time
« Reply #6 on: October 18, 2013, 04:06:51 pm »
Thom,

I've been looking through the orbiter code again, and i found where the screensaver and displayoff commands are started.
now to find how the timer works, how it gets the data from the admin webpage, etc.


Anton

posde

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 3062
  • Wastes Life On LinuxMCE Since 2007
    • View Profile
    • My Home
Re: Turn off MD based on idle time
« Reply #7 on: October 18, 2013, 06:02:02 pm »
@posde
Big what if...
What if the core would know if the md is off? i think it already knows. and when play a video, check if md is off, if so, send power on command. when the md is booted, the md sends a "Ready for commands" message. and the core send the command to play media

The dcerouter has NO intelligence. And it is good that way. The router only does one thing: It sends stuff around, it does not track state per se (even though the database does store such information). So, to have "Play TV" work like you would want to it to work, would mean a, imho, big rewrite of the router and/or another plugin, that would take care of the queue. Doable? Of course. I doubt, any of the existing devs would invest the needed amount of time into it atm. We have soooo many other things that do not work like they should, that everybody has their plate full. And the original architecture assumed always on MDs. If you keep it that way, or manually turn off/on the devices, you will have a much better experience. If you want to create a plugin that would be able to queue specific messages, feel free to dive into router, plugin development, and read all the dev pages we have in the wiki. If you have specific questions, feel free to come by the #linuxmce-devel channel @ freenode.net