Skip to content

Commit faf94be

Browse files
authored
Use read_wrapper entity helper in Tuya (home-assistant#157632)
1 parent ff91c57 commit faf94be

File tree

8 files changed

+8
-8
lines changed

8 files changed

+8
-8
lines changed

homeassistant/components/tuya/alarm_control_panel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def changed_by(self) -> str | None:
184184
"""Last change triggered by."""
185185
if self._changed_by_wrapper is None:
186186
return None
187-
return self._changed_by_wrapper.read_device_status(self.device)
187+
return self._read_wrapper(self._changed_by_wrapper)
188188

189189
async def async_alarm_disarm(self, code: str | None = None) -> None:
190190
"""Send Disarm command."""

homeassistant/components/tuya/binary_sensor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,4 +461,4 @@ def __init__(
461461
@property
462462
def is_on(self) -> bool | None:
463463
"""Return true if sensor is on."""
464-
return self._dpcode_wrapper.read_device_status(self.device)
464+
return self._read_wrapper(self._dpcode_wrapper)

homeassistant/components/tuya/number.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ def _validate_device_class_unit(self) -> None:
551551
@property
552552
def native_value(self) -> float | None:
553553
"""Return the entity value to represent the entity state."""
554-
return self._dpcode_wrapper.read_device_status(self.device)
554+
return self._read_wrapper(self._dpcode_wrapper)
555555

556556
async def async_set_native_value(self, value: float) -> None:
557557
"""Set new value."""

homeassistant/components/tuya/select.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ def __init__(
405405
@property
406406
def current_option(self) -> str | None:
407407
"""Return the selected entity option to represent the entity state."""
408-
return self._dpcode_wrapper.read_device_status(self.device)
408+
return self._read_wrapper(self._dpcode_wrapper)
409409

410410
async def async_select_option(self, option: str) -> None:
411411
"""Change the selected option."""

homeassistant/components/tuya/sensor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1851,4 +1851,4 @@ def _validate_device_class_unit(self) -> None:
18511851
@property
18521852
def native_value(self) -> StateType:
18531853
"""Return the value reported by the sensor."""
1854-
return self._dpcode_wrapper.read_device_status(self.device)
1854+
return self._read_wrapper(self._dpcode_wrapper)

homeassistant/components/tuya/siren.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def __init__(
105105
@property
106106
def is_on(self) -> bool | None:
107107
"""Return true if siren is on."""
108-
return self._dpcode_wrapper.read_device_status(self.device)
108+
return self._read_wrapper(self._dpcode_wrapper)
109109

110110
async def async_turn_on(self, **kwargs: Any) -> None:
111111
"""Turn the siren on."""

homeassistant/components/tuya/switch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1038,7 +1038,7 @@ def __init__(
10381038
@property
10391039
def is_on(self) -> bool | None:
10401040
"""Return true if switch is on."""
1041-
return self._dpcode_wrapper.read_device_status(self.device)
1041+
return self._read_wrapper(self._dpcode_wrapper)
10421042

10431043
async def async_turn_on(self, **kwargs: Any) -> None:
10441044
"""Turn the switch on."""

homeassistant/components/tuya/valve.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def __init__(
133133
@property
134134
def is_closed(self) -> bool | None:
135135
"""Return if the valve is closed."""
136-
if (is_open := self._dpcode_wrapper.read_device_status(self.device)) is None:
136+
if (is_open := self._read_wrapper(self._dpcode_wrapper)) is None:
137137
return None
138138
return not is_open
139139

0 commit comments

Comments
 (0)