Hue Scheduler — A Flexible Alternative to Adaptive Lighting

Hi everyone,

I’m excited to share with you my small open-source project, Hue Scheduler. I’ve been using it with the Philips Hue API for the past couple of years to control the light schedules in my home, and I’m thrilled to announce that it now also supports the Home Assistant REST API! :tada:

Here is an example of what you can do with it:

# Living Room
light.living_room  sunrise      bri:80%    ct:6000         tr:10s
light.living_room  sunrise+60   bri:100%   ct:5000         interpolate:true
light.living_room  sunset       bri:60%    ct:3000         tr-before:golden_hour-20
light.living_room  23:00        bri:40%    color:#FE275D   tr-before:1h

# Porch Light: Control power state
Porch Light  civil_dusk   on:true    bri:100%   tr:1min
Porch Light  23:00        on:false              tr:5min

# Motion Sensor: Inactive at night on weekdays
switch.sensor_hallway_activated   08:00   on:true
switch.sensor_hallway_activated   22:00   on:false   days:Mo-Fr

Currently supported entity types: light, input_boolean, switch, fan.

Key Features

  • Easy-to-use Text-Based Configuration
  • Control All Your Lights’ Properties: Hue Scheduler allows full control over brightness, color temperature, specific colors, power state, and advanced interpolations between states.
  • Solar-based Schedules: Use 12 different solar time constants, adjustable via offsets, to create dynamic schedules (e.g., civil_dawn+30, sunrise, noon, sunset-20, civil_dusk).
  • Custom Transitions: You decide for each state if you want to perform interpolations and for how long, allowing you to fine-tune your light transitions.
  • Support for Dumb Wall Switches: Hue Scheduler adjusts lights immediately after they become reachable, ensuring consistent lighting even when they have been physically turned off.
  • Standalone Application: Runs independently, interacting with Home Assistant or Philips Hue bridges via their REST APIs.

Quick Start

You can run Hue Scheduler via Docker or manually with Java. Here’s how using Docker:

  1. Create a docker-compose.yml template:

    services:
      hue-scheduler:
        container_name: hue-scheduler
        image: stefanvictora/hue-scheduler:0.10
        environment:
          - API_HOST=
          - ACCESS_TOKEN=
          - LAT=
          - LONG=
          - ELEVATION=
          - TZ=
          - CONFIG_FILE=/config/input.txt # do not edit
        volumes:
          - type: bind
            source: # <- Insert your config file path
            target: /config/input.txt
            read_only: true
        restart: unless-stopped
    
  2. Provide the required parameters:

    • API_HOST: e.g., http://ha.local:8123, or https://UNIQUE_ID.ui.nabu.casa (untested)
    • ACCESS_TOKEN: A long lived access token.
    • LAT, LONG & ELEVATION: Location details to calculate local solar times.
    • TZ: Your time zone
    • SOURCE: Path to the configuration file containing the light schedules.
  3. Run Docker Compose command:

    # Create and run container:
    docker compose up -d
    
    # To stop and remove the container:
    docker compose down
    

Head over to GitHub for more examples and the full documentation.

I’m still new to Home Assistant, but I hope you find Hue Scheduler as helpful for managing your light schedules as I have in my own home. I’m always open for any feedback or ideas for improvement! Feel free to reach out here or on GitHub.

Happy scheduling!

1 Like