Welcome to Raspberry Pi 5 repository
7. Scheduled Tasks
OpenClaw Scheduled Tasks Tutorial
Before starting, please complete [01-Peripheral Hardware Configuration], [02-OpenClaw API-KEY Configuration], [03-OpenClaw Model Switching], [04-AI Voice Interaction Configuration], and [05-Three Dialogue Configuration Tests] in the
Preparation Before Usedirectory. If you are only using TUI/WhatsApp, you can skip04. This article assumes the basic environment is ready and only covers the "automatically execute scripts at fixed time" part.
1. Tutorial Objectives
This article demonstrates how OpenClaw can further upgrade from instant dialogue to automated peripheral applications through "AI-generated scripts + Linux timed execution". After completing this tutorial, readers will be able to:
- Understand the basic implementation approach for OpenClaw scheduled tasks
- Distinguish between scenarios suitable for
HEARTBEATandcronrespectively - Describe automation requirements via WhatsApp, TUI, and voice commands
2. Hardware Preparation
- OpenClaw main control board
- DHT temperature and humidity sensor
- OLED display screen
- RGB light strip / RGB LED module
[Optional] CSI camera[Optional] AI voice module + speaker
Note:
- The core of this tutorial is "timed execution", not requiring all peripherals to be connected at the same time
- If you want to do which type of automation task, just connect the corresponding hardware first
3. Testing Scheduled Task Basic Capabilities
Before starting this project, please complete an openclaw tui basic conversation self-check first; if you haven't done this yet, see [05-Three Dialogue Configuration Tests]. After passing, proceed with the scheduled task-specific test.
It is recommended to test in the following order:
- First enter OpenClaw TUI
- Have OpenClaw generate a simple script
- Manually run the script in the terminal to confirm normal function
- Then write the script to
crontab
Input in terminal:
openclaw tuiIt is recommended to first try these types of requirements:
- Help me write a script that displays current temperature and humidity on OLED and saves to desktop
- Generate a script that reads temperature and humidity and prints results each time it runs
- Write a script that makes RGB light up green for 3 seconds then turns off
After script generation, run it manually first, for example:
xxxxxxxxxxpython3 /home/pi/Desktop/your_script.pyAfter confirming the script itself is usable, then execute:
xxxxxxxxxxcrontab -ecrontab -l4. Three Ways to Communicate with OpenClaw
| Method | Suitable Scenario | Advantages | Suggested Use |
|---|---|---|---|
| Remote automation requirement description | Suitable for first clarifying "what you want to schedule" | Used to generate scripts and confirm requirements | |
| TUI | Local creation and debugging of scheduled tasks | Easiest to coordinate scripts and cron | First choice for implementation solution |
| Voice Code | Voice description of automation scenarios | More like desktop assistant experience | Suitable for demonstrating "generate automation from one sentence" |
If you have the optional AI voice module + speaker, the TUI and WhatsApp conversations need to broadcast OpenClaw's replies. You can run the following program in the terminal. This is not needed for AI voice module conversations.
- Modify the TTS enable parameter
xxxxxxxxxx/home/pi/voice_to_openclaw/.env
xxxxxxxxxxENABLE_TTS=true # This parameter controls whether to broadcast replies. After saving, run the program below in the terminal.- Terminal input
xxxxxxxxxxcd ~/voice_to_openclawsource .venv/bin/activatepython -m src.openclaw_session_tts
4.1 WhatsApp Solution
For WhatsApp integration steps, please refer directly to [05-Three Dialogue Configuration Tests]. This section is more suitable for describing requirements, for example:
- Help me create a scheduled task: make RGB light up red every minute as a reminder, then turn off the light

4.2 TUI Solution
If you have already completed the TUI self-check from chapter 0, directly enter terminal text dialogue:
xxxxxxxxxxopenclaw tuiThen you can directly input project-related commands, for example:
- Help me create a scheduled task: read temperature and humidity every minute and display on OLED

4.3 Voice Code Solution
xxxxxxxxxxRequires optional AI voice interaction module + speaker
For voice module installation, environment configuration, and basic wake-up flow, please refer directly to [04-AI Voice Interaction Configuration]. After waking up, you can directly speak control content, for example:
- Help me create a scheduled task: read temperature and humidity every minute and display on OLED

5. Project Implementation
Note: All demonstrations below use the openclaw tui method for conversation. You can also choose WhatsApp or voice to complete.
5.2 Scenario 1: Hourly Temperature and Humidity Sampling
Experiment Objective
Have the device automatically read temperature and humidity once every hour and record results or sync to the screen.
Effect Description
This is the most basic and common scheduled task scenario, which can continue to be extended into logs, dashboards, environment alerts, or plant care projects.
Example Commands
- Help me create a scheduled task: read temperature and humidity every minute and display on OLED
5.3 Scenario 2: Timed Status Reminder
Experiment Objective
Use RGB or OLED to make a clear reminder at a fixed time.
Effect Description
This type of task is suitable for water drinking reminders, class reminders, inspection reminders, and status switch reminders. It does not emphasize continuous operation but emphasizes triggering a clear action at a certain time point.
Example Commands
- Help me create a scheduled task: make RGB light up red every minute as a reminder, then turn off the light
5.4 Scenario 3: Timed Inspection Script
Experiment Objective
Chain multiple peripheral actions together to form a small automated task that can be executed periodically.
Effect Description
For example, read temperature and humidity once every hour. If the status is abnormal, light up to give a reminder, and display the results on OLED. This type of task is already close to a complete small project, and is also where the combination of "AI-generated scripts" and "timed execution" is most evident.
Example Commands
- Help me create a scheduled task: read temperature and humidity once every minute, light up red if abnormal, and prompt on OLED