Rename shadow as optimistic

pull/31407/head
ColinRobbins 2020-02-08 13:25:01 +00:00
parent 4f53e2c6c6
commit e6e1db9cfb
2 changed files with 7 additions and 12 deletions

View File

@ -32,7 +32,7 @@ DOMAIN = "somfy"
CONF_CLIENT_ID = "client_id"
CONF_CLIENT_SECRET = "client_secret"
CONF_SHADOW = "shadow_cover"
CONF_OPTIMISTIC = "optimisitic"
SOMFY_AUTH_CALLBACK_PATH = "/auth/somfy/callback"
SOMFY_AUTH_START = "/auth/somfy"
@ -43,7 +43,7 @@ CONFIG_SCHEMA = vol.Schema(
{
vol.Required(CONF_CLIENT_ID): cv.string,
vol.Required(CONF_CLIENT_SECRET): cv.string,
vol.Optional(CONF_SHADOW): cv.boolean,
vol.Optional(CONF_OPTIMISTIC): cv.boolean,
}
)
},
@ -60,9 +60,9 @@ async def async_setup(hass, config):
if DOMAIN not in config:
return True
hass.data[DOMAIN][CONF_SHADOW] = False
if CONF_SHADOW in config[DOMAIN].keys():
hass.data[DOMAIN][CONF_SHADOW] = config[DOMAIN][CONF_SHADOW]
hass.data[DOMAIN][CONF_OPTIMISTIC] = False
if CONF_OPTIMISTIC in config[DOMAIN].keys():
hass.data[DOMAIN][CONF_OPTIMISTIC] = config[DOMAIN][CONF_OPTIMISTIC]
config_flow.SomfyFlowHandler.async_register_implementation(
hass,

View File

@ -8,7 +8,7 @@ from homeassistant.components.cover import (
CoverDevice,
)
from . import API, CONF_SHADOW, DEVICES, DOMAIN, SomfyEntity
from . import API, CONF_OPTIMISTIC, DEVICES, DOMAIN, SomfyEntity
async def async_setup_entry(hass, config_entry, async_add_entities):
@ -24,13 +24,8 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
devices = hass.data[DOMAIN][DEVICES]
if CONF_SHADOW in hass.data[DOMAIN].keys():
shadow = hass.data[DOMAIN][CONF_SHADOW]
else:
shadow = False
return [
SomfyCover(cover, hass.data[DOMAIN][API], shadow)
SomfyCover(cover, hass.data[DOMAIN][API], hass.data[DOMAIN][CONF_OPTIMISTIC])
for cover in devices
if categories & set(cover.categories)
]