Skip to content

Schedule scenes to be turned on after flipping a light switch ✨💡

Notifications You must be signed in to change notification settings

simonwep/hue-scheduler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


⏱️ Better Philips Hue Automation 🪄

CI Status

Summary

Philips hue automations have one large disadvantage - if the light isn't reachable when the automation is supposed to run, it never does. This app checks every time a light is reachable again, if it corresponds to a scene and sets this scene. Open an issue if you find anything missing :)

What's even better is, that you can keep using your physical switches without replacing them!

Installation

Currently, the only way to install this app is to clone this repository and build it on the platform of your choice. Pre-compiled binaries are planned, but not prioritized since platforms may vary heavily.

  1. Download the rust compiler.
  2. Clone this repo via git clone https://github.com/simonwep/hue-scheduler.
  3. Copy .env.example to .env and fill out missing values.
  4. Run cargo build --release.
  5. You can now execute /target/release/hue-scheduler as you want, a service is recommended. Make sure to specify the working directory where your .env lies.

Tip

After installation and setup (e.g. the app is running) nothing needs to be done anymore.
Anything else is configured in your Philips Hue app!

Installing as system service

You will probably want to run this as a service in the background, for this you could use .service file like this (assuming you downloaded and compiled the source under /home/ubuntu/hue-scheduler):

[Unit]
Description=Philips hue automation
After=network.target

[Service]
ExecStart=/home/ubuntu/hue-scheduler/target/release/hue-scheduler
WorkingDirectory=/home/ubuntu/hue-scheduler
User=ubuntu
Restart=always

[Install]
WantedBy=multi-user.target

You can then start the service via:

sudo systemctl enable hue-scheduler

And to make it automatically start on reboot:

sudo systemctl enable hue-scheduler

Usage

When which scene should be turned on is solely specified by the name of your scenes. The format is as follows: {name of your scene} ({timestamp}-{timestamp}, ...), where {timestamp} can be:

  • In the 24h format: 12h, 13:45h, 0h, 9:20h
  • In the 12h format: 3AM, 8PM, 11PM
  • A variable: sunrise, sunset (depending on HOME_LATITUDE and HOME_LONGITUDE in your .env)

Examples

Example scene names with time-frames:

  • Natural light (8AM-10:30h, 17h-sunset) - The "Natural light" scene should be turned on from 8:00 AM to 10:30 AM and from 5:00 PM until sunset.
  • Night light (sunset-11PM) - The "Night light" scene should be turned on from sunset until 11:00 PM.
  • Wake up (sunrise-8:30h) - The "Wake up" scene should be turned on from sunrise until 8:30 AM.
  • Work (8:30h-17h) - The "Work" scene should be turned on from 8:30 AM until 5:00 PM.
  • Sleep (11PM-8AM) - The "Sleep" scene should be turned on from 11:00 PM until 8:00 AM.

Working with "always-on" lights

Some lights may always be reachable and should be turned on when a scene is activated due to another light that is controlled by a physical switch. To mark a light to be turned on/off as well whenever the corresponding scene is activated/deactivated, prepend a (att) for "attached" to the lights name.

Now, if you flip the physical switch and the light is turned off the lights that are always "on" (connected to a power source) will be turned off as well. Since it takes some time for the hue bridge to recognize no longer reachable lights this may take up to a minute. Still better than doing it manually ;)

Screenshots

This is how it will usually look like in the app. A scene will be picked up and turned on if all corresponding lights became (e.g. were not) reachable again. The timeframe for that (and much more) can be configured in the .env file.

Screenshot Screenshot Screenshot