|
@@ -103,13 +103,17 @@ class TuyaLocalEntity:
|
|
|
for a in self._attr_dps:
|
|
for a in self._attr_dps:
|
|
|
value = a.get_value(self._device)
|
|
value = a.get_value(self._device)
|
|
|
if value is not None or not a.optional:
|
|
if value is not None or not a.optional:
|
|
|
- // Decode json attributes for user convenience
|
|
|
|
|
|
|
+ # Decode json attributes for user convenience
|
|
|
if a.rawtype == "json":
|
|
if a.rawtype == "json":
|
|
|
try:
|
|
try:
|
|
|
value = json.loads(value)
|
|
value = json.loads(value)
|
|
|
except json.JSONDecodeError:
|
|
except json.JSONDecodeError:
|
|
|
if value is not None:
|
|
if value is not None:
|
|
|
- _LOGGER.warning("Failed to decode JSON for attribute %s: %s", a.name, value)
|
|
|
|
|
|
|
+ _LOGGER.warning(
|
|
|
|
|
+ "Failed to decode JSON for attribute %s: %s",
|
|
|
|
|
+ a.name,
|
|
|
|
|
+ value,
|
|
|
|
|
+ )
|
|
|
attr[a.name] = value
|
|
attr[a.name] = value
|
|
|
return attr
|
|
return attr
|
|
|
|
|
|