Skip to content

Control your Philips Hue lights through a floor map.

License

Notifications You must be signed in to change notification settings

mnorlin/homecontrol

Repository files navigation

Home Control

Set up a dashboard to control your Philips Hue lights using an old tablet or phone. You get a simple weather forecast, scheduled light warmth, and you can control your lights through a floor map.

This application runs as a standalone website in a browser, no need for any installation or deployment (if you don't want to), as long as you have a device that can view local .html files.

A demo of the application can be found at https://mnorlin.github.io/homecontrol/.

Features:

  • Generate a floor map from coordinates.
    • Get instant overview of which rooms have lights on.
    • Click on a room to toggle all its lights.
  • Weather forecast from OpenWeatherMap.
  • Scheduling of light temperature throughout the day.
    • Set the scheduled time for 5 different light temperatures, from energizing blue light, to relaxed red light.
    • Even if the lights are turned off, the light temperature will apply when you turn them on.
    • The current light temperature even applies if you turn on the lights in another app.
  • Get the current temperature from Philips hue sensors.
  • Get an estimate of the current power consumption of the lights.
  • Turn individual lights on or off.

How to run

The easiest way is to download the latest release on your computer. You can then just open index.html in your browser.

Build your own release

Start by cloning the repository

git clone https://github.com/mnorlin/homecontrol.git

Edit src/default-settings.json and modify to match your local configuration (You can just replace the file content with the exported setting file from the application).

Then execute npm install and then npm run build, when finished, you can open up ./release/index.html in your browser.

Run as an npm development server

npm install

npm start

The app is now available at http://localhost:3000.

To reset to default settings, add ?reset=true to the url, eg. http://localhost:3000?reset=true.

To view settings and incoming data, add ?debug=true to the url, eg. http://localhost:3000?debug=true.

Run as a docker container

docker-compose build

docker-compose up -d

The web application is now available at http://localhost.

Generate a floor map

Floor plan

The floor plan for each room can be configured in the settings. It is generated by an array of objects with x- and y-coordinates representing points on the browser Canvas API. On the canvas, {"x": 0, "y": 0} is in the upper left corner. A line is drawn between each coordinate in the array. If you want to make space for a door in a room, you can add the property "transparent": true, and the line drawn to that coordinate will be transparent. See example code below, which was used for generating the rooms used in the screenshot above.

Room 1

Canvas room 1

[
  { "x": 0, "y": 0 },
  { "x": 8, "y": 0 },
  { "x": 8, "y": 5 },
  { "x": 8, "y": 7, "transparent": true },
  { "x": 8, "y": 10 },
  { "x": 0, "y": 10 },
  { "x": 0, "y": 0 }
]

Room 2

[
  { "x": 8, "y": 0 },
  { "x": 16, "y": 0 },
  { "x": 16, "y": 7 },
  { "x": 8, "y": 7 },
  { "x": 8, "y": 5, "transparent": true },
  { "x": 8, "y": 0 }
]

Known issues

  1. The turned off lights flicker when changing light scene - Philips Hue can't change the color of a light when it is turned off, so to enable that all lights have the same state when turned on, they will briefly need to be turned on and off to apply their new state.

  2. The power consumption is just an estimate - The estimate is based on the dimming percentage for the default light color for sultan, candle and light-strip models. If the model is of another type, it falls back to the sultan bulbs power consumption.

  3. The power consumption is never zero - This is not a bug. The Hue bridge draws power, as well as the lights, even when turned off, so it will never show 0 Watt.

Licenses