NOTE: This is a work in progress.
This is a simple MQTT client that listens for messages containing commands and sends them to the LIFX bulbs.
Initially designed to be a replacement for https://github.com/denwilliams/lifx-mqtt. Future versions may support more features.
run make run
or go run ./cmd/lifx-mqtt
run make build
or go build -o lifx-mqtt ./cmd/lifx-mqtt
Using environment variables:
MQTT_URI="mqtt://localhost:1883" MQTT_TOPIC_PREFIX="lifx" ./lifx-mqtt
or from source..
MQTT_URI="mqtt://localhost:1883" MQTT_TOPIC_PREFIX="lifx" go run ./cmd/lifx-mqtt
For development you can create a .env
file in the root of the project.
Assuming the MQTT_TOPIC_PREFIX
is lifx
:
Starts a discovery of LIFX bulbs on the network. This is done automatically on startup, and periodically in the background, but can be triggered manually if needed.
Set the state of a bulb matching {id}, where {id} can be seen in the app and is derived from the MAC address (all lower case, without :
characters).
Light Off:
{
"brightness": 0
}
Light Warm Full Brightness:
{
"brightness": 100,
"temp": 2700
}
Light Cool Full Brightness:
{
"brightness": 100,
"temp": 6500
}
Light Red:
{"color": "#FF0000"}
Light Green:
{"color": "#00FF00"}
Fade the light out over 10s:
{
"brightness": 0,
"duration": 10000
}
TODO: turn a light on/off without messing with it's state