From 90cad7dcc887ef00eb699f5739c20f077e574e98 Mon Sep 17 00:00:00 2001 From: Piotr Szulc Date: Thu, 22 Aug 2024 02:59:38 +0200 Subject: [PATCH] Tuya number: added description of new datapoint_hidden yaml key (#4010) Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com> --- components/number/tuya.rst | 21 +++++++++++++++++++++ components/tuya.rst | 1 + 2 files changed, 22 insertions(+) diff --git a/components/number/tuya.rst b/components/number/tuya.rst index bf05ac960..3b87b7652 100644 --- a/components/number/tuya.rst +++ b/components/number/tuya.rst @@ -61,6 +61,23 @@ For instance, assume we have a pH sensor that reads from 0.00 to 15.00 with a sc max_value: 15.00 multiply: 100 +Hidden datapoints: +------------------ +The above configurations will work fine as long as Tuya device publishes the datapoint value (along with its type) at initialization. +However this is not always the case. To be able to use such "hidden" datapoints as Number, you need to specify additional ``datapoint_hidden`` configuration block. +This block allows to specify the missing datapoint type and, optionally, the value that should be written to the datapoint at initialization. + +.. code-block:: yaml + + - platform: "tuya" + name: "Alarm at maximum" + number_datapoint: 116 + min_value: 0 + max_value: 100 + datapoint_hidden: + datapoint_type: int + initial_value: 85 + Configuration variables: ------------------------ @@ -69,6 +86,10 @@ Configuration variables: - **max_value** (**Required**, float): The maximum value this number can be. - **step** (*Optional*, float): The granularity with which the number can be set. Defaults to 1. - **multiply** (*Optional*, float): multiply the new value with this factor before sending the requests. +- **datapoint_hidden** (*Optional*): Specify information required for hidden datapoints. + + - **datapoint_type** (**Required**, string): The datapoint type, one of *int*, *uint*, *enum*. + - **initial_value** (*Optional*, float): The value to be written at initialization. Must be between ``min_value`` and ``max_value``. - All other options from :ref:`Number `. diff --git a/components/tuya.rst b/components/tuya.rst index d941b8cf6..57596d6dd 100644 --- a/components/tuya.rst +++ b/components/tuya.rst @@ -140,5 +140,6 @@ See Also - :doc:`/components/binary_sensor/tuya` - :doc:`/components/sensor/tuya` - :doc:`/components/text_sensor/tuya` +- :doc:`/components/number/tuya` - :apiref:`tuya/tuya.h` - :ghedit:`Edit`