Skip to content

elecnix/ticktick-scenes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TickTick Scenes

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.

Scenes

These scene identifiers are expected, so make sure yours match:

  • normal when stopping the timer
  • pomodoro_enabled when the timer is running
  • pomodoro_suspended when the timer is paused (including during a break)
  • pomodoro_short_break during a short break
  • pomodoro_long_break during a long break

Configuration

  • 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.

Usage

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

About

Uses ticktick-py and inspired by r/ticktick on Reddit

Future Improvements

  • Configurable scene names
  • Create a Home Assistant integration

About

TickTick Scenes for Home Assistant

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •