:description:Instructions for setting up TM1621 LCD Display.
:image:tm1621.jpg
The ``tm1621`` display platform allows you to use the popular TM1621 LCD display drivers with ESPHome, that can find in Sonoff device like THR316D, THR320D, POWR316D or POWR320D
..figure:: images/tm1621-full.jpg
:align:center
:width:75.0%
TM1621 LCD Display.
The LCD have four signal, ``cs`` for chip select, ``data`` for data signal, ``read`` for reading data dir and ``write`` for writing data dir
..code-block:: yaml
# Example configuration entry
display:
platform: tm1621
id: tm1621_display
cs_pin: GPIO17
data_pin: GPIO5
read_pin: GPIO23
write_pin: GPIO18
lambda: |-
it.printf(0, "%.1f", id(my_sensor1).state);
it.display_celsius(true);
it.printf(1, "%.1f", id(my_sensor2).state);
it.display_humidity(true);
Configuration variables:
------------------------
-**cs_pin** (**Required**, :ref:`Pin Schema <config-pin_schema>`): The pin you have the CS line.
-**data_pin** (**Required**, :ref:`Pin Schema <config-pin_schema>`): The pin you have the DATA line.
-**read_pin** (**Required**, :ref:`Pin Schema <config-pin_schema>`): The pin you have the READ line.
-**write_pin** (**Required**, :ref:`Pin Schema <config-pin_schema>`): The pin you have the WRITE line.
-**lambda** (*Optional*, :ref:`lambda <config-lambda>`): The lambda to use for rendering the content on the TM1621.
See :ref:`display-tm1621_lambda` for more information.
-**update_interval** (*Optional*, :ref:`config-time`): The interval to re-draw the screen. Defaults to ``1s``.
-**id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation.
.._display-tm1621_lambda:
Rendering Lambda
----------------
The TM1621 has a similar API to the fully fledged :ref:`display-engine`, but it's only a subset as the TM1621
LCD displays don't have a concept of individual pixels. In the lambda you're passed a variable called ``it``
as with all other displays. In this case however, ``it`` is a TM1621 instance (see API Reference).
The most basic operation with the TM1621 is wiring a simple number to the screen as in the configuration example
at the top of this page. But even though you're passing in a string (here ``"0123"``), ESPHome converts it
into a representation that the TM1621 can understand.
Each of the three methods (``print`` and ``printf``) all optionally take a the line number (0 for first line and 1 for the second).
This argument is ``0`` by default.
Also note that the ``.`` (dot) character is special because when ESPHome encounters it in the string the dot
segment of the previous position will be enabled.
..code-block:: yaml
display:
- platform: tm1621
# ...
lambda: |-
it.printf(0, "%.1f", id(my_sensor1).state);
it.display_celsius(true);
it.printf(1, "%.1f", id(my_sensor2).state);
it.display_humidity(true);
Please see :ref:`display-printf` for a quick introduction into the ``printf`` formatting rules.
Also we have five function to display or not some unites:
- °C on the first line : ``display_celsius(bool)``
- °F on the first line : ``display_fahrenheit(bool)``