Moved TuyaCache to __init__.py, and renamed to TuyaDevice. In pytuya, renamed TuyaDevice to TuyaInterface

This commit is contained in:
rospogrigio
2020-09-22 00:49:05 +02:00
committed by rospogrigio
parent dd48fc00f5
commit 83b3b6f21b
8 changed files with 113 additions and 366 deletions

View File

@@ -128,17 +128,17 @@ def strip_dps_values(user_input, dps_strings):
async def validate_input(hass: core.HomeAssistant, data):
"""Validate the user input allows us to connect."""
pytuyadevice = pytuya.TuyaDevice(
tuyainterface = pytuya.TuyaInterface(
data[CONF_DEVICE_ID],
data[CONF_HOST],
data[CONF_LOCAL_KEY],
float(data[CONF_PROTOCOL_VERSION]),
)
pytuyadevice.set_version(float(data[CONF_PROTOCOL_VERSION]))
detected_dps = {}
try:
detected_dps = await hass.async_add_executor_job(
pytuyadevice.detect_available_dps
tuyainterface.detect_available_dps
)
except (ConnectionRefusedError, ConnectionResetError):
raise CannotConnect