Changes

From Amahi Wiki
Jump to: navigation, search
7,830 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 in alpha solid beta stage. 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. 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.
To do soSo, Amahi Energy Saver regularly scans for connected clientsinstance, you may want to add your client PC and your PS3 to the monitored host list. If no 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 connected, always turned on. With the calendar function one can define scheduled wake ups and periods during which the system suspends after a configurable periodserver 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/).
One can also define scheduled wake ups and periods during which the server shall stay awake no matter what.==Installation==
===One Click installation===
==Download==The easiest way is to install [http://www.amahi.org/apps/amahi-energy-saver Amahi Energy Saver] via the Amahi One Click installation.
===Manual installation - NOT SUPPORTED ANYMORE, BUT MAY STILL WORK===Download the latest tested and released version here: http://code.google.com/p/amahienergysaver/downloads/list
* 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   cd installfiles ./aes-install.sh 4. When the installation is finished, reboot the computer. The config app is accessible at  <nowiki>http://hda:6500</nowiki> ==Integration with Amahi calendar== ===Step-by-step guide===1. In the config app, select ical in the Calendar field. 2. 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]]<codebr>   Press "Next".Choose "iCalendar (ICS)" in the dialog and type "http://calendar/aes.ics" in the Location field. [[Image:AES_Sunbird_2.jpg]]<br>   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]]<br>   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 make sure "Read Only" is deselected. [[Image:AES_Sunbird_5.jpg]]<br>   Finished. Below is an example screenshot with a task defined on 2011-install07-06 2:30-3:00 and another one 4:30-5:30. In the example, the HDA will not go to sleep during these periods, and will wake up if it is suspended. [[Image:AES_Sunbird_6.jpg]]<br>  ==MythTV integration (version 0.8.12 and later)== Before 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. If the recording folder is one of the shares, 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.  ==Let other apps control Amahi Energy Saver (version 0.8.12 and 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. ===Script interface=== Amahi Energy Saver regularly checks the directory /usr/share/aes-lock for scripts and executes them. If any of the scripts returns an errorlevel of 1, the HDA will not be suspended. Both Bash (*.sh) and Ruby (*.rb) are supported. The scripts can be extremely simple. In pseudocode a script looks like this: <pre>if (condition) exit 1else exit 0end</codepreFor a collection of scripts, please see this thread: http://forums.amahi.org/viewtopic.php?f=15&t=3320&p=16486#p16486 ===Lock files=== Amahi Energy Saver regularly checks the directory /usr/share/aes-lock for files with suffix '.lock'. As long as any such file exists, Amahi Energy Saver will not suspend the HDA. This is useful for other applications that support events. One Event may trigger the creation of the lock file, and another one may delete the lock file. E.g., the event that shall cause the HDA to stay awake no matter what can call   touch /usr/share/aes-lock/some.lock When the job is finished, the respective event should call
4. Navigate to <code> rm -f /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<lock/code> to check the monitored hosts and delete the ones you want to removesome.lock
5. As root, run <code>service aes start</code> Make sure to start use individual names for the servicelock files, and <code>chkconfig aes on</code> to make the service start on boot. Be careful, when you start the service the sytem MAY go to sleep when so that you don't expect itaccidentally delete the lock file of another application.
==LogsSelecting ShutdownType==Logs are located in /usr/share/aes and named aes.log.*
The different options for ShutdownType are explained here:<br><br>
==Command Line Interface== Deactivated*Note: Currently root priviledges are required to execute Amahi Energy Saver is running in the CLI command. Navigate to /usr/share/aes to use background, however it will never shutdown or suspend the CLI correctlyHDA.
<code> PoweroffThis is a full shutdown and should work on most systems./aesSome mainboards do not allow scheduled wakeup when using this method.rb --showmonitoredhosts</codebr><br>Show a list of all hosts which are monitored by AES, 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.
<code> ACPI_S1Legacy ACPI S1 state./aes.rb --shownetworkhostsSupport depends on mainboard and Fedora support</codebr><br>Lists the hosts found in the network and gives the user the choice to add them. This is useful to quickly fill the list of monitored hosts.
<code>./aes ACPI_S3Legacy ACPI S3 state.rb --addhost macadress</code>Support depends on mainboard and Fedora support<br>Manually add a host to the list of monitores hosts. 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>
<code> ACPI_S4Legacy ACPI S4 state./aes.rb --showcalendarSupport depends on mainboard and Fedora support</codebr><br>Lists the current calendar entries. Calendar entries define times when the server does not suspend. Also, the server will be woken up at the beginning of a calendar entry.
memSuspend to memory, is intended to replace ACPI S1 but is not widely supported yet<codebr>./aes.rb --addcalendar startdate starttime stopdate stoptime</codebr>  diskSuspend to disk, is intended to replace ACPI S4 but is not widely supported yet<br><br>Use this command standbySuspend to add an entry memory, is intended to replace ACPI S3 but is not widely supported yet<br><br> When selecting the shutdown type the calendarfollowing procedure is suggested:<br><br> * Start with Poweroff to do basic checking and configuration. Format Since this is the safest version, it should also be your resort in case of startdate/stopdate: YYYY-MM-DD Format problems.<br><br> * Once things are working, select either of starttime/stoptime: hhm:mmthe ACPI_S1. Eg. 3 depending on what level of suspend you want<br><codebr* If you are brave or the ACPI options don't work, try mem, disk or standby./aes.rb --addcalendar 2010-12-20 15:00 2010-12-20 16:00</codebr> <br>will keep ==Logs and LogAnalyzer==Depending on the server awake on Dec 20thversion installed the logs are located in /usr/share/aes or /var/hda/web-apps/html/aes/lib.  * From version 0.8.12 onwards, 2010 from 15 the log files have been moved to 16 hrs (3 to 4 pm). The server will also wake up at 15 hrs if it is suspended/var/log.
<code>./In any case the files are named named aes.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 that your machine is suspending and coming up correctly before deciding for a setting. Poweroff is safest type.log*
<code>In order to view the Amahi Energy Saver logs in the LogAnalyzer (ref.http:/aes.rb --sbs [on|off|debug]</code><br><code>www./aesamahi.rb --sbs<org/code> shows the current setting of aes. <code>.apps/aes.rb --sbs loganalyzer) navigate on</code> your LogAnalyzer homepage to "Admin Center" then "Sources" and <code>finally klick "Add new Source"./aes.rb --sbs off</code> switch monitoring of Squeezeboxserver on or offConfigure the new source for the Energy Saver logs as shown in the screenshot below (note that the directory may have to be adjusted, respectively. The command <code>./aes.rb --sbs debug</code> displays diagnostic informationsee above):
<code>[[File:LogAnalyzer_Config_for_Amahi_Energy_Safer./aes.rb --help</code><br>png]]Displays command line help
==Windows clientfor Wake on LAN==
On the download page there is a Windows client for automatic or manual wakeup of the HDA.
2. Right click on the icon that will appear in symbol bar, and select "Show config"
3. To get started, make sure that you set "Host MAC" and "Host name" to your HDA configuration. Set port if requiredHit "Select Server" to bring up the "Select HDA" window, and then "Search". If possible the default correct server is alreday selected, in that case just hit "9Ok" should work in most casesto confirm. Continue with 4.<br><br>If the server appears on the list but is not automatically selected, click on it and hit return. Set <br><br>Should your server not show up at all, press "Subnet LANCancel" to your subnetexit the "Select HDA" dialog and configure MAC and host name manually.<br><br>Finally, if requried, change the "Port" setting. The default value "9" should work if you network is configured as 192.168.0in most cases.0/24<br><br>
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  [[Category:Apps]]
12,424

edits