Difference between revisions of "Amahi Energy Saver"
Line 29: | Line 29: | ||
==Initial setup== | ==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|Code= | ||
+ | tar -zxf filename | ||
+ | }} | ||
2. Open a terminal, change to that folder and get superuser rights by running <code>su</code> | 2. Open a terminal, change to that folder and get superuser rights by running <code>su</code> | ||
− | 3. As root, run | + | 3. As root, run |
+ | {{Code|Code= | ||
+ | ./aes-install.sh | ||
+ | }} | ||
− | 4. Navigate to | + | 4. Navigate to |
+ | {{Code|Code= | ||
+ | cd /usr/share/aes | ||
+ | }} | ||
+ | and run | ||
+ | {{Code|Code= | ||
+ | ./aes.rb --shownetworkhosts | ||
+ | }} | ||
+ | to show and select to add any currently active network host to the list of monitored hosts. Run | ||
+ | {{Code|Code= | ||
+ | ./aes.rb --showmonitoredhosts | ||
+ | }} | ||
+ | to check the monitored hosts and delete the ones you want to remove. | ||
− | 5. As root, run | + | 5. As root, run |
+ | {{Code|Code= | ||
+ | service aes start | ||
+ | }} | ||
+ | to start the service. Be careful, when you start the service the sytem MAY go to sleep when you don't expect it. Once it works as you want it, run | ||
+ | {{Code|Code= | ||
+ | chkconfig aes on | ||
+ | }} | ||
+ | to make the service start on boot. | ||
Line 43: | Line 70: | ||
1. Open a terminal on your hda. | 1. Open a terminal on your hda. | ||
− | 2. Type | + | 2. Type |
+ | {{Code|Code= | ||
+ | su | ||
+ | }} | ||
+ | and provide your root password | ||
− | 3. Type | + | 3. Type |
+ | {{Code|Code= | ||
+ | cd /usr/share/aes | ||
+ | }} | ||
− | 4. Type | + | 4. Type |
+ | {{Code|Code= | ||
+ | ./aes --calendar ical | ||
+ | }} | ||
− | 4b. To be sure, restart the service by typing | + | 4b. To be sure, restart the service by typing |
+ | {{Code|Code= | ||
+ | service aes restart | ||
+ | }} | ||
5. Only required for 0.3.6 and below: Open your HDA dashboard and go to "Settings" -> "Calendars". | 5. Only required for 0.3.6 and below: Open your HDA dashboard and go to "Settings" -> "Calendars". | ||
Line 67: | Line 107: | ||
*Note: Currently root privileges are required to execute the CLI command. Navigate to /usr/share/aes to use the CLI correctly. | *Note: Currently root privileges are required to execute the CLI command. Navigate to /usr/share/aes to use the CLI correctly. | ||
− | + | {{Code|Code= | |
+ | ./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. | 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. | ||
− | + | {{Code|Code= | |
+ | ./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. | 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. | ||
− | + | {{Code|Code= | |
+ | ./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> | 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> | ||
− | + | {{Code|Code= | |
+ | ./aes.rb --calendar [off, internal, ical, debug] | ||
+ | }} | ||
<code>./aes.rb --calendar</code> shows the current setting. | <code>./aes.rb --calendar</code> shows the current setting. | ||
− | <code>./aes.rb --calendar off</code> turns the calendar off, <code>./aes.rb --calendar | + | <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> | ||
− | + | {{Code|Code= | |
− | 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. | + | ./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. | ||
− | + | {{Code|Code= | |
+ | ./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. | 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> | <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. | 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. | ||
− | + | {{Code|Code= | |
+ | ./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. | 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. | ||
− | + | {{Code|Code= | |
+ | ./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 | <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 | ||
− | + | {{Code|Code= | |
+ | ./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 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. | ||
− | + | {{Code|Code= | |
+ | ./aes.rb --help | ||
+ | }} | ||
Displays command line help | Displays command line help | ||
Revision as of 19:11, 23 February 2011
Contents
General
This project is approaching beta. 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 public. So, please test and report your experience!
Introduction
Running servers when they are not needed can waste a considerable amount of energy. This project aims at sending Amahi server to suspend or poweroff when 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 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/).
Download
Download the latest tested and released version here: http://code.google.com/p/amahienergysaver/downloads/list
Latest untested sources are available at Git: https://github.com/jayrockk/Amahi-Energy-Saver
Initial setup
1. Copy the tar.gz file from the download page to some folder and unpack it with
bash code |
---|
tar -zxf filename
|
2. Open a terminal, change to that folder and get superuser rights by running su
3. As root, run
bash code |
---|
./aes-install.sh
|
4. Navigate to
bash code |
---|
cd /usr/share/aes
|
and run
bash code |
---|
./aes.rb --shownetworkhosts
|
to show and select to add any currently active network host to the list of monitored hosts. Run
bash code |
---|
./aes.rb --showmonitoredhosts
|
to check the monitored hosts and delete the ones you want to remove.
5. As root, run
bash code |
---|
service aes start
|
to start the service. Be careful, when you start the service the sytem MAY go to sleep when you don't expect it. Once it works as you want it, run
bash code |
---|
chkconfig aes on
|
to make the service start on boot.
Integration with Amahi calendar
1. Open a terminal on your hda.
2. Type
bash code |
---|
su
|
and provide your root password
3. Type
bash code |
---|
cd /usr/share/aes
|
4. Type
bash code |
---|
./aes --calendar ical
|
4b. To be sure, restart the service by typing
bash code |
---|
service aes restart
|
5. Only required for 0.3.6 and below: Open your HDA dashboard and go to "Settings" -> "Calendars".
6. Only required for 0.3.6 and below: Add a new calendar named aes
7. Connect your client to the new calendar. NOTE: Please read this article if you are unsure how to do this: Calendars
8. 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.
Command Line Interface
- Note: Currently root privileges are required to execute the CLI command. Navigate to /usr/share/aes to use the CLI correctly.
bash code |
---|
./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.
bash code |
---|
./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.
bash code |
---|
./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
./aes.rb --addhost 12:34:56:78:90:ab
bash code |
---|
./aes.rb --calendar [off, internal, ical, debug]
|
./aes.rb --calendar
shows the current setting.
./aes.rb --calendar off
turns the calendar off,
./aes.rb --calendar internal
makes aes use its internal calendar function and
./aes.rb --calendar ical
activates the Amahi calendar integration. To show diag information use ./aes.rb --calendar debug
bash 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.
bash code |
---|
./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.
./aes.rb --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.
bash code |
---|
./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.
bash code |
---|
./aes.rb --sbs [on, off, debug]
|
./aes.rb --sbs
shows the current setting. ./aes.rb --sbs on
and ./aes.rb --sbs off
switch monitoring of Squeezeboxserver on or off, respectively. The command ./aes.rb --sbs debug
displays diagnostic information
bash code |
---|
./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.
bash code |
---|
./aes.rb --help
|
Displays command line help
Selecting ShutdownType
The different options for ShutdownType are explained here:
Poweroff
This is a full shutdown and should work on most systems. Some mainboards do not allow scheduled wakeup when using this method.
ACPI_S1
Legacy ACPI S1 state. Support depends on mainboard and Fedora support
ACPI_S3
Legacy ACPI S3 state. Support depends on mainboard and Fedora support
ACPI_S4
Legacy ACPI S4 state. Support depends on mainboard and Fedora support
mem
Suspend to memory, is intended to replace ACPI S1 but is not widely supported yet
disk
Suspend to disk, is intended to replace ACPI S4 but is not widely supported yet
standby
Suspend to memory, is intended to replace ACPI S3 but is not widely supported yet
When selecting the shutdown type the following procedure is suggested:
- Start with Poweroff to do basic checking and configuration. Since this is the safest version, it should also be your resort in case of problems.
- Once things are working, select either of the ACPI_S1..3 depending on what level of suspend you want
- If you are brave or the ACPI options don't work, try mem, disk or standby.
Windows client
On the download page there is a Windows client for automatic or manual wakeup of the HDA.
- Installation
Just run the msi file found on the download page. The client will be included in the startup folder.
- Configuration
1. Form the start menu, run AmahiEnergySaver -> AES Client
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. 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.
If the server appears on the list but is not automatically selected, click on it and hit return.
Should your server not show up at all, press "Cancel" to exit the "Select HDA" dialog and configure MAC and host name manually.
Finally, if requried, change the "Port" setting. The default "9" should work in most cases.
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 clicking on the icon in the symbol bar and select "Wake now"
Logs
Logs are located in /usr/share/aes and named aes.log*