Hue2mqtt

Introduction

Philips Hue bulbs and light strips can be driven from Calaos: switching, dimming, colour. They appear in the interfaces and are used in rules like any other lighting.

Calaos goes through the Hue bridge, the box supplied by Philips to which the bulbs are paired. The bulbs themselves are never addressed directly.

Two ways of doing it

MethodPrincipleBest when
Direct Hue IOCalaos queries the Hue bridgeYou only drive lamps
hue2mqtt gatewayA service translates Hue into MQTTYou already use MQTT, or want to report other Hue devices

The first is the simplest to set up. The second fits better into an installation where MQTT is already the common meeting point — see MQTT.

Method 1 — Direct Hue IO

Calaos Installer offers an output type for an RGB light driven by a Hue bridge.

NameTypeRequiredDescription
hoststringyesIP address of the Hue bridge
apistringyesAPI key returned by the bridge when the association is made
id_huestringyesUnique identifier of the lamp on the bridge

Do not try to obtain the API key and identifiers by hand: Calaos Installer includes a Hue wizard that fetches them automatically. You simply have to press the button on the bridge when it asks, as for any Hue association.

Method 2 — The hue2mqtt gateway

hue2mqtt is a service that connects to the Hue bridge and publishes everything it sees onto MQTT. Calaos then consumes those messages with ordinary MQTT IOs.

It ships with Calaos OS and is configured in /mnt/calaos/hue2mqtt. The configuration file has two sections:

[mqtt]
host = "127.0.0.1"
port = 1883
topic_prefix = "hue2mqtt"

[hue]
ip = "192.168.1.25"
username = "the key supplied by the bridge"

The [mqtt] section states where to publish — the local Mosquitto broker by default — and the [hue] section how to reach the bridge.

The service also accepts MQTT authentication and TLS encryption, if your broker requires them.

After a change, restart the service:

systemctl restart hue2mqtt

The IOs are then created as MQTT IOs, subscribing to the topics published under the configured prefix. To discover those topics, a tool such as MQTTX lets you watch what actually flows — see MQTT.

Common prerequisites

The Hue bridge must be reachable from the Calaos server, and preferably at a fixed address.

The bulbs must already be paired with the bridge through the Philips Hue application. Calaos drives them, it does not pair them.

A Hue bulb cut off by a wall switch becomes unreachable: this is the normal behaviour of these products, which must stay powered at all times. If your lamps regularly disappear, check this first before looking at the configuration.

Diagnosis

  1. does the bridge answer from the Calaos server?
  2. is the API key still valid? Resetting the bridge invalidates it.
  3. is the bulb powered and visible in the Philips Hue application?
  4. With hue2mqtt: are messages arriving on the MQTT broker?

See Logs, and Services for the state of the hue2mqtt service.