From 21b88f2fe89a714308e163a871bb4423a68bc88e Mon Sep 17 00:00:00 2001 From: huangyupeng Date: Mon, 20 Aug 2018 00:55:10 +0800 Subject: [PATCH] Tuya fix login problem and add login platform param (#16058) * add a platform param to distinguish different app's account. * fix requirements --- homeassistant/components/tuya.py | 10 ++++++---- requirements_all.txt | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/tuya.py b/homeassistant/components/tuya.py index 490c11baad7..33f34164b02 100644 --- a/homeassistant/components/tuya.py +++ b/homeassistant/components/tuya.py @@ -10,14 +10,14 @@ import voluptuous as vol from homeassistant.core import callback import homeassistant.helpers.config_validation as cv -from homeassistant.const import (CONF_USERNAME, CONF_PASSWORD) +from homeassistant.const import (CONF_USERNAME, CONF_PASSWORD, CONF_PLATFORM) from homeassistant.helpers import discovery from homeassistant.helpers.dispatcher import ( dispatcher_send, async_dispatcher_connect) from homeassistant.helpers.entity import Entity from homeassistant.helpers.event import track_time_interval -REQUIREMENTS = ['tuyapy==0.1.2'] +REQUIREMENTS = ['tuyapy==0.1.3'] _LOGGER = logging.getLogger(__name__) @@ -45,7 +45,8 @@ CONFIG_SCHEMA = vol.Schema({ DOMAIN: vol.Schema({ vol.Required(CONF_PASSWORD): cv.string, vol.Required(CONF_USERNAME): cv.string, - vol.Required(CONF_COUNTRYCODE): cv.string + vol.Required(CONF_COUNTRYCODE): cv.string, + vol.Optional(CONF_PLATFORM, default='tuya'): cv.string, }) }, extra=vol.ALLOW_EXTRA) @@ -58,9 +59,10 @@ def setup(hass, config): username = config[DOMAIN][CONF_USERNAME] password = config[DOMAIN][CONF_PASSWORD] country_code = config[DOMAIN][CONF_COUNTRYCODE] + platform = config[DOMAIN][CONF_PLATFORM] hass.data[DATA_TUYA] = tuya - tuya.init(username, password, country_code) + tuya.init(username, password, country_code, platform) hass.data[DOMAIN] = { 'entities': {} } diff --git a/requirements_all.txt b/requirements_all.txt index bcc521c1fdc..132696dcb10 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1392,7 +1392,7 @@ tplink==0.2.1 transmissionrpc==0.11 # homeassistant.components.tuya -tuyapy==0.1.2 +tuyapy==0.1.3 # homeassistant.components.twilio twilio==5.7.0