Coder Social home page Coder Social logo

markusbart82 / homeassistant_mqtt_light Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 748 KB

Homeassistant compatible MQTT Light implementation for RGB+CCT LEDs

License: GNU Lesser General Public License v2.1

C++ 98.96% C 1.04%
homeassistant-device homeassistant-mqtt-light mqtt-discovery rgbww

homeassistant_mqtt_light's Introduction

Homeassistant MQTT Light

Homeassistant compatible MQTT Light implementation for RGB+CCT LEDs. Uses ESP8266 and PCA9685.

The idea started because I wanted "white with a color tint" smart lights. But apparently, this is not supported by smart home tech yet. It's either RGB, or white, never a mix of these. So this lamp here identifies as RGB, but mixes white with it.

Color mixing

To mix colors, the lamp takes the minimum of the three R,G,B colors, and replaces it with white.

  • RGB(255,255,255) --> RGBW(0,0,0,255)
  • RGB(255,128,0) --> RGBW(255,128,0,0)
  • RGB(255,192,128) --> RGBW(128,64,0,128)

White mixing

In addition, this lamp supports tuneable white, so mixing warm white and cold white with everything else. In order to make Homeassistant use this, the lamp remembers the last color temperature setting and uses this.

  • RGB(255,255,255),TEMP(255) --> RGBWC(0,0,0,0,255)
  • RGB(255,255,255),TEMP(0) --> RGBWC(0,0,0,255,0)
  • RGB(255,128,0),TEMP(255) --> RGBWC(255,128,0,0,0)
  • RGB(255,192,128),TEMP(64) --> RGBWC(128,64,0,192,64)

Homeassistant integration

The lamp supports autodiscovery and identifies as "ESP-dimmer-NUMBER", where the number is derived from the MAC address. Supported features:

  • JSON schema
  • ON/OFF
  • brightness
  • color temperature
  • RGB
  • transitions
  • flashing

Effects

The lamp supports the following effects:

  • Colorwheel - slowly changes through the RGB spectrum
  • Undulation - slowly undulates randomly near the previously selected color

Stand-alone mode

As a fallback, the lamp supports stand-alone operation:

  • On powerup, the lamp turns on with neutral white

Hardware

The lamp uses the PCA9685 PWM driver IC (16 channels, 12 bits, up to 1.5kHz, I2C) to interface with the LEDs. Currently, channels 1..5 are assigned R,G,B,WW,CW.

Ledcontroller_3x

This PCB includes the ESP8266, PCA9685 and BLM3400 mosfets, for controlling 24V LED strips with a common +24V.

homeassistant_mqtt_light's People

Contributors

markusbart82 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.