Tuya number scaling (#3075)

This commit is contained in:
Marc J 2023-09-27 14:50:36 -07:00 committed by GitHub
parent cd20212a3f
commit e74b7870a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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:
------------------------