Extract 'secret_key' as a constant

This commit is contained in:
hydreliox 2016-01-13 03:45:43 +01:00
parent 6f1a25d8d6
commit 03febb81d3

View File

@ -21,6 +21,7 @@ REQUIREMENTS = [
'#lnetatmo==0.3.0.dev1'] '#lnetatmo==0.3.0.dev1']
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
SENSOR_TYPES = { SENSOR_TYPES = {
'temperature': ['Temperature', ''], 'temperature': ['Temperature', ''],
'co2': ['CO2', 'ppm'], 'co2': ['CO2', 'ppm'],
@ -29,6 +30,8 @@ SENSOR_TYPES = {
'humidity': ['Humidity', '%'] 'humidity': ['Humidity', '%']
} }
CONF_SECRET_KEY = 'secret_key'
# Return cached results if last scan was less then this time ago # Return cached results if last scan was less then this time ago
# NetAtmo Data is uploaded to server every 10mn # NetAtmo Data is uploaded to server every 10mn
# so this time should not be under # so this time should not be under
@ -42,7 +45,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
{DOMAIN: [CONF_API_KEY, {DOMAIN: [CONF_API_KEY,
CONF_USERNAME, CONF_USERNAME,
CONF_PASSWORD, CONF_PASSWORD,
'secret_key']}, CONF_SECRET_KEY]},
_LOGGER): _LOGGER):
return None return None
@ -51,7 +54,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
SENSOR_TYPES['temperature'][1] = hass.config.temperature_unit SENSOR_TYPES['temperature'][1] = hass.config.temperature_unit
unit = hass.config.temperature_unit unit = hass.config.temperature_unit
authorization = lnetatmo.ClientAuth(config.get(CONF_API_KEY, None), authorization = lnetatmo.ClientAuth(config.get(CONF_API_KEY, None),
config.get('secret_key', None), config.get(CONF_SECRET_KEY, None),
config.get(CONF_USERNAME, None), config.get(CONF_USERNAME, None),
config.get(CONF_PASSWORD, None)) config.get(CONF_PASSWORD, None))