番茄时钟项目介绍:助力时间管理,提升专注力与效率
番茄时钟项目介绍:助力时间管理,提升专注力与效率
番茄时钟是一种基于番茄工作法的时间管理工具,旨在帮助用户通过设定工作时间和休息时间来提高专注力和工作效率。
市面上时间管理方法五花八门,不过真能帮助人集中精力的却非常少。番茄工作法打算借助规定时长的劳作和休憩来攻克效率难题,可是在具体实施阶段,设备与程序方面的难题迫使原先的构想进行了根本性的调整。

设计初衷与硬件选择
这个项目的基本思路是借鉴传统的番茄工作法,具体做法是专注工作25分钟,然后短暂放松5分钟,每进行四次这样的循环就安排一次较长时间的休整。在设备方面,我们挑选了ESP32-C3作为主控芯片,主要是看重它省电和能无线联网的特点,这样将来可以方便地融入家庭智能网络。原定想法是用一块TFT-LCD屏幕,把倒计时、循环模式这类详细内容显示出来,同时搭配一个发声器,用来提示每个环节的进展,目的是制作一个能独立运作、用途广泛的装置。
遭遇的核心技术障碍
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
manual_ip:
static_ip: 192.168.2.151
gateway: 192.168.2.1
subnet: 255.255.255.0
不过,研制期间碰到了一个意料之外的阻碍:LCD屏幕的驱动始终无法完全解决。调试底层驱动程序或者更换不同的显示库,屏幕始终不能稳定显示设计好的界面。这直接造成最重要的视觉反馈功能失效,迫使项目整体方向必须彻底改变。团队不得不认定,在规定时间内解决这个硬件问题的可能性不大。
# 二进制传感器
binary_sensor:
# 拔轮中键
- platform: gpio
pin:
number: GPIO21
mode:
input: true
pullup: true
name: "拔轮中键 ok"
filters:
- delayed_on: 10ms
- delayed_off: 10ms
on_press:
then:
- button.press: start_pause
# BOOT键(结束当前番茄钟)
- platform: gpio
pin:
number: GPIO9
mode:
input: true
pullup: true
name: "BOOT键"
filters:
- delayed_on: 10ms
- delayed_off: 10ms
on_press:
then:
- button.press: pomodoro_finish_btn
氛围灯的状态提示方案
# 氛围灯
light:
- platform: esp32_rmt_led_strip
id: ws2812
name: "WS2812"
rgb_order: GRB
pin: GPIO2
num_leds: 1
rmt_channel: 0
chipset: ws2812
没有显示屏的情况下,需要想个办法清楚显示当前情况。这时候,氛围灯变得特别重要。用电脑控制,让一个能变色的灯珠来表示各种状态,比如亮蓝色是正在工作,亮绿色是短暂休息,亮黄色是长时间休息,亮红色是时间到了。这种不用文字的灯光提示,虽然不能显示太多内容,但能让基本功能正常使用。
与智能家居平台的集成
为了改善本地显示效果,项目借助ESP32-C3的无线网络能力,全面融入本地智能家居系统。设备在内部存储空间里,持续保存番茄计时器的各项信息,比如当前状态、剩余时长等。借助定制的文本感应单元,这些重要信息每秒向系统汇报一次,达成了远程即时状态同步。
# 文本传感器
text_sensor:
# 当前番茄时钟状态
- platform: template
id: pomodoro_state_sersor
name: "番茄时钟 Pomodoro"
lambda: |-
switch(id(pomodoro_state)) {
case 0:
return {"番茄时钟"};
case 1:
return {"短休息"};
case 2:
return {"长休息"};
default:
return {"番茄时钟"};
}
update_interval: 1s
# 当前番茄时钟启动状态
- platform: template
id: pomodoro_start_state_sersor
name: "番茄时钟启动状态 Pomodoro State"
lambda: |-
switch(id(pomodoro_start_state)) {
case 0:
return {"开始"};
case 1:
return {"暂停"};
case 2:
return {"开始"};
default:
return {"停止"};
}
update_interval: 1s
# 当前番茄时钟时间,格式(mm:ss)
- platform: template
id: pomodoro_sersor
name: "番茄时钟时间 Pomodoro Timer"
lambda: |-
char buf[6];
sprintf(buf, "d:d", id(pomodoro_time_seconds) / 60, id(pomodoro_time_seconds) % 60);
return ((std::string) buf);
update_interval: 1s
配置与交互的远程化实现
# 滑动控制组件
number:
# 番茄时钟时长
- platform: template
id: pomodoro_seconds
name: "番茄时钟时长 Pomodoro Duration"
icon: mdi:clock-fast
entity_category: config
optimistic: true
min_value: 1
max_value: 100
restore_value: true
initial_value: 25
step: 1
unit_of_measurement: "分"
# 短休息时长
- platform: template
id: short_break_seconds
name: "短休息时长 Short Break Duration"
icon: mdi:clock-fast
entity_category: config
optimistic: true
min_value: 1
max_value: 20
restore_value: true
initial_value: 5
step: 1
unit_of_measurement: "分"
# 番茄时钟时长
- platform: template
id: long_break_seconds
name: "长休息时长 Long Break Duration"
icon: mdi:clock-fast
entity_category: config
optimistic: true
min_value: 1
max_value: 50
restore_value: true
initial_value: 15
step: 1
unit_of_measurement: "分"
# 氛围灯亮度
- platform: template
id: ws2812_brightness
name: "氛围灯亮度 ws2812 brightness"
entity_category: config
optimistic: true
min_value: 0
max_value: 100
restore_value: true
initial_value: 60
step: 1
unit_of_measurement: "%"
本地显示不现实,配置和高级交互都转到了智能家居系统的操作界面上。控制面板为此增加了专用设置区域,用户能借助网页上的滑动条方便地设置工作时长、休息时间,还能调节氛围灯的光度。启动、暂停、停止等动作都由系统界面上的按键控制,设备本身的物理按键只保留了简单的确认作用。
# 输出
output:
# 蜂鸣器输出
- platform: ledc
pin: GPIO7
id: buzzer
# 蜂鸣器
rtttl:
output: buzzer
id: my_rtttl
gain: 0.6
项目总结与未来展望
这个番茄时钟项目最后变成了一种既不是独立设备也不是智能家居部件的中间形态。它没能达成最初“小体积可移动计时器”的目标,却无意中发现了一条借助当前智能家居环境来增强基础设备用途的门路。它的好处是注重个人隐私,所有信息都在内部网络中传输。往后,也许能加上统计信息的功能,让用户了解自己的集中状态,或者寻找更省电的联络方法。
time:
- platform: homeassistant
on_time:
- seconds: /1
then:
- lambda: |-
if (1 == id(pomodoro_start_state)) {
id(pomodoro_time_seconds) --;
if(0 >= id(pomodoro_time_seconds)) { // 当前番茄时钟执行结束
id(pomodoro_finish_btn).press();
}
}
这个无奈采用的无显示番茄计时器,您觉得它是否化解了困扰,又或者带来了新的问题呢?期待在留言区表达您的见解,倘若对您有所触动,也请给予点个赞。
type: custom:button-card
color_type: icon
entity: sensor.pomodoro_timer_pomodoro
label: |
[[[
return states['sensor.pomodoro_timer_pomodoro_timer'].state;
]]]
show_icon: false
show_state: true
show_name: false
show_label: true
styles:
styles: null
card:
- width: 600px
- height: 400px
label:
- font-size: 200px
- color: white
state:
- justify-self: start
- margin-left: 30px
- font-size: 50px
grid:
- grid-template-areas: '"s i" "l i" "start_stop i"'
- grid-template-rows: min-content 1fr min-content min-content
- grid-template-columns: 1fr
custom_fields:
start_stop:
- color: white
- font-size: 40px
- border: 1px solid white
- border-radius: 10px
- width: 120px
- margin: 0 auto;
state:
- value: 番茄时钟
styles:
card:
- background-color: rgb(186, 73, 73)
state:
- color: white
- value: 短休息
styles:
card:
- background-color: rgb(56, 133, 138)
state:
- color: white
- value: 长休息
styles:
card:
- background-color: rgb(57, 112, 151)
state:
- color: white
custom_fields:
start_stop: |
[[[
return `${states['sensor.pomodoro_timer_pomodoro_state'].state}`
]]]
tap_action:
action: toggle
entity: button.pomodoro_timer_start_pause
