Skip to content

Commit 3d2b506

Browse files
authored
Rename Tuya method (home-assistant#157640)
1 parent d3c1c28 commit 3d2b506

File tree

15 files changed

+42
-40
lines changed

15 files changed

+42
-40
lines changed

homeassistant/components/tuya/alarm_control_panel.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,16 +188,16 @@ def changed_by(self) -> str | None:
188188

189189
async def async_alarm_disarm(self, code: str | None = None) -> None:
190190
"""Send Disarm command."""
191-
await self._async_send_dpcode_update(self._mode_wrapper, "disarm")
191+
await self._async_send_wrapper_updates(self._mode_wrapper, "disarm")
192192

193193
async def async_alarm_arm_home(self, code: str | None = None) -> None:
194194
"""Send Home command."""
195-
await self._async_send_dpcode_update(self._mode_wrapper, "arm_home")
195+
await self._async_send_wrapper_updates(self._mode_wrapper, "arm_home")
196196

197197
async def async_alarm_arm_away(self, code: str | None = None) -> None:
198198
"""Send Arm command."""
199-
await self._async_send_dpcode_update(self._mode_wrapper, "arm_away")
199+
await self._async_send_wrapper_updates(self._mode_wrapper, "arm_away")
200200

201201
async def async_alarm_trigger(self, code: str | None = None) -> None:
202202
"""Send SOS command."""
203-
await self._async_send_dpcode_update(self._mode_wrapper, "trigger")
203+
await self._async_send_wrapper_updates(self._mode_wrapper, "trigger")

homeassistant/components/tuya/button.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,4 @@ def __init__(
117117

118118
async def async_press(self) -> None:
119119
"""Press the button."""
120-
await self._async_send_dpcode_update(self._dpcode_wrapper, True)
120+
await self._async_send_wrapper_updates(self._dpcode_wrapper, True)

homeassistant/components/tuya/camera.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ async def async_camera_image(
118118

119119
async def async_enable_motion_detection(self) -> None:
120120
"""Enable motion detection in the camera."""
121-
await self._async_send_dpcode_update(self._motion_detection_switch, True)
121+
await self._async_send_wrapper_updates(self._motion_detection_switch, True)
122122

123123
async def async_disable_motion_detection(self) -> None:
124124
"""Disable motion detection in camera."""
125-
await self._async_send_dpcode_update(self._motion_detection_switch, False)
125+
await self._async_send_wrapper_updates(self._motion_detection_switch, False)

homeassistant/components/tuya/climate.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -360,15 +360,15 @@ async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None:
360360

361361
async def async_set_preset_mode(self, preset_mode: str) -> None:
362362
"""Set new target preset mode."""
363-
await self._async_send_dpcode_update(self._hvac_mode_wrapper, preset_mode)
363+
await self._async_send_wrapper_updates(self._hvac_mode_wrapper, preset_mode)
364364

365365
async def async_set_fan_mode(self, fan_mode: str) -> None:
366366
"""Set new target fan mode."""
367-
await self._async_send_dpcode_update(self._fan_mode_wrapper, fan_mode)
367+
await self._async_send_wrapper_updates(self._fan_mode_wrapper, fan_mode)
368368

369369
async def async_set_humidity(self, humidity: int) -> None:
370370
"""Set new target humidity."""
371-
await self._async_send_dpcode_update(self._target_humidity_wrapper, humidity)
371+
await self._async_send_wrapper_updates(self._target_humidity_wrapper, humidity)
372372

373373
async def async_set_swing_mode(self, swing_mode: str) -> None:
374374
"""Set new target swing operation."""
@@ -396,7 +396,7 @@ async def async_set_swing_mode(self, swing_mode: str) -> None:
396396

397397
async def async_set_temperature(self, **kwargs: Any) -> None:
398398
"""Set new target temperature."""
399-
await self._async_send_dpcode_update(
399+
await self._async_send_wrapper_updates(
400400
self._set_temperature, kwargs[ATTR_TEMPERATURE]
401401
)
402402

@@ -475,8 +475,8 @@ def swing_mode(self) -> str:
475475

476476
async def async_turn_on(self) -> None:
477477
"""Turn the device on, retaining current HVAC (if supported)."""
478-
await self._async_send_dpcode_update(self._switch_wrapper, True)
478+
await self._async_send_wrapper_updates(self._switch_wrapper, True)
479479

480480
async def async_turn_off(self) -> None:
481481
"""Turn the device on, retaining current HVAC (if supported)."""
482-
await self._async_send_dpcode_update(self._switch_wrapper, False)
482+
await self._async_send_wrapper_updates(self._switch_wrapper, False)

homeassistant/components/tuya/cover.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,9 @@ async def async_close_cover(self, **kwargs: Any) -> None:
439439

440440
async def async_set_cover_position(self, **kwargs: Any) -> None:
441441
"""Move the cover to a specific position."""
442-
await self._async_send_dpcode_update(self._set_position, kwargs[ATTR_POSITION])
442+
await self._async_send_wrapper_updates(
443+
self._set_position, kwargs[ATTR_POSITION]
444+
)
443445

444446
async def async_stop_cover(self, **kwargs: Any) -> None:
445447
"""Stop the cover."""
@@ -450,6 +452,6 @@ async def async_stop_cover(self, **kwargs: Any) -> None:
450452

451453
async def async_set_cover_tilt_position(self, **kwargs: Any) -> None:
452454
"""Move the cover tilt to a specific position."""
453-
await self._async_send_dpcode_update(
455+
await self._async_send_wrapper_updates(
454456
self._tilt_position, kwargs[ATTR_TILT_POSITION]
455457
)

homeassistant/components/tuya/entity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def _read_wrapper(self, dpcode_wrapper: DPCodeWrapper | None) -> Any | None:
7676
return None
7777
return dpcode_wrapper.read_device_status(self.device)
7878

79-
async def _async_send_dpcode_update(
79+
async def _async_send_wrapper_updates(
8080
self, dpcode_wrapper: DPCodeWrapper | None, value: Any
8181
) -> None:
8282
"""Send command to the device."""

homeassistant/components/tuya/fan.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -209,19 +209,19 @@ def __init__(
209209

210210
async def async_set_preset_mode(self, preset_mode: str) -> None:
211211
"""Set the preset mode of the fan."""
212-
await self._async_send_dpcode_update(self._mode_wrapper, preset_mode)
212+
await self._async_send_wrapper_updates(self._mode_wrapper, preset_mode)
213213

214214
async def async_set_direction(self, direction: str) -> None:
215215
"""Set the direction of the fan."""
216-
await self._async_send_dpcode_update(self._direction_wrapper, direction)
216+
await self._async_send_wrapper_updates(self._direction_wrapper, direction)
217217

218218
async def async_set_percentage(self, percentage: int) -> None:
219219
"""Set the speed of the fan, as a percentage."""
220-
await self._async_send_dpcode_update(self._speed_wrapper, percentage)
220+
await self._async_send_wrapper_updates(self._speed_wrapper, percentage)
221221

222222
async def async_turn_off(self, **kwargs: Any) -> None:
223223
"""Turn the fan off."""
224-
await self._async_send_dpcode_update(self._switch_wrapper, False)
224+
await self._async_send_wrapper_updates(self._switch_wrapper, False)
225225

226226
async def async_turn_on(
227227
self,
@@ -250,7 +250,7 @@ async def async_turn_on(
250250

251251
async def async_oscillate(self, oscillating: bool) -> None:
252252
"""Oscillate the fan."""
253-
await self._async_send_dpcode_update(self._oscillate_wrapper, oscillating)
253+
await self._async_send_wrapper_updates(self._oscillate_wrapper, oscillating)
254254

255255
@property
256256
def is_on(self) -> bool | None:

homeassistant/components/tuya/humidifier.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ async def async_turn_on(self, **kwargs: Any) -> None:
192192
self.device,
193193
self.entity_description.dpcode or self.entity_description.key,
194194
)
195-
await self._async_send_dpcode_update(self._switch_wrapper, True)
195+
await self._async_send_wrapper_updates(self._switch_wrapper, True)
196196

197197
async def async_turn_off(self, **kwargs: Any) -> None:
198198
"""Turn the device off."""
@@ -201,7 +201,7 @@ async def async_turn_off(self, **kwargs: Any) -> None:
201201
self.device,
202202
self.entity_description.dpcode or self.entity_description.key,
203203
)
204-
await self._async_send_dpcode_update(self._switch_wrapper, False)
204+
await self._async_send_wrapper_updates(self._switch_wrapper, False)
205205

206206
async def async_set_humidity(self, humidity: int) -> None:
207207
"""Set new target humidity."""
@@ -210,8 +210,8 @@ async def async_set_humidity(self, humidity: int) -> None:
210210
self.device,
211211
self.entity_description.humidity,
212212
)
213-
await self._async_send_dpcode_update(self._target_humidity_wrapper, humidity)
213+
await self._async_send_wrapper_updates(self._target_humidity_wrapper, humidity)
214214

215215
async def async_set_mode(self, mode: str) -> None:
216216
"""Set new target preset mode."""
217-
await self._async_send_dpcode_update(self._mode_wrapper, mode)
217+
await self._async_send_wrapper_updates(self._mode_wrapper, mode)

homeassistant/components/tuya/light.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ def turn_on(self, **kwargs: Any) -> None:
784784

785785
async def async_turn_off(self, **kwargs: Any) -> None:
786786
"""Instruct the light to turn off."""
787-
await self._async_send_dpcode_update(self._switch_wrapper, False)
787+
await self._async_send_wrapper_updates(self._switch_wrapper, False)
788788

789789
@property
790790
def brightness(self) -> int | None:

homeassistant/components/tuya/number.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,4 +555,4 @@ def native_value(self) -> float | None:
555555

556556
async def async_set_native_value(self, value: float) -> None:
557557
"""Set new value."""
558-
await self._async_send_dpcode_update(self._dpcode_wrapper, value)
558+
await self._async_send_wrapper_updates(self._dpcode_wrapper, value)

0 commit comments

Comments
 (0)