Tuya Number: split "multiply" to a separate option (#3224)

Fixes: esphome/issues#4928
This commit is contained in:
Faidon Liambotis 2023-10-03 03:23:22 +03:00 committed by GitHub
parent 6edf9ba800
commit 07a2450874
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,9 +48,9 @@ Based on this, you can create a number as follows:
max_value: 2 max_value: 2
step: 1 step: 1
The value for ``step`` is used as the scaling factor for the Number. All numbers in Tuya are integers, so a scaling factor is sometimes needed to convert the Tuya reported value into floating point. The value for ``multiply`` is used as the scaling factor for the Number. All numbers in Tuya are integers, so a scaling factor is sometimes needed to convert the Tuya reported value into floating point.
For instance, assume we have a pH sensor that reads from 0.00 to 15.00 with a scaling of 0.01. By setting `step` to 0.01, on the Tuya side (not visible to the user) the number will be reported as an integer from 0 to 1500. The following configuration could be used: For instance, assume we have a pH sensor that reads from 0.00 to 15.00 with a scaling of 0.01. By setting ``multiply`` to 100, on the Tuya side (not visible to the user) the number will be reported as an integer from 0 to 1500. The following configuration could be used:
.. code-block:: yaml .. code-block:: yaml
@ -59,7 +59,7 @@ For instance, assume we have a pH sensor that reads from 0.00 to 15.00 with a sc
number_datapoint: 106 number_datapoint: 106
min_value: 0.00 min_value: 0.00
max_value: 15.00 max_value: 15.00
step: 0.01 multiply: 100
Configuration variables: Configuration variables:
------------------------ ------------------------
@ -69,7 +69,9 @@ Configuration variables:
- **number_datapoint** (**Required**, int): The datapoint id number of the number. - **number_datapoint** (**Required**, int): The datapoint id number of the number.
- **min_value** (**Required**, float): The minimum value this number can be. - **min_value** (**Required**, float): The minimum value this number can be.
- **max_value** (**Required**, float): The maximum value this number can be. - **max_value** (**Required**, float): The maximum value this number can be.
- **step** (**Required**, float): The granularity with which the number can be set. - **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.
- All other options from :ref:`Number <config-number>`. - All other options from :ref:`Number <config-number>`.
See Also See Also