2019-02-14 04:35:12 +00:00
|
|
|
"""Support for Melissa climate."""
|
2018-02-03 02:17:01 +00:00
|
|
|
import logging
|
|
|
|
|
2019-10-23 06:19:00 +00:00
|
|
|
import melissa
|
2018-02-03 02:17:01 +00:00
|
|
|
import voluptuous as vol
|
|
|
|
|
2019-10-23 06:19:00 +00:00
|
|
|
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
|
2018-02-03 02:17:01 +00:00
|
|
|
from homeassistant.helpers import config_validation as cv
|
2018-10-30 20:29:11 +00:00
|
|
|
from homeassistant.helpers.discovery import async_load_platform
|
2018-02-03 02:17:01 +00:00
|
|
|
|
|
|
|
_LOGGER = logging.getLogger(__name__)
|
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
DOMAIN = "melissa"
|
|
|
|
DATA_MELISSA = "MELISSA"
|
2018-02-03 02:17:01 +00:00
|
|
|
|
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
CONFIG_SCHEMA = vol.Schema(
|
|
|
|
{
|
|
|
|
DOMAIN: vol.Schema(
|
|
|
|
{
|
|
|
|
vol.Required(CONF_USERNAME): cv.string,
|
|
|
|
vol.Required(CONF_PASSWORD): cv.string,
|
|
|
|
}
|
|
|
|
)
|
|
|
|
},
|
|
|
|
extra=vol.ALLOW_EXTRA,
|
|
|
|
)
|
2018-02-03 02:17:01 +00:00
|
|
|
|
|
|
|
|
2018-10-30 20:29:11 +00:00
|
|
|
async def async_setup(hass, config):
|
2018-02-03 02:17:01 +00:00
|
|
|
"""Set up the Melissa Climate component."""
|
|
|
|
conf = config[DOMAIN]
|
|
|
|
username = conf.get(CONF_USERNAME)
|
|
|
|
password = conf.get(CONF_PASSWORD)
|
2018-10-30 20:29:11 +00:00
|
|
|
api = melissa.AsyncMelissa(username=username, password=password)
|
|
|
|
await api.async_connect()
|
2018-02-03 02:17:01 +00:00
|
|
|
hass.data[DATA_MELISSA] = api
|
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
hass.async_create_task(async_load_platform(hass, "climate", DOMAIN, {}, config))
|
2018-02-03 02:17:01 +00:00
|
|
|
return True
|