Add config flow to insteon component (#36467)

* Squashed

* Fix requirements_all

* Update homeassistant/components/insteon/__init__.py

Only update options if the result is to create the entry.

Co-authored-by: J. Nick Koston <nick@koston.org>

* Update homeassistant/components/insteon/__init__.py

No return value needed.

Co-authored-by: J. Nick Koston <nick@koston.org>

* Ref RESULT_TYPE_CREATE_ENTRY correctly

* Return result back to import config process

* Make DOMAIN ref more clear

Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
Tom Harris 2020-08-11 19:04:44 -04:00 committed by GitHub
parent 6bdb2f3d11
commit b1fd931cdc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 1740 additions and 111 deletions

View file

@ -13,7 +13,7 @@ from homeassistant.components.climate.const import (
CURRENT_HVAC_FAN,
CURRENT_HVAC_HEAT,
CURRENT_HVAC_IDLE,
DOMAIN,
DOMAIN as CLIMATE_DOMAIN,
HVAC_MODE_AUTO,
HVAC_MODE_COOL,
HVAC_MODE_FAN_ONLY,
@ -26,7 +26,9 @@ from homeassistant.components.climate.const import (
SUPPORT_TARGET_TEMPERATURE_RANGE,
)
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS, TEMP_FAHRENHEIT
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from .const import SIGNAL_ADD_ENTITIES
from .insteon_entity import InsteonEntity
from .utils import async_add_insteon_entities
@ -62,11 +64,22 @@ SUPPORTED_FEATURES = (
)
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the Insteon platform."""
async_add_insteon_entities(
hass, DOMAIN, InsteonClimateEntity, async_add_entities, discovery_info
)
async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up the Insteon climate entities from a config entry."""
def add_entities(discovery_info=None):
"""Add the Insteon entities for the platform."""
async_add_insteon_entities(
hass,
CLIMATE_DOMAIN,
InsteonClimateEntity,
async_add_entities,
discovery_info,
)
signal = f"{SIGNAL_ADD_ENTITIES}_{CLIMATE_DOMAIN}"
async_dispatcher_connect(hass, signal, add_entities)
add_entities()
class InsteonClimateEntity(InsteonEntity, ClimateEntity):