From 4925cf5afffc331e1494408639fbd4948585138e Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Wed, 26 Jan 2022 23:05:01 +0100 Subject: [PATCH] Handle Tuya sendings strings instead of numeric values (#65009) --- homeassistant/components/tuya/base.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/tuya/base.py b/homeassistant/components/tuya/base.py index b51fa361121..ac9a9c83be2 100644 --- a/homeassistant/components/tuya/base.py +++ b/homeassistant/components/tuya/base.py @@ -74,7 +74,16 @@ class IntegerTypeData: @classmethod def from_json(cls, dpcode: DPCode, data: str) -> IntegerTypeData: """Load JSON string and return a IntegerTypeData object.""" - return cls(dpcode, **json.loads(data)) + parsed = json.loads(data) + return cls( + dpcode, + min=int(parsed["min"]), + max=int(parsed["max"]), + scale=float(parsed["scale"]), + step=float(parsed["step"]), + unit=parsed.get("unit"), + type=parsed.get("type"), + ) @dataclass