Giter Club home page Giter Club logo

hue-scheduler's Introduction


⏱️ 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

hue-scheduler's People

Contributors

simonwep avatar

Watchers

 avatar  avatar

Forkers

simondump

hue-scheduler's Issues

Phases of a day like sunrise and sunset

It'd be nice to support these variadic times: Sunrise, Sunset and Daytime (when the sun has fully set / risen). E.g:

  • My Schedule (Sunrise-14h)
  • My Schedule (Sunrise-Sunset)
  • My Schedule (Sunset-00h)

Improve behavior with multi-light scenes

Right now the algorithm checks every N seconds if all lights from a scene changed from unreachable to reachable. If N=2 the bridge will have at best 2 seconds to propagate the changes form each light. This can lead to issues with scenes with many lights as it may take longer than 2 seconds for each light to be connected again.

This can be fixed by waiting until all lights from a scene transitioned from an unreachable to a reachable state within a given timeout.

Allow both 12h and 24h clocks

Right now it is only possible to specify the time using the 24h format, it'd be nice to be able to specify it using the 12-hour format as well:

  • My schedule (1:30PM-3PM)
  • My schedule (10AM-1PM)

Add timezone to config

Right now the systems timezone is used all the time, which might not be what you want.

Multiple schedules per scene

It'd be nice to be able to specify multiple schedules for a single scene:

  • My schedule (13:30h-15h, 18h-20h)
  • My schedule (8h-12h, 13h-15h, 17h-23h)

Weekdays and ranges

It'd be nice to specify at which days of the week a schedule should be active, e.g.

  • My schedule (13:30-15h Mo-Fr)
  • My schedule (13:30-15h Mo-Fr, Sa)
  • My schedule (13:30-15h Mo,Tue,Mi)
  • My schedule (13:30-15h Mo-We,Thu-Sa)

Improve time range prioritisation

Right now it is possible to define time-ranges like 12h-6h which would mean that the scene is active from 12h until 6h on the next day. We need to define what happens if we now have a range 13h-4h that is inside another one.

Allow connecting lights not controlled by the switch

In some cases you'll have some lights in the room connected to light switches and some not. It'd be nice to be able to tell the app that 2 of 3 lights are enough for it to active a scene, e.g. ignore a light when processing them.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.