Changes

From Amahi Wiki
Jump to: navigation, search
8,060 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 is connectedPC and/or PS3 are up and running. However, you might not want to add your home router to the list, as the system suspends after a configurable periodrouter is always turned on.
With the calendar function one can define scheduled wake ups and periods during which the server shall stay awake no matter what. Amahi Energy Saver also scans checks shares. As long as shares are accessed, the server does not suspendssuspend. If set up to do so, Squeezeboxserver is monitored to prevent suspend while Sqeezeboxes 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 <code>  cd installfiles ./aes-install.sh 4. When the installation is finished, reboot the computer. The config app is accessible at  <nowiki>http://hda:6500</codenowiki> ==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]]<br>   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>  
4Press "Next" then "Finish". As root, run <code>service aes start</code> You will notice an exclamation mark next to start the service, and <code>chkconfig --add aes calendar on</code> to make the service start on boot. Be careful, when you start the service the sytem MAY go to sleep when you don't expect itright tab.
5[[Image:AES_Sunbird_4. Navigate to jpg]]<codebr>/usr/bin/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 remove.
==Logs==
Logs are located in /usr/share/aes and named aes.log.*
Right click the calendar, select "Properties" and make sure "Read Only" is deselected.
==Command Line Interface==*Note[[Image: Currently, you need to be root and navigate to /usr/share/aes to use the CLI correctlyAES_Sunbird_5.jpg]]<br>
<code>./aes.rb --showmonitoredhosts</code>
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>./aes.rb --shownetworkhosts</code>
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>Finished./aes.rb Below is an example screenshot with a task defined on 2011-07-addhost macadress</code>Manually add a host to the list of monitores hosts. Observe the MAC address format, which has to be XX06 2:XX30-3:XX00 and another one 4:XX:XX30-5:XX30. Example In the example, the HDA will not go to sleep during these periods, and will wake up if it is 12:34:56:78:90:absuspended.
<code>./aes[[Image:AES_Sunbird_6.rb --showcalendarjpg]]</codebr>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.
<code>./aes.rb --addcalendar startdate starttime stopdate stoptime</code>
Use this command to add an entry to the calendar. Format of stardate/stopdate: YYYY-MM-DD Format of starttime/stoptime: hhm:mm. Eg. amahienergysaver --addcalendar 2010-12-20 15:00 2010-12-20 16:00 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.
==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: <codepre>if (condition) exit 1else exit 0end</preFor 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.rb 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  rm -f /usr/share/aes-shutdowntype<lock/code>some.lock Show and modifiy Make sure to use individual names for the lock files, so that you don't accidentally delete the type lock file of shutdownanother application. NOTE ==Selecting ShutdownType== The different options for ShutdownType are explained here: Not all <br><br>  DeactivatedAmahi Energy Saver is running in the background, however it will never shutdown types may be supported on your system, or may suspend the HDA.  PoweroffThis is a full shutdown and should work correctlyon most systems. Some mainboards do not allow scheduled wakeup when using this method.<br><br>  ACPI_S1Legacy ACPI S1 state. Support depends on mainboard and Fedora support<br><br>  ACPI_S3Legacy ACPI S3 state. Support depends on mainboard and Fedora support<br><br>  ACPI_S4Legacy ACPI S4 state. ThereforeSupport depends on mainboard and Fedora support<br><br>  memSuspend to memory, test that your machine is suspending intended to replace ACPI S1 but is not widely supported yet<br><br>  diskSuspend to disk, is intended to replace ACPI S4 but is not widely supported yet<br><br>  standbySuspend to memory, is intended to replace ACPI S3 but is not widely supported yet<br><br> When selecting the shutdown type the following procedure is suggested:<br><br> * Start with Poweroff to do basic checking and coming up correctly before deciding for a settingconfiguration. Poweroff Since this is the safest typeversion, it should also be your resort in case of problems.<br><br> * Once things are working, select either of the ACPI_S1..3 depending on what level of suspend you want<br><br> * 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*
<code>In order to view the Amahi Energy Saver logs in the LogAnalyzer (ref.http://aeswww.amahi.rb --sbs [on|off|debug]<org/apps/code>--sbs alone shows the current setting of aes. The parameters loganalyzer) navigate on your LogAnalyzer homepage to "Admin Center" then "Sources" and of switch monitoring of Squeezeboxserver on or offfinally 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, respectively. The debug option displays diagnostic informationsee above):
<code>[[File:LogAnalyzer_Config_for_Amahi_Energy_Safer./aes.rb --help</code>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 Hit "Select Server" to bring up the "Select HDA" window, and then "Search". If possible the correct server is alreday selected, in that case just hit "Ok" to confirm. Continue with 4.<br><br>If the server appears on the list but is not automatically selected, click on it and hit return.<br><br>Should your server not show up at all, press "Cancel" to exit the "Select HDA" dialog and configure MAC and host name manually.<br><br>Finally, if requiredrequried, change the "Port" setting. The default "9" should work in mos most cases. Set <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 double clicking on the icon in the symbol bar and select "Wake now"Subnet   ==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 subnetMac 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 default value should 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 you network is configured as 192the 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.168  .0/aes.rb --help Displays command line help
4. Hit the "OK" butten, then right click on the symbol again and restart the program according to 1.
5. Done! You should now be able to start your HDA by right clicking on the icon in the symbol bar and select "Wake now"[[Category:Apps]]
12,424

edits