1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Show notification when user configures Nest client_id/secret (#14970)

* Show notification when user configures Nest client_id/secret

* Lint
This commit is contained in:
Paulus Schoutsen
2018-06-15 15:19:58 -04:00
committed by GitHub
parent ac13a2736b
commit 8a777f6e78
6 changed files with 65 additions and 12 deletions

View File

@@ -2,6 +2,7 @@
import asyncio
from collections import OrderedDict
import logging
import os
import async_timeout
import voluptuous as vol
@@ -135,9 +136,14 @@ class NestFlowHandler(data_entry_flow.FlowHandler):
if self.hass.config_entries.async_entries(DOMAIN):
return self.async_abort(reason='already_setup')
config_path = info['nest_conf_path']
if not await self.hass.async_add_job(os.path.isfile, config_path):
self.flow_impl = DOMAIN
return await self.async_step_link()
flow = self.hass.data[DATA_FLOW_IMPL][DOMAIN]
tokens = await self.hass.async_add_job(
load_json, info['nest_conf_path'])
tokens = await self.hass.async_add_job(load_json, config_path)
return self._entry_from_tokens(
'Nest (import from configuration.yaml)', flow, tokens)