Menu

#32 automatic wakeup by timer .

closed
nobody
None
2018-03-10
2015-09-12
siddartha
No

the DNS-320L has the ability to automatic wake up by timer setting. it's possible to implement this in userspace ?

Discussion

  • João Cardoso

    João Cardoso - 2015-09-14

    The dns-320l support was done by Andreas Böhler, see in particular the "Working So Far" and the "Still Todo" section.

    If you follow his method and devise how to make the RTC wakeup to work I will add that.

     
  • siddartha

    siddartha - 2015-09-24

    Solved:
    install package alt-f/python
    you have to install some other python packages, via pip, required to the following script.
    create /Alt-F/alarm and chdir into it
    git clone https://github.com/martin-vi/dns320_alarm
    change ctl_alarm.py , first line, interpreter is python and not python2
    create the following file in /Alt-F/alarm/set_next

    -------------------- cut here --------------------------

    !/bin/sh

    HERE=/Alt-F/alarm/

    nextmon=$(python -c 'import time; print time.localtime(time.time() + 243600).tm_mon')
    nextday=$(python -c 'import time; print time.localtime(time.time() + 24
    3600).tm_mday')

    hour=18:00

    date >> $HERE/log
    $HERE/dns320_alarm/ctl_alarm.py write -d $nextday -m $nextmon -t 18:00 >> $HERE/log
    -------------------- cut here --------------------------

    change the root crontab with the following:

    0 23 * * /Alt-F/alarm/set_next
    0 1 *
    * shutdown

    i used these settings:
    wakeup at 18:00
    at 1AM the shutdown, at 23:00 set the alarm.

    thanks to the message of Andreas Bohler.

    regards

     
  • João Cardoso

    João Cardoso - 2015-09-25
    • status: open --> accepted
     
  • João Cardoso

    João Cardoso - 2015-09-25

    Thanks for the pointer.
    I will eventually add that feature to the dns320l-daemon, as having to install python just for that purpose is not practical.

     
  • siddartha

    siddartha - 2015-10-17

    I'm started a c project on github.
    https://github.com/dg14/dns320_utils

    for now, it compiles, writes and reads on serial. i've to proceed to update the alarm and develop if needed a socket server.

     
  • João Cardoso

    João Cardoso - 2015-10-20

    The original Andreas Böhler and particularly the modified Alt-F dns320l-daemon already have most things done; only a small amount of wrapping tape and debugging time is needed.

     
  • siddartha

    siddartha - 2015-10-20

    Andreas Bohler told me that he no longer mantains that code (he buyed a better nas).
    on my dns320l, actually i used the python solution and it works, and i try to change creating a solution in c (including all functions of andreas project features).
    regards.

     
  • siddartha

    siddartha - 2017-05-01

    Any news?

     
  • João Cardoso

    João Cardoso - 2018-03-10
    • status: accepted --> closed
     
  • João Cardoso

    João Cardoso - 2018-03-10

    Implemented by svn commits r3819, r3824, r3828

    [root@DNS-320L]# rcpower status
    power:
    Wakeup alarm set to: 2018-03-11 14:30
    Poweroff set to "0 21 * "
    Automatic Power Recovery set
    Wake on Lan NOT set

    [root@DNS-320L]# dns320l-daemon -x help
    Available Commands:

    DeviceReady, DeviceShutdown, ShutdownDaemon, EnablePowerRecovery, DisablePowerRecovery, GetPowerRecoveryState, EnableWOL, DisableWOL, GetWOLState, SetFanStop, SetFanHalf, SetFanFull, PowerLedOn, PowerLedOff, PowerLedBlink, ReadRtc, ReadAlarm, WriteAlarm, EnableAlarm, DisableAlarm, systohc, hctosys, GetTemperature, help, quit.

    [root@DNS-320L]# dns320l-daemon -x readalarm
    Wakeup alarm set to: 2018-03-11 14:30

    [root@DNS-320L]# dns320l-daemon -x writealarm
    ERR WriteAlarm: month day hour min | +N{d|m} (days|month) | now | disable

     

Log in to post a comment.