Add sm2135 component (#1127)

This commit is contained in:
BoukeHaarsma23 2021-05-12 21:14:26 +02:00 committed by GitHub
parent 990c53ba8e
commit ba199fef03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 212 additions and 0 deletions

View File

@ -0,0 +1,137 @@
SM2135 LED driver
==================
.. seo::
:description: Instructions for setting up SM2135 LED drivers in ESPHome.
:keywords: SM2135, Calex Smart RGB Reflector
.. _sm2135-component:
Component
---------
The SM2135 component represents a SM2135 LED diver chain
(`SM2135 description <https://github.com/arendst/Sonoff-Tasmota/files/3656603/SM2135E_zh-CN_en-US_translated.pdf>`__,
`SM2135 description <https://github.com/arendst/Sonoff-Tasmota/files/3656603/SM2135E_zh-CN_en-US_translated.pdf>`__) in
ESPHome. Communication is done with two GPIO pins (MOSI and SCLK).
It is used in some smart light bulbs:
- Calex Smart RGB Reflector LED lamp (GU10)
- LSC Smart GU10
To use the channels of this components, you first need to setup the
global ``sm2135`` hub and give it an id, and then define the
:ref:`individual output channels <sm2135-output>`.
.. code-block:: yaml
# Example configuration entry
sm2135:
data_pin: GPIO12
clock_pin: GPIO14
# Individual outputs
output:
- platform: sm2135
id: output_red
channel: 0
max_power: 0.8
- platform: sm2135
id: output_green
channel: 1
max_power: 0.8
- platform: sm2135
id: output_blue
channel: 2
max_power: 0.8
- platform: sm2135
id: output_white
channel: 3
max_power: 0.8
- platform: sm2135
id: output_warmwhite
channel: 4
max_power: 0.8
Configuration variables:
************************
- **data_pin** (**Required**, :ref:`config-pin_schema`): The pin used for MOSI.
- **clock_pin** (**Required**, :ref:`config-pin_schema`): The pin which SCLK is
connected to.
- **id** (*Optional*, :ref:`config-id`): The id to use for
this ``sm2135`` component. Use this if you have multiple SM2135 chains
connected at the same time.
.. _sm2135-output:
Driver Output
-------------
The SM2135 output component exposes a SM2135 channel of a global
:ref:`sm2135-component` as a float output.
.. code-block:: yaml
# Example configuration entry
sm2135:
data_pin: GPIO12
clock_pin: GPIO14
# Individual outputs
output:
- platform: sm2135
id: output_red
channel: 0
max_power: 0.8
- platform: sm2135
id: output_green
channel: 1
max_power: 0.8
- platform: sm2135
id: output_blue
channel: 2
max_power: 0.8
- platform: sm2135
id: output_white
channel: 3
max_power: 0.8
- platform: sm2135
id: output_warmwhite
channel: 4
max_power: 0.8
Configuration variables:
************************
- **id** (**Required**, :ref:`config-id`): The id to use for this output component.
- **channel** (**Required**, int): Chose the channel of the SM2135 chain of
this output component.
- **sm2135_id** (*Optional*, :ref:`config-id`): Manually specify the ID of the
:ref:`sm2135-component`.
Use this if you have multiple SM2135 chains you want to use at the same time.
- All other options from :ref:`Output <config-output>`.
.. note::
The white LEDs are much brighter than the color LEDs. To get uniform brightness
for both color and white you will need to limit the white led power.
.. note::
This driver does not support enabling of both the color and the white channels
at the same time. Therefore, the :ref:`rgbw_color_interlock` should be set to true
when using this driver.
See Also
--------
- :doc:`/components/output/index`
- :doc:`/components/output/esp8266_pwm`
- :doc:`/components/output/sm16716`
- :doc:`/components/light/rgb`
- :doc:`/components/light/rgbw`
- :doc:`/components/light/rgbww`
- :doc:`/components/power_supply`
- :apiref:`output/sm2135_output_component.h`
- :ghedit:`Edit`

74
images/sm2135.svg Normal file
View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="260"
height="61.333"
version="1.1"
id="svg10"
sodipodi:docname="sm2135.svg"
inkscape:version="1.0.2 (e86c870879, 2021-01-15)">
<metadata
id="metadata16">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs14" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1016"
id="namedview12"
showgrid="false"
inkscape:zoom="2.6523438"
inkscape:cx="157.86732"
inkscape:cy="8.179514"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg10" />
<path
d="M20.456 1.6h219.3c10.31 0 18.667 8.357 18.667 18.667v20.666c0 10.31-8.358 18.667-18.667 18.667h-219.3c-10.31 0-18.667-8.357-18.667-18.667V20.267C1.79 9.957 10.146 1.6 20.456 1.6z"
id="path2" />
<path
fill="none"
stroke="#000"
stroke-linecap="round"
stroke-linejoin="round"
stroke-miterlimit="10"
stroke-width="1.333"
d="M20.456 1.6h219.3c10.31 0 18.667 8.357 18.667 18.667v20.666c0 10.31-8.358 18.667-18.667 18.667h-219.3c-10.31 0-18.667-8.357-18.667-18.667V20.267C1.79 9.957 10.146 1.6 20.456 1.6z"
id="path4" />
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:49.4582px;line-height:1.25;font-family:sans-serif;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1.23645"
x="35.866905"
y="46.913731"
id="text24"
transform="scale(0.95547305,1.046602)"><tspan
sodipodi:role="line"
id="tspan22"
x="35.866905"
y="46.913731"
style="fill:#ffffff;stroke-width:1.23645">SM2135</tspan></text>
</svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -227,6 +227,7 @@ Output Components
TLC59208F, components/output/tlc59208f, tlc59208f.jpg
MY9231/MY9291, components/output/my9231, my9231.svg
SM16716, components/output/sm16716, sm16716.svg
SM2135, components/output/sm2135, sm2135.svg
MCP4725, components/output/mcp4725, mcp4725.jpg
Custom Output, components/output/custom, language-cpp.svg
Template Output, components/output/template, description.svg