Cool stuff for Raspberry Pi, Arduino and all electronics hobby projects
Notifications
Clear all

[Solved / Archived] whittyPi schedule not working as it should do

2 Posts
2 Users
0 Likes
232 Views
(@dominic)
Posts: 1
New Member
Topic starter
 

Hi

I have Witty Pi 4.  I am having some difficulty using the script to set a schedule on it.  When ever I run the wittypi.sh script then select the option to chose a schedule I get the same scheduled shutdown and start up.  It does not seem to matter what is in the .wpi schedule file I send I always get the same response.  Manually changing the schedule time using the wittyPi.sh script does appear to work.

I have attached the log file so you can see.  It does appear to write the data to the schedule.wpi file successfully but not then use this to schedule start up correctly.

Section of log file is copied below.

<2024-08-08 14:35:42> Copying "on_2m_every_3m.wpi" to "schedule.wpi"...
<2024-08-08 14:35:42> Running the script...
<2024-08-08 14:35:43> Schedule next shutdown at: 2024-08-09 01:19:55
<2024-08-08 14:35:43> Schedule next startup at: 2024-08-10 00:09:55
<2024-08-08 14:35:43> Done 🙂
<2024-08-08 14:44:19> Seting shutdown time to "08 15:00:00"
<2024-08-08 14:44:19> Done 🙂
<2024-08-08 14:44:44> Seting startup time to "08 15:10:00"
<2024-08-08 14:44:44> Done 🙂
[xxxx-xx-xx xx:xx:xx] Witty Pi daemon (v4.21) is started.
[xxxx-xx-xx xx:xx:xx] System: Raspbian GNU/Linux 10 (buster), Kernel: Linux 5.10.103-v7l+, Architecture: armhf
[xxxx-xx-xx xx:xx:xx] Running on Raspberry Pi 4 Model B Rev 1.5
[xxxx-xx-xx xx:xx:xx] RTC offset register has value 0x77
[xxxx-xx-xx xx:xx:xx] Seems RTC has good time, write RTC time into system
[xxxx-xx-xx xx:xx:xx] Writing RTC time to system...
[2024-08-08 15:10:37] Done 🙂
[2024-08-08 15:10:37] Firmware ID: 0x26
[2024-08-08 15:10:37] Firmware Revison: 0x06
[2024-08-08 15:10:37] Current Vout=5.32V, Iout=0.53A
[2024-08-08 15:10:37] System starts up because scheduled startup is due.
[2024-08-08 15:14:50] Copying "turn_on_every_hour.wpi" to "schedule.wpi"...
[2024-08-08 15:14:51] Running the script...
[2024-08-08 15:14:51] Schedule next shutdown at: 2024-08-09 01:19:55
[2024-08-08 15:14:51] Schedule next startup at: 2024-08-10 00:09:55
[2024-08-08 15:14:51] Done 🙂

 

An example of the schedule file is below.

# Turn on Raspberry Pi for 1 hour, in every 2 days

BEGIN 2022-06-01 00:09:55
END 2035-07-31 23:59:59
ON H1 M10 # keep ON state for 1 hour
OFF H22 M50 # keep OFF state for 1 day and 23 hours

 
Posted : 08/08/2024 4:33 pm
(@admin)
Posts: 479
Member Admin
 

The behavior you mentioned is expected. This is called "shifting ON state", please read page 19 on the user manual to understand how it works.

Although the comments in your schedule script says it turns on Pi for 1 hour in every 2 days, the actual code in that schedule script is actually turning on Pi for 1 hour 10 minutes within 24 hours.

Once you defined the BEGIN time, and the durations for ON and OFF states, the whole planning has been defined, as below:

......

OFF -> 2024-08-08 01:19:55
ON  -> 2024-08-09 00:09:55

OFF -> 2024-08-09 01:19:55
ON  -> 2024-08-10 00:09:55

......

When you run the schedule script, the software knows your Pi is currently ON. If at the current moment your Pi is suppose to be OFF, the software will shift to next avaialble ON state and schedule the shutdown and startup accordingly.

In your case, for both times it shifts to ON state starting from "2024-08-09 00:09:55", and hence the incoming shutdown and startups are the same. This will change when the current time exceeds 2024-08-09 01:19:55.

 

 

 

 
Posted : 09/08/2024 9:51 am
Join Waitlist We will inform you when the product arrives in stock. Please leave your valid email address below.