2

So I want to open my computer without touching when it is off. I mean I will select hour like 7:00 AM and run my script. Without touching my computer I want it to open itself at 7:00 AM. Is there a way to make this. Thanks for everyone.

Synxloar
  • 49
  • 5

4 Answers4

7

Off-off, or suspended?

If your computer is really off (following a shut=down), you are going to need a second computer to push the on-button for you. A raspberryPi can be placed inside your computer case and execute a python script which uses the GPIO pins to close the "on button" circuit in the tower.

IF the computer is supsended and you want to wake it up, it cannot be done with Python, but it can be done using bios. read the top 3 answers here: https://askubuntu.com/questions/83685/scheduling-startup-and-shutdown

Community
  • 1
  • 1
4

You can use the BIOS alarm to wake up your computer. You set an alarm time and it will turn your computer on.

This might be set by a program running in the computer before turn it off, look these: APIs for querying and setting bios properties https://software.intel.com/en-us/forums/intel-business-client-software-development/topic/297999


If you are using Linux, your python code must run before turn the computer off (of course) and set BIOS Alarm (rtc) as shown: https://askubuntu.com/questions/47745/automatically-start-at-specific-time-like-bios/47853

Mani
  • 21
  • 12
JrBenito
  • 872
  • 7
  • 24
1

It's not really possible.

If you computer is turned off (physically) its simply off - nothing is running and so your script - or another application - cannot be executed on the target system. A way to achive something like what you want is using Wake-on-LAN, but to use this you need another computer to send the Magic Paket.

falx
  • 149
  • 3
  • 13
1

Yes. There is a possibility: You could use Wake on ring. It is a function provided by BIOS or the OS. It is also called 'Real-time clock alarm' or 'RTC alarm'. You have to enable this in the BIOS/UEFI configuration.

With RTC alarm, you can wake up your computer from a deep sleep state/power saving state at a predetermined time. It is also called ACPI wakeup and is part of the ACPI specification relating to Power States

Under Linux, you can acquire some details of the configuration with the following command (followed by its output, from my current machine, and adjusted for proper formatting):

$ cat /proc/driver/rtc

rtc_time                : 21:53:46
rtc_date                : 2016-05-10
alrm_time               : 03:01:19
alrm_date               : 2016-05-05
alarm_IRQ               : no
alrm_pending            : no
update IRQ enabled      : no
periodic IRQ enabled    : no
periodic IRQ frequency  : 1024
max user IRQ frequency  : 64
24hr                    : yes
periodic_IRQ            : no
update_IRQ              : no
HPET_emulated           : yes
BCD                     : yes
DST_enable              : no
periodic_freq           : 1024
batt_status             : okay

The state of the ACPI alarm events can be acquired with

$ cat /proc/acpi/wakeup 

Device  S-state   Status   Sysfs node
PCE2      S4    *disabled  pci:0000:00:02.0
PCE3      S4    *disabled
PCE4      S4    *disabled  pci:0000:00:04.0
PCE5      S4    *disabled
PCE7      S4    *disabled
PCE9      S4    *disabled  pci:0000:00:09.0
PCEA      S4    *disabled  pci:0000:00:0a.0
PCEB      S4    *disabled
PCEC      S4    *disabled
SBAZ      S4    *disabled  pci:0000:00:14.2
PS2K      S3    *enabled   pnp:00:08
P0PC      S4    *disabled  pci:0000:00:14.4
UHC1      S4    *enabled   pci:0000:00:12.0
UHC2      S4    *enabled   pci:0000:00:12.1
UHC3      S4    *enabled   pci:0000:00:12.2
USB4      S4    *enabled   pci:0000:00:13.0
UHC5      S4    *enabled   pci:0000:00:13.1
UHC6      S4    *enabled   pci:0000:00:13.2
UHC7      S4    *enabled   pci:0000:00:14.5
PCE6      S4    *disabled
PWRB      S3    *enabled 

Over at MythTV you find an example of how to use RTC alarm under Linux.

Hope this shines some light on this topic.

zx485
  • 24,099
  • 26
  • 45
  • 52