hue

A service that controls Hue devices and emits information about them to NATS.

Author: Carl Danley

Last Updated: 16/03/20 21:02:03

Stars: 0

Get Latest Release View on GitHub

alfred-hue

Build Status

A project focused on exposing information about Philips Hue devices to an event bus.

Grafana Metrics

Miscellaneous Notes

It’s recommended to run a single instance of alfred-hue.

Currently, alfred-hue uses an in-memory cache which limits the number of instances that should be run at a given time. Each instance of alfred-hue is capped at a maximum of 12 cache updates per second (1 cache update request per 83.3 ms). In my testing, I’ve found that each cache update usually takes ~150-160 ms (~6 requests per second). Adding multiple instances of alfred-hue will add additional stress to the Hue bridge in your infrastructure which may potentially cause the bridge to become less responsive (which in turn, inhibits the request latency for interacting with lights).

Hardware Requirements

Required

To get started, you’ll need at least the following hardware:

  1. Philips Hue Bridge (version 3+ is preferable) – Amazon Link

Optional

I’ve tested all of the following Philips Hue Accessories with success:

  1. Philips Hue Indoor Motion Sensor – Amazon Link
  2. Philips Hue Smart Bulb – Amazon Link
  3. Philips Hue LightStrip Plus – Amazon Link
  4. Philips Hue Smart Spot Lights – Amazon Link
  5. Philips Hue Outdoor Motion Sensor – Amazon Link

Environment Variables

Name Description Default Value
NATS_SERVER The NATS connection URL used when connecting to the NATS cluster/server. "nats://127.0.0.1:4222"
NATS_EVENT_PREFIX The event prefix that will be used when publishing or subscribing to events. alfred
NATS_QUEUE_NAME The queue name that alfred-hue will subscribe to events on. alfred-hue
HUE_BRIDGE_ADDRESS The host or IP address of the Philips Hue Bridge you’re configured alfred-hue to connect to ""
HUE_USER_ID The generated Philips Hue User ID you acquire when pairing your application with the Philips Hue Bridge ""
METRICS_PORT The port that will be used for hosting the Prometheus metrics endpoint 9200

NATS Events Published

Here is a list of the events published to the event bus on state change:

Lights

  • hue.light.name
  • hue.light.softwareVersion
  • hue.light.on
  • hue.light.off
  • hue.light.reachable
  • hue.light.unreachable
  • hue.light.brightness
  • hue.light.hue
  • hue.light.saturation
  • hue.light.xy
  • hue.light.colorTemperature
  • hue.light.effect
  • hue.light.transitionTime
  • hue.light.colorMode

Sensors

  • hue.sensor.name
  • hue.sensor.softwareVersion
  • hue.sensor.on
  • hue.sensor.off
  • hue.sensor.battery
  • hue.sensor.reachable
  • hue.sensor.unreachable
  • hue.sensor.lightLevel
  • hue.sensor.dark
  • hue.sensor.daylight
  • hue.sensor.presence
  • hue.sensor.temperature

NATS Requests Available

Here is a list of the request events that alfred-hue listens for:

  • hue.light.get
  • hue.light.set
  • hue.sensor.get