Skip to content

Commit

Permalink
Tuya fix login problem and add login platform param (#16058)
Browse files Browse the repository at this point in the history
* add a platform param to distinguish different app's account.

* fix requirements
  • Loading branch information
huangyupeng authored and balloob committed Aug 19, 2018
1 parent 1c8ef4e commit cb44607
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions homeassistant/components/tuya.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@

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__)

Expand Down Expand Up @@ -45,7 +45,8 @@
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)

Expand All @@ -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': {}
}
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1389,7 +1389,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
Expand Down

0 comments on commit cb44607

Please sign in to comment.