This image is ready to be used in HomeAssistant - supports MQTT discovery, for all other purposes, please see topics used below.
For supported GPIOs please see rpi-ws281x-python
Variable | Default value | Allowed values | |
---|---|---|---|
LED_GPIO |
required | ||
LED_COUNT |
required | ||
LED_CHANNEL |
optional | 0 | |
LED_FREQ_HZ |
optional | 800000 | 400000 or 800000 |
LED_DMA_NUM |
optional | 10 | 0-14 |
LED_BRIGHTNESS |
optional | 255 | 1-255 |
LED_INVERT |
optional | 0 | 0 or 1 |
LED_STRIP_TYPE |
optional | GRB | BGR, BRG, GBR, GRB, RBG, RGB |
MQTT_BROKER |
optional | 'localhost' | |
MQTT_USER |
optional | None | |
MQTT_PASSWORD |
optional | None | |
MQTT_PORT |
optional | 1883 | 1-65535 |
MQTT_QOS |
optional | 1 | 0-2 |
MQTT_ID |
optional | 'rpi-ws281x' | |
MQTT_PREFIX |
optional | 'rpi-ws281x' | |
MQTT_DISCOVERY_PREFIX |
optional | 'homeassistant' |
version: "3.6"
services:
mosquitto:
container_name: mosquitto
restart: always
image: eclipse-mosquitto
ports:
- 1883:1883
rpi_ws281x:
container_name: rpi_ws281x
restart: unless-stopped
image: pilotak/rpi-ws281x-mqtt
privileged: true
depends_on:
- mosquitto
environment:
- LED_GPIO=18
- LED_COUNT=167
- MQTT_BROKER=mosquitto
- MQTT_USER=user
- MQTT_PASSWORD=123456
Send to topic: rpi-ws281x/command
Note: color
and effect
are optional keys, you can send both or just one or none in which case last color selected is used.
{
"state": "ON",
"color": {
"r": 0,
"g": 255,
"b": 0
},
"effect": "Knight Rider"
}
Send to topic: rpi-ws281x/command
{
"state": "OFF"
}
Topic: rpi-ws281x/state
{
"state": "ON",
"color": {
"r": 255,
"g": 109,
"b": 109
},
"effect": "None"
}
Topic: rpi-ws281x/alive
Response: 1
or 0