elecnix / ticktick-scenes

TickTick Scenes for Home Assistant

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

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


Languages

Language:Python 100.0%