mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 08:17:08 +00:00
Fix bug with monitored_conditions in Ambient PWS (#20837)
* Make monitored_conditions more specific in Ambient PWS * Revert messing around with storing monitored_conditions elsewhere * Come on, Aaron * Fix bug with monitored_conditions in Ambient PWS
This commit is contained in:
parent
55f9db6992
commit
b5b03f5b7f
@ -28,6 +28,8 @@ from .const import (
|
|||||||
REQUIREMENTS = ['aioambient==0.1.0']
|
REQUIREMENTS = ['aioambient==0.1.0']
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
DATA_CONFIG = 'config'
|
||||||
|
|
||||||
DEFAULT_SOCKET_MIN_RETRY = 15
|
DEFAULT_SOCKET_MIN_RETRY = 15
|
||||||
|
|
||||||
TYPE_24HOURRAININ = '24hourrainin'
|
TYPE_24HOURRAININ = '24hourrainin'
|
||||||
@ -234,12 +236,20 @@ async def async_setup(hass, config):
|
|||||||
|
|
||||||
conf = config[DOMAIN]
|
conf = config[DOMAIN]
|
||||||
|
|
||||||
|
# Store config for use during entry setup:
|
||||||
|
hass.data[DOMAIN][DATA_CONFIG] = conf
|
||||||
|
|
||||||
if conf[CONF_APP_KEY] in configured_instances(hass):
|
if conf[CONF_APP_KEY] in configured_instances(hass):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
hass.async_create_task(
|
hass.async_create_task(
|
||||||
hass.config_entries.flow.async_init(
|
hass.config_entries.flow.async_init(
|
||||||
DOMAIN, context={'source': SOURCE_IMPORT}, data=conf))
|
DOMAIN,
|
||||||
|
context={'source': SOURCE_IMPORT},
|
||||||
|
data={
|
||||||
|
CONF_API_KEY: conf[CONF_API_KEY],
|
||||||
|
CONF_APP_KEY: conf[CONF_APP_KEY]
|
||||||
|
}))
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@ -257,7 +267,7 @@ async def async_setup_entry(hass, config_entry):
|
|||||||
Client(
|
Client(
|
||||||
config_entry.data[CONF_API_KEY],
|
config_entry.data[CONF_API_KEY],
|
||||||
config_entry.data[CONF_APP_KEY], session),
|
config_entry.data[CONF_APP_KEY], session),
|
||||||
config_entry.data.get(CONF_MONITORED_CONDITIONS, []))
|
hass.data[DOMAIN][DATA_CONFIG].get(CONF_MONITORED_CONDITIONS, []))
|
||||||
hass.loop.create_task(ambient.ws_connect())
|
hass.loop.create_task(ambient.ws_connect())
|
||||||
hass.data[DOMAIN][DATA_CLIENT][config_entry.entry_id] = ambient
|
hass.data[DOMAIN][DATA_CLIENT][config_entry.entry_id] = ambient
|
||||||
except WebsocketConnectionError as err:
|
except WebsocketConnectionError as err:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user