lab4d / rpi-HA-ws281x

Control WS281x connected to the Raspberry Pi GPIO via MQTT and Home Assistant

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Control WS281x connected to the Raspberry Pi GPIO via MQTT and Home Assistant

Add-on for Hass.io running on Raspberry Pi

Repository: https://github.com/lab4d/rpi-HA-ws281x

For supported GPIOs please see rpi-ws281x-python

Addon created based on this repository: https://github.com/pilotak/docker-rpi-ws281x-mqtt

Warning

This does not work yet due to some permission issues i am still figuring out!

Installation

  • copy the contents to /addons/rpi-ws
  • go to Supervisor/Add-on Store and it should appear under "Local Add-ons"

Environmental variables

  • LED_GPIO (required)
  • LED_COUNT (required)
  • LED_CHANNEL (optional; default=0)
  • LED_FREQ_HZ (optional; default=800000; 400000 or 800000)
  • LED_DMA_NUM (optional; default=10; range=0-14)
  • LED_BRIGHTNESS (optional; default=255; range=1-255)
  • LED_INVERT (optional; default=0; 0 or 1)
  • MQTT_BROKER (optional; default='localhost')
  • MQTT_USER (optional; default=None)
  • MQTT_PASSWORD (optional; default=None)
  • MQTT_PORT (optional; default=1883; range=1-65535)
  • MQTT_QOS (optional; default=1; range=0-2)
  • MQTT_ID (optional; default='rpi-ws281x')
  • MQTT_PREFIX (optional; default='rpi-ws281x')
  • MQTT_DISCOVERY_PREFIX (optional; default='homeassistant')

MQTT topics

To set color

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"
}

To turn off

Send to topic: rpi-ws281x/command

{
    "state": "OFF"
}

Last state

Topic: rpi-ws281x/state

{
    "state": "ON",
    "color": {
        "r": 255,
        "g": 109,
        "b": 109
    },
    "effect": "None"
}

Availability

Topic: rpi-ws281x/alive

Response: 1 or 0

About

Control WS281x connected to the Raspberry Pi GPIO via MQTT and Home Assistant

License:MIT License


Languages

Language:Python 91.8%Language:Dockerfile 8.2%