Changes

From Amahi Wiki
Jump to: navigation, search
4,389 bytes added ,  03:42, 23 June 2020
{{MessageBox|backgroundcolor = #FBB|
image =Warning.png|
heading =WARNING|
message = This is no longer supported on Amahi 6 or greater.}}
 
[[Image:Amahi-Energy-Saver_Logo.png|150px]]<br>
==General==
This project is approaching in solid betastage. It runs fine on my machine, however I need more feedback from the community to be sure that it's stable enough for the general publicInstallation requires a little Linux knowledge. So, please test and report your experience!
If you like it, like it on facebook: <br>http://www.facebook.com/pages/Amahi-Energy-Saver/218015224890441
==Introduction==
Running servers when they are not needed can waste a considerable amount of energy. This project aims at sending application tells your Amahi server to suspend or poweroff power off when its services are not needed.
To do so, Amahi Energy Saver regularly scans for connected clients, which are defined in the "monitored host list". If none of these clients is turned on, the system suspends after a configurable period.
So, for instance, you may want to add your client PC and your PS3 to the monitored host list. The Amahi Box will then stay up and running as long as client PC and/or PS3 are up and running. However, you might not want to add your home router to the list, as the router is always turned on.
With the calendar fucntion function one can define scheduled wake ups and periods during which the server shall stay awake no matter what.
Amahi Energy Saver also checks shares. As long as shares are accessed, the server does not suspend. If set up to do so, Squeezeboxserver is monitored to prevent suspend while Squeezeboxes are turned on.
When the system is to be used again, simply wake it up with WOL (ref. http://en.wikipedia.org/wiki/Wake-on-LAN). There are many tools to generate WOL packets, and it is even possible to wake your server over the internet (good link: http://www.wakeonlan.me/).
==Installation==
==Download=One Click installation===
Download the latest version here: The easiest way is to install [http://codewww.googleamahi.comorg/papps/amahienergysaver/downloads/listamahi-energy-saver Amahi Energy Saver] via the Amahi One Click installation.
Sources are available at Git===Manual installation - NOT SUPPORTED ANYMORE, BUT MAY STILL WORK===Download the latest tested and released version here:httpshttp://githubcode.google.com/jayrockkp/amahienergysaver/downloads/Amahi-Energy-Saverlist * Initial installation
==Initial setup==1. Copy the tar.gz file from the download page to some folder and unpack it with
1. Copy the tar.gz file from the download page to some folder and unpack it with <code> tar -zxf filename</code>.
2. Open a terminal, change to that folder and get superuser rights by running <code>su</code>
3. As root, run <code>./aes-install.sh</code>
4 cd installfiles . Navigate to <code>/usr/share/aes</code> and run <code>./aes.rb --shownetworkhosts</code> to show and select to add any currently active network host to the list of monitored hosts. Run <code>./aes.rb --showmonitoredhosts</code> to check the monitored hosts and delete the ones you want to removeinstall.sh
54. As root, run <code>service aes start</code> to start the service. Be careful, when you start When the service the sytem MAY go to sleep when you don't expect it. Once it works as you want itinstallation is finished, run <code>chkconfig aes on</code> to make reboot the service start on bootcomputer.The config app is accessible at
<nowiki>http://hda:6500</nowiki>
==Integration with Amahi calendar==
1. Open a terminal on your hda.
===Step-by-step guide===1. In the config app, select ical in the Calendar field. 2. Type Hit the "Apply button in the config app 3. Connect your client to the new calendar. NOTE: Please read this article if you are unsure how to do this: [[Calendars]] 4. Use your favourite calendar client to populate the calendar with events. Done! Your HDA will now wake up and stay powered on according to the events defined in the aes calendar.  ===Example: Set up Mozilla Sunbird for use with Amahi Energy Saver calendar=== The following description was created based on Sunbird 1.0b1 running on Windows 7. In Sunbird, select "File" -> "Connect to remote calendar..."A dialog shows up. Choose "On the network" [[Image:AES_Sunbird_1.jpg]]<br>   Press "Next". Choose "iCalendar (ICS)" in the dialog and type "http://calendar/aes.ics" in the Location field. [[Image:AES_Sunbird_2.jpg]]<codebr>su   Press "Next". In the following dialog you may deselect the checkbox "Show Alarms", though it's not neccessary for Amahi Energy Saver to work. [[Image:AES_Sunbird_3.jpg]]</codebr>   Press "Next" then "Finish". You will notice an exclamation mark next to the calendar on the right tab.  [[Image:AES_Sunbird_4.jpg]]<br>    Right click the calendar, select "Properties" and provide your root passwordmake sure "Read Only" is deselected. [[Image:AES_Sunbird_5.jpg]]<br> 
3. Type <code>cd /usr/share/aes</code>
Finished. Below is an example screenshot with a task defined on 2011-07-06 2:30-3:00 and another one 4:30-5:30. Type <code>In the example, the HDA will not go to sleep during these periods, and will wake up if it is suspended./aes --calendar ical</code>
5[[Image:AES_Sunbird_6. Now, open your HDA dashboard and go to "Settings" -jpg]]<br> "Calendars".
6. Add a new calendar named <code>aes</code>
7==MythTV integration (version 0. Connect your client to the new calendar8. NOTE: Please read this article if you are unsure how to do this: [[Calendars]]12 and later)==
8Before Amahi Energy Saver suspends the HDA, it checks with MythTV server if any recordings are scheduled and if so sets the wake up timer accordingly. Use your favourite calendar client to populate If the recording folder is one of the calendar with eventsshares, it is ensured that Amahi Energy saver will not suspend the HDA while a recording is ongoing.
Please note that MythTV installation itself is non-trivial. The above assumes that MythTV is correctly installed and working.
Done! Your HDA will now wake up ==Let other apps control Amahi Energy Saver (version 0.8.12 and stay powered on according to the events defined in the aes calendar.later)==
Sometimes you may wish to prevent Amahi Energy Saver from suspending the HDA while some other action is ongoing. There are two simple interfaces to achieve that.
==Command Line Interface=Script interface===*Note: Currently root privileges are required to execute the CLI command. Navigate to /usr/share/aes to use the CLI correctly.
<code>.Amahi Energy Saver regularly checks the directory /usr/share/aes-lock for scripts and executes them.rb --shownetworkhosts</code><br>Lists If any of the hosts found in the network, iescripts returns an errorlevel of 1, all devices connected to the networkHDA will not be suspended. Both Bash (*.sh) and Ruby (*. Gives the user the choice to add hosts to the monitored host listrb) are supported.
<code>The scripts can be extremely simple./aes.rb --showmonitoredhosts</code><br>Show In pseudocode a list of all hosts which are monitored by AES (i.e. the monitored host list), and also allows to delete hosts from the list. If these hosts are up and running (and respond to ping), the server does not suspend.script looks like this:
<code>./aes.rb --addhost macadress</code><brpre>Manually add a host to the monitored host list. Observe the MAC address format, which has to be XX:XX:XX:XX:XX:XX. Example is <br> <code>./aes.rb --addhost 12:34:56:78:90:abif (condition) exit 1else exit 0end</codepre>
<code>./aes.rb --calendar [off|internal|ical|debug]</code><br><code>./aes.rb --calendar</code> shows the current setting. <code>./aes.rb --calendar off</code> turns the calendar offFor a collection of scripts, <code>./aes.rb --calendar calendar<please see this thread: http:/code> makes aes use its internal calendar function and <code>./aesforums.rb --calendar ical</code> activates the Amahi calendar integration. To show diag information use <code>amahi.org/aesviewtopic.rb --calendar debug</code>php?f=15&t=3320&p=16486#p16486
<code>./aes.rb --showcalendar</code><br>Lists the current entries of the internal. Calendar entries define times when the server does not suspend. Also, the server will be woken up at the beginning of a calendar entry.===Lock files===
<code>.Amahi Energy Saver regularly checks the directory /aes.rb --addcalendar startdate starttime stopdate stoptime<usr/code><br>Use this command to add an entry to the internal calendar. Format of startdateshare/stopdate: YYYY-MMaes-DD Format of starttime/stoptime: hhm:mmlock for files with suffix '. Eglock'. <br><code>As long as any such file exists, Amahi Energy Saver will not suspend the HDA./aesThis is useful for other applications that support events.rb --addcalendar 2010-12-20 15:00 2010-12-20 16:00</code> <br>will keep One Event may trigger the creation of the server awake on Dec 20thlock file, 2010 from 15 to 16 hrs (3 to 4 pm). The server will also wake up at 15 hrs if it is suspendedand another one may delete the lock file.
<code>E./aesg.rb --shutdowntype</code><br>Show and modifiy , the type of shutdown. NOTE: Not all shutdown types may be supported on your system, or may work correctly. Therefore, test event that your machine is suspending and coming up correctly before deciding for a setting. Poweroff is safest type.shall cause the HDA to stay awake no matter what can call
<code>./aes.rb --sbs [on|off|debug]</code><br><code>./aes.rb --sbs</code> shows the current setting. <code>. touch /aes.rb --sbs on<usr/code> and <code>.share/aes.rb --sbs off<lock/code> switch monitoring of Squeezeboxserver on or off, respectivelysome. The command <code>./aes.rb --sbs debug</code> displays diagnostic informationlock
<code>./aes.rb --interval</code><br>aes checks regularly if When the system can be suspended or shut down. This parameter specifies job is finished, the time in seconds between two such checks. Normally respective event should be left untouched.call
<code>. rm -f /usr/share/aes.rb --help<lock/code><br>Displays command line helpsome.lock
Make sure to use individual names for the lock files, so that you don't accidentally delete the lock file of another application.
==Selecting ShutdownType==
The different options for ShutdownType are explained here:<br><br>
 
Deactivated
Amahi Energy Saver is running in the background, however it will never shutdown or suspend the HDA.
Poweroff
* If you are brave or the ACPI options don't work, try mem, disk or standby.<br><br>
==Logs and LogAnalyzer==Depending on the version installed the logs are located in /usr/share/aes or /var/hda/web-apps/html/aes/lib.  * From version 0.8.12 onwards, the log files have been moved to /var/log. In any case the files are named named aes.log* In order to view the Amahi Energy Saver logs in the LogAnalyzer (ref. http://www.amahi.org/apps/loganalyzer) navigate on your LogAnalyzer homepage to "Admin Center" then "Sources" and finally klick "Add new Source". Configure the new source for the Energy Saver logs as shown in the screenshot below (note that the directory may have to be adjusted, see above): [[File:LogAnalyzer_Config_for_Amahi_Energy_Safer.png]]   ==Windows clientfor Wake on LAN==
On the download page there is a Windows client for automatic or manual wakeup of the HDA.
4. Hit the "OK" butten, then right click on the symbol again, select "Exit" and and restart the program as described in 1.
5. Done! You should now be able to start your HDA by right double clicking on the icon in the symbol bar and select "Wake now"  ==Mac OS X clients for Wake on LAN== There exist a few solutions (WOL clients) to wake up your HDA from a Mac OS X computer. In order to wake up your HDA while booting your Mac you may use NASwake (ref. http://trick77.com/2010/12/22/wake-nas-at-boot-time-wake-on-lan-wol/). It comes ready to use as an installable package, you just need to enter the MAC-adress of the HDA.<br><br>WakeOnLan is a freeware application provided by Readpixel which offers a very comfortable way to wake up your HDA directly from your Mac OS X desktop (ref. http://www.readpixel.com/wakeonlan/index.html).  ==Sources==Latest untested sources are available at Git:https://github.com/jayrockk/Amahi-Energy-Saver ==OBSELETE: Command Line Interface== *Note: Root privileges are required to execute the CLI command. Navigate to /usr/share/aes to use the CLI correctly.  ./aes.rb --shownetworkhosts Lists the hosts found in the network, ie, all devices connected to the network. Gives the user the choice to add hosts to the monitored host list.   ./aes.rb --showmonitoredhosts Show a list of all hosts which are monitored by AES (i.e. the monitored host list), and also allows to delete hosts from the list. If these hosts are up and running (and respond to ping), the server does not suspend.  ./aes.rb --addhost macadress Manually add a host to the monitored host list. Observe the MAC address format, which has to be XX:XX:XX:XX:XX:XX. Example is <br> <code>./aes.rb --addhost 12:34:56:78:90:ab</code>  ./aes.rb --calendar [off, internal, ical, debug] <code>./aes.rb --calendar</code> shows the current setting. <code>./aes.rb --calendar off</code> turns the calendar off, <code>./aes.rb --calendar internal</code> makes aes use its internal calendar function and <code>./aes.rb --calendar ical</code> activates the Amahi calendar integration. To show diag information use <code>./aes.rb --calendar debug</code>  ./aes.rb --showcalendar Lists the current entries of the internal calendar. Calendar entries define times when the server does not suspend. Also, the server will be woken up at the beginning of a calendar entry.  ./aes.rb --addcalendar startdate starttime stopdate stoptime Use this command to add an entry to the internal calendar. Format of startdate/stopdate: YYYY-MM-DD Format of starttime/stoptime: hhm:mm. Eg. <br><code>./aes.rb --addcalendar 2010-12-20 15:00 2010-12-20 16:00</code> <br>will keep the server awake on Dec 20th, 2010 from 15 to 16 hrs (3 to 4 pm). The server will also wake up at 15 hrs if it is suspended.  ./aes.rb --shutdowntype Show and modifiy the type of shutdown. NOTE: Not all shutdown types may be supported on your system, or may work correctly. Therefore, test that your machine is suspending and coming up correctly before deciding for a setting. Poweroff is safest type.  ./aes.rb --sbs [on, off, debug] <code>./aes.rb --sbs</code> shows the current setting. <code>./aes.rb --sbs on</code> and <code>./aes.rb --sbs off</code> switch monitoring of Squeezeboxserver on or off, respectively. The command <code>./aes.rb --sbs debug</code> displays diagnostic information  ./aes.rb --interval aes checks regularly if the system can be suspended or shut down. This parameter specifies the time in seconds between two such checks. Normally should be left untouched.  ./aes.rb --showenergybalance View the energy savings in kWh due to the use of Amahi Energy Saver.  ./aes.rb --setpowerconsumption pc_on pc_standby Set the average power consumption when working ("pc_on") and powered off ("pc_standby"). Values given in Watts. pc_on must be greater than pc_standby.  ./aes.rb --help Displays command line help
==Logs==Logs are located in /usr/share/aes and named aes.log*[[Category:Apps]]
12,424

edits