Skip to main content

This package makes it possible to control the ws2811 type lights with a homeassistant mqtt instance

Project description

ws2811_mqtt

Overview

ws2811_mqtt is a Python package designed to control WS2811 LED strips using MQTT, making it easier to integrate lighting controls with the Home Assistant platform.

Local Installation

Use Poetry to install the package:

poetry install

PyPI Installation

The ws2811_mqtt package is also published on PyPI, allowing you to easily install it using pip. This enables seamless integration into projects without using Poetry.

pip install ws2811_mqtt

Usage

Here's a quick example on how to use ws2811_mqtt in your project:

env file

Multiple ways of doing this:

  1. You can pass the env vars directly to the executable
  2. create an env file where the script is run, and it will automatically be loaded
  3. Pass the path to your env file as an Environment variable: WS2811_ENV_PATH and it will read from there.
NUM_LEDS = 50
MQTT_BROKER = "192.168.0.123"
MQTT_PORT = 1883
MQTT_USER = "your_user"
MQTT_PASS = "your_password"
MQTT_UID = "ws2811-1"

Explanation of Environment Variables:

  • NUM_LEDS: This variable sets the number of LEDs in your strip. It's essential to configure this correctly to ensure that the program knows how many LEDs it needs to control.
  • MQTT_BROKER: This is the IP address of your MQTT broker. The broker is responsible for managing the communication between the different parts of your system.
  • MQTT_PORT: The port on which the MQTT broker is running. The default MQTT port is 1883, but this might need to be changed if your setup uses a different configuration.
  • MQTT_USER: The username required to authenticate with the MQTT broker.
  • MQTT_PASS: The password for the given MQTT user. It's used alongside the username
  • MQTT_UID: A unique identifier for this particular WS2811 LED controller instance. This is used so the broker and corresponding systems know where messages should be routed.

Script arguments

usage: ws2811-mqtt [-h] [-v]

Control the LED strip with MQTT and API

options:
  -h, --help       show this help message and exit
  -v, --verbosity  increase output verbosity, each v adds a verbosity level, (ex: -vvv)

Running the script

if installed locally:

poetry run ws2811_mqtt

if installed as package

ws2811_mqtt

Contributing

Contributions are welcome! Please submit a pull request or file an issue for any enhancements.

License

ws2811_mqtt is licensed under the Apache License 2.0.

Support

For issues or questions, please open an issue in this repository.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ws2811_mqtt-1.1.0.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ws2811_mqtt-1.1.0-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file ws2811_mqtt-1.1.0.tar.gz.

File metadata

  • Download URL: ws2811_mqtt-1.1.0.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.0 CPython/3.13.1 Linux/6.12.5-200.fc41.x86_64

File hashes

Hashes for ws2811_mqtt-1.1.0.tar.gz
Algorithm Hash digest
SHA256 479ad9f06c578d23f5c68b7a972979adb8520cc53fc665885847206252ba1991
MD5 5be0cf9ffed83005d8d87486c5adec9b
BLAKE2b-256 e6b94ee6b8014fd02ed88ac0b1a82783991a8de86a40d6bc458ca373fd18a399

See more details on using hashes here.

File details

Details for the file ws2811_mqtt-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: ws2811_mqtt-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.0 CPython/3.13.1 Linux/6.12.5-200.fc41.x86_64

File hashes

Hashes for ws2811_mqtt-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 97199d1d40e3ee3f0c6c5fe88f3cce183668888316a4f6ac4cf94828e43a5f08
MD5 7166f698f9d45eebbab4103e9488d5fb
BLAKE2b-256 1d1943153adc16a3855431d6b178cb39e3c3ee8ccae0eddee6f24705648637f7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page