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