deg0nz / homebridge-mqttthing-esp8266-ws2812

Control WS2812 LEDs with ESP8266 and Homebridge MQTT-Thing via MQTT

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

⚠️ Note: This is obsolete for me and will be archived soon™️. One can achieve the same thing with WLED and the Homebridge Plugin homebridge-wled-simple, which is super easy to configure and brings a lot more features. This setup seems to be extremely reliable as well.

Homebridge MQTT-Thing ESP8266 WS2812 Controller

This program lets you control WS2812 LED stripes connected to an ESP8266 via Homebridge and the Homebridge MQTT-Thing plugin. This way you can control a WS2812 LED stripe via the iOS Home.app or Siri.

Why this?

I was following Studio Pieter's HOWTO for controlling a WS2812 LED stripes, which uses the homekit2mqtt Homekit bridge. But I didn't want another Homekit bridge since I already had Homebridge installed and in use. So I adjusted the code from Studio Pieter's NeoPixel-MQTT HOWTO to use the direct HSV values from Homebridge MQTT-Thing plugin and set the LEDs.

Preconditions

  • Platform.io installation
  • Homebridge installation
  • MQTT Broker installation running in your network
  • Homebridge MQTT-Thing plugin installes in Homebridge

For installing Homebridge and MQTT Broker, follow the corresponding parts in https://www.studiopieters.nl/homebridge-homekit-2-mqtt-revised-installation/. Install Homebridge MQTT-Thing via the Homebridge UI.

Configuration

ESP8266 Code

  • Adjust the variables at the top of main.ino to your needs
  • Install the NeoPixel library to the project: platformio lib install --save "Adafruit NeoPixel"
  • Compile the project: platformio run
  • Upload the build to your ESP8266

Homebridge

  • You need to configure a Lightbulb - HSV item in the Homebridge MQTT-Thing plugin.

Add this to the accessories array on your Homebridge config:

{
    "type": "lightbulb-HSV",
    "name": "LED Stripe",
    "topics": {
        "getOnline": "led-nodemcu/online",
        "setHSV": "led-nodemcu/hsvcolor",
        "getHSV": "led-nodemcu/hsvcolor",
        "getOn": "led-nodemcu",
        "setOn": "led-nodemcu"
    },
    "confirmationIndicateOffline": true,
    "integerValue": false,
    "accessory": "mqttthing"
}

Adjust led-nodemcu above if you changed the host variable in main.ino. Also adjust the name to your needs.

Acknowledgements and sources

About

Control WS2812 LEDs with ESP8266 and Homebridge MQTT-Thing via MQTT

License:MIT License


Languages

Language:C++ 91.0%Language:Python 7.7%Language:C 0.9%Language:Makefile 0.4%