Tuya number scaling (#3075)

This commit is contained in:
Marc J 2023-09-27 14:50:36 -07:00 committed by Jesse Hills
parent cd1e9e9618
commit a4ba7f3ba6
No known key found for this signature in database
GPG Key ID: BEAAE804EFD8E83A
1 changed files with 13 additions and 0 deletions

View File

@ -48,6 +48,19 @@ Based on this, you can create a number as follows:
max_value: 2
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.
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:
.. code-block:: yaml
- platform: "tuya"
name: "pH Sensor"
number_datapoint: 106
min_value: 0.00
max_value: 15.00
step: 0.01
Configuration variables:
------------------------