Hue Weather Controller

  • By
  • Added
  • 75 views
Project Name Hue Weather Controller
Featured Image Image
Project Type ElectronJS application
PDStig, LLC affiliation Personal / Not affiliated with a company
Date Started 30th Apr 2022
Progress / Status Paused (About 80% complete)
Description

In 2022, I developed a Desktop application for controlling LIFX smart light bulbs. In the later part of 2023, I modified the application to control Philips Hue bulbs instead as I stopped using LIFX in favor of Philips Hue. While it has basic controls for power and color, it can also adjust the bulbs on more advanced levels, such as sun position, outdoor brightness, and weather alerts. It utilizes my Tempest personal weather station for controlling bulbs based on outdoor brightness, lightning, or precipitation.

Main Features

  • Basic Philips Hue Bulb Control
    • Connect via the Philips Hue bridge directly on the LAN or use the Philips Hue Cloud API. Or, use both (prioritizes LAN and falls back to Cloud API).
    • View discovered bulbs (ids and label), connection status, and power status
    • Change a bulb's color
    • Toggle a bulb on or off
    • Flash a bulb to identify it
  • Fail Safe
    • Timed cycle cache so when an attempted bulb adjustment fails (such as flashing for a weather alert), the program will try again when the bulb reports online within a certain amount of time
    • Cycles run in a queue and ensure relevant bulbs are not currently running a cycle before one begins. This ensures cycles do not cancel each other out except for high priority ones (like weather alerts) cancelling lower priority ones (like sun brightness changes).
  • Statuses
    • View how each component is currently controlling bulbs in the app, such as the current sun / cloud cover brightness, Kelvin, and active weather alerts.
  • Conflict Resolution
    • When bulbs are set to adjust both for cloud cover and sun, they will take whichever component specifies the brighter setting.
  • Sun Control
    • Control the brightness of specified bulbs according to current sun position at a configured geo coordinate
    • Set minimum and maximum brightness levels
  • Kelvin / Warm Light Control
    • Control the warmth of configured light bulbs according to the current time
    • Set minimum and maximum Kelvin degree values
    • Set the hour at which bulbs should reach minimum (warmest) Kelvin, and hour at which they should change back to the coolest Kelvin.
  • Sun Brightness Control
    • Control the brightness of specified bulbs according to current sun brightness read from a Tempest personal weather station
    • Set minimum and maximum brightness levels
  • Lightning / Precipitation indications
    • Turn on a bulb to a specific color when lightning or precipitation has been detected by a Tempest personal weather station or is in the near-term forecast. And turn the bulbs back to their original color when the lightning / precipitation is gone. Useful for turning a bulb on at night to drown out lightning flashes when sleeping.
  • Weather Alerts Control
    • Configure certain bulbs to flash for new weather alerts from the National Weather Service. Bulbs can be specified according to an alert severity level: extreme, severe, moderate, or minor.
    • Configure certain bulbs to also flash-cycle active weather alerts every 5 minutes
    • Each type of alert has its own bright and dim color for the flashing

Technologies Used

  • Electron.JS (JavaScript, Node.js, HTML, CSS)
  • AdminLTE website template
  • electron-store settings saver for electron
  • node-cron task scheduler
  • suncalc astronomical data calculator
  • luxon and momentJS date/time libraries
  • weathered for connecting to the National Weather Service
  • node-hue-api for controlling Philips Hue bulbs
  • node-fetch-commonjs for general HTTP requests such as to the Tempest weather API
Links

Patrick Schmalstig / LIFX · GitLab

Edited