From a4ba7f3ba6f286507f086de303da325e7006cfa9 Mon Sep 17 00:00:00 2001 From: Marc J Date: Wed, 27 Sep 2023 14:50:36 -0700 Subject: [PATCH] Tuya number scaling (#3075) --- components/number/tuya.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/components/number/tuya.rst b/components/number/tuya.rst index af333a9ab..1fce958e3 100644 --- a/components/number/tuya.rst +++ b/components/number/tuya.rst @@ -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: ------------------------