Fixed TuyaDevice init calls

This commit is contained in:
rospogrigio
2020-09-15 09:24:53 +02:00
parent 122d9a6a6f
commit 22ccd51926
3 changed files with 8 additions and 2 deletions

View File

@@ -50,6 +50,8 @@ def prepare_setup_entities(config_entry, platform):
config_entry.data[CONF_DEVICE_ID],
config_entry.data[CONF_HOST],
config_entry.data[CONF_LOCAL_KEY],
config_entry.data[CONF_FRIENDLY_NAME],
config_entry.data[CONF_NAME],
)
device.set_version(float(config_entry.data[CONF_PROTOCOL_VERSION]))
device.set_dpsUsed({})

View File

@@ -74,7 +74,11 @@ 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(
data[CONF_DEVICE_ID], data[CONF_HOST], data[CONF_LOCAL_KEY]
data[CONF_DEVICE_ID],
data[CONF_HOST],
data[CONF_LOCAL_KEY],
data[CONF_FRIENDLY_NAME],
data[CONF_NAME],
)
pytuyadevice.set_version(float(data[CONF_PROTOCOL_VERSION]))
pytuyadevice.set_dpsUsed({})

View File

@@ -173,7 +173,7 @@ payload_dict = {
class TuyaDevice(object):
def __init__(self, dev_id, address, local_key=None, connection_timeout=10):
def __init__(self, dev_id, address, local_key, friendly_name, name = "", connection_timeout=10):
"""
Represents a Tuya device.