This script is used to control Home Assistant scenes while using TickTick Pomodoro Focus Timer.
The status of the pomodoro timer is used to turn on scenes in Home Assistant.
These scene identifiers are expected, so make sure yours match:
normalwhen stopping the timerpomodoro_enabledwhen the timer is runningpomodoro_suspendedwhen the timer is paused (including during a break)pomodoro_short_breakduring a short breakpomodoro_long_breakduring a long break
- Create a file named ~/.PomodoroHomeAssistant with a long-lived access token and the URL to your Home Assistant server:
{
"homeassistant": {
"token": "your-long-lived-token",
"url": "http://your-homeassistant:8123",
},
"ticktick": {
"oauth": {
"id": "",
"secret": ""
},
"username": "",
"password": ""
}
}
To get the OAuth id and secret, follow the instructions in ticktick-py's Register A New TickTick App.
Create environment: conda create -n ticktick-scenes python=3.11
Activate: conda activate ticktick-scenes
Install requirements: pip install -r requirements.txt
Run python pomodoro.py
It will authenticate to TickTick, open a WebSocket to TickTick and listen to messages. Upon receiving start, pause, continue, startBreak, endBreak or exit messages, it communicates with your Home Assistant instance to turn scenes on.
Alternatively, build a Docker container:
docker build -t ticktick-scenes .
docker run -d -v $HOME/.PomodoroHomeAssistant:/root/.PomodoroHomeAssistant ticktick-scenes
Uses ticktick-py and inspired by r/ticktick on Reddit
- Configurable scene names
- Create a Home Assistant integration