This makes sure that any scaling is only applied to numeric values. (#154)

* This makes sure that any scaling is only applied to numeric values.

* Updates fan controller.

This adds support for 3 speed fans, 4 speeds fan (with choice of 3 of the 4 speeds),
fans speed of 1,2,3,4 or low,medium,mid,high, and auto.

Fans that have variable speeds, or greater than 4 speeds is not supported
at this time.  HA does not support variable speed fans and more than 3 speeds.

* Revert "Updates fan controller."

This reverts commit 00352da2de72d02977d8a7d3780aabf4f28ee0fa.

Co-authored-by: Thomas Davis <tdavis@nersc.gov>
This commit is contained in:
ThomasADavis
2020-11-15 09:49:08 -08:00
committed by GitHub
parent a0f4fdf337
commit e137d598f0

View File

@@ -62,7 +62,7 @@ class LocaltuyaSensor(LocalTuyaEntity):
"""Device status was updated."""
state = self.dps(self._dp_id)
scale_factor = self._config.get(CONF_SCALING)
if scale_factor is not None:
if scale_factor is not None and isinstance(state, (int, float)):
state = round(state * scale_factor, DEFAULT_PRECISION)
self._state = state