Refactored to new global json saving and loading (#10677)
* Refactored to new global json saving and loading * Fixed emulated_hue tests * Removed unnecassary error handling * Added missing newline * Remove unused imports * Fixed linting error * Moved _load_json wrapper out of the config class
This commit is contained in:
parent
7695ca2c8b
commit
a83e741dc7
15 changed files with 73 additions and 348 deletions
|
@ -14,6 +14,7 @@ import homeassistant.helpers.config_validation as cv
|
|||
from homeassistant.helpers import discovery
|
||||
from homeassistant.const import CONF_API_KEY
|
||||
from homeassistant.util import Throttle
|
||||
from homeassistant.util.json import save_json
|
||||
|
||||
REQUIREMENTS = ['python-ecobee-api==0.0.10']
|
||||
|
||||
|
@ -110,12 +111,10 @@ def setup(hass, config):
|
|||
if 'ecobee' in _CONFIGURING:
|
||||
return
|
||||
|
||||
from pyecobee import config_from_file
|
||||
|
||||
# Create ecobee.conf if it doesn't exist
|
||||
if not os.path.isfile(hass.config.path(ECOBEE_CONFIG_FILE)):
|
||||
jsonconfig = {"API_KEY": config[DOMAIN].get(CONF_API_KEY)}
|
||||
config_from_file(hass.config.path(ECOBEE_CONFIG_FILE), jsonconfig)
|
||||
save_json(hass.config.path(ECOBEE_CONFIG_FILE), jsonconfig)
|
||||
|
||||
NETWORK = EcobeeData(hass.config.path(ECOBEE_CONFIG_FILE))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue