The ``pvvx_mithermometer`` display platform allows you to use devices running the `ATC_MiThermometer firmware <https://github.com/pvvx/ATC_MiThermometer>`__ by pvvx as display drivers with ESPHome.
The data to be displayed is transmitted as external data via BLE.
To do this, a ``ble_client`` component must be set up.
This component can also synchronize the time of the pvvx device by transmitting a timestamp on each connection.
After the data has been transmitted, the BLE connection is terminated in order to be able to receive the advertising data required for the ``pvvx_mithermometer`` sensor platform.
The pvvx firmware refreshes the screen periodically (can be set as minimum LCD refresh rate in the firmware configuration).
By default, the internal sensor data and, if available and valid (``validity_period``), the external data are switched every 2.5 s.
Further firmware configuration makes it possible to activate other display modes such as time and battery status.
The firmware configuration can be changed via browser using `TelinkMiFlasher.html <https://pvvx.github.io/ATC_MiThermometer/TelinkMiFlasher.html>`__.
..code-block:: yaml
# Example configuration entry
esp32_ble_tracker:
ble_client:
- mac_address: "A4:C1:38:B1:CD:7F"
id: pvvx_ble_display
display:
- platform: pvvx_mithermometer
ble_client_id: pvvx_ble_display
lambda: |-
it.print_bignum(23.1);
it.print_unit(pvvx_mithermometer::UNIT_DEG_C);
it.print_smallnum(33);
it.print_percent(true);
it.print_happy(true);
it.print_bracket(true);
Configuration variables:
------------------------
-**ble_client_id** (**Required**, :ref:`config-id`): ID of the associated BLE client.
-**disconnect_delay** (*Optional*, :ref:`config-time`): The amount of time the BLE connection is maintained before being disconnected again. Defaults to ``5s``.
-**update_interval** (*Optional*, :ref:`config-time`): The interval to transmit the display data. Defaults to ``60s``.
-**validity_period** (*Optional*, :ref:`config-time`): The time periode for which the pvvx device should display the information. Defaults to ``5min``.
-**lambda** (*Optional*, :ref:`lambda <config-lambda>`): The lambda to use to define the information to be displayed.
See :ref:`display-pvvx_mithermometer_lambda` for more information.
-**auto_clear_enabled** (*Optional*, boolean): Whether to automatically clear the display data before each lambda call,
or to keep the existing display content (must overwrite explicitly, e.g., only on data change). Defaults to ``true``.
-**id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation.
.._display-pvvx_mithermometer_lambda:
Rendering Lambda
----------------
The ``pvvx_mithermometer`` displays can only show two numbers with optional units and a smiley face. Therefore, the API is tailord to these limitations.
In the lambda you're passed a variable called ``it`` as with all other displays. In this case however, ``it`` is a ``PVVXDisplay`` instance (see API Reference).
..code-block:: yaml
display:
- platform: pvvx_mithermometer
# ...
lambda: |-
// Print -2.1 as big number (first row)
it.print_bignum(-2.1);
// Print °C next to the big number
it.print_unit(pvvx_mithermometer::UNIT_DEG_C);
// Print 88 as small number (second row)
it.print_smallnum(88);
// Print % next to the small number
it.print_percent(true);
// Print the low battery symbol
it.print_battery(true);
// Print a happy smiley. Results in " ^_^ "
it.print_happy(true);
// Print a sad smiley. Results in " -∧- "
it.print_sad(true);
// The comination of happy and sad simley results in " Δ△Δ "
// Print round brackets around the simley
it.print_bracket(true);
// The final result is "(Δ△Δ)"
Valid values for the big number (``it.print_bignum()``) are from -99.5 to 1999.5. Smaller values are displayed as ``Lo``, larger ones as ``Hi``. It will be printed to the screen. If not defined, a 0 will be displayed.
Valid values for the small number (``it.print_smallnum()``) are from -9 to 99. Smaller values are displayed as ``Lo``, larger ones as ``Hi``. If not defined, a 0 will be displayed.
Possible values for the unit of the big number (``it.print_unit()``) are:
-``pvvx_mithermometer::UNIT_NONE``: do not show a unit
-``pvvx_mithermometer::UNIT_DEG_GHE``: show ``°Г``
-``pvvx_mithermometer::UNIT_MINUS``: show ``-``
-``pvvx_mithermometer::UNIT_DEG_F``: show ``°F``
-``pvvx_mithermometer::UNIT_LOWDASH``: show ``_``
-``pvvx_mithermometer::UNIT_DEG_C``: show ``°C``
-``pvvx_mithermometer::UNIT_LINES``: show ``=``
-``pvvx_mithermometer::UNIT_DEG_E``: show ``°E``
The appearance of the smiley can be defined by combining the functions ``it.print_happy()``, ``it.print_sad()`` and ``it.print_bracket(true)``: