diff --git a/.travis.yml b/.travis.yml index f12d318b5d4..c0edf5976a7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,9 @@ sudo: false language: python -cache: - directories: - - $HOME/virtualenv/python$TRAVIS_PYTHON_VERSION/ +cache: pip python: - - 3.4.2 - - 3.5.0 + - 3.4 + - 3.5 install: - script/bootstrap_server script: diff --git a/homeassistant/bootstrap.py b/homeassistant/bootstrap.py index 41377aadebf..a7507fd12b8 100644 --- a/homeassistant/bootstrap.py +++ b/homeassistant/bootstrap.py @@ -275,7 +275,7 @@ def enable_logging(hass, verbose=False, daemon=False, log_rotate_days=None): datefmt='%y-%m-%d %H:%M:%S')) logger = logging.getLogger('') logger.addHandler(err_handler) - logger.setLevel(logging.INFO) # this sets the minimum log level + logger.setLevel(logging.NOTSET) # this sets the minimum log level else: _LOGGER.error( diff --git a/homeassistant/components/frontend/__init__.py b/homeassistant/components/frontend/__init__.py index 5c97d855713..fc955e30d44 100644 --- a/homeassistant/components/frontend/__init__.py +++ b/homeassistant/components/frontend/__init__.py @@ -79,6 +79,7 @@ def _handle_get_root(handler, path_match, data): def _handle_get_service_worker(handler, path_match, data): + """ Returns service worker for the frontend. """ if handler.server.development: sw_path = "home-assistant-polymer/build/service_worker.js" else: diff --git a/homeassistant/components/rollershutter/demo.py b/homeassistant/components/rollershutter/demo.py index a57bf4ddeec..4ffeb6be6dd 100644 --- a/homeassistant/components/rollershutter/demo.py +++ b/homeassistant/components/rollershutter/demo.py @@ -1,7 +1,7 @@ """ homeassistant.components.rollershutter.demo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Demo platform for rollorshutter component. +Demo platform for the rollorshutter component. """ from homeassistant.const import EVENT_TIME_CHANGED from homeassistant.helpers.event import track_utc_time_change @@ -9,7 +9,7 @@ from homeassistant.components.rollershutter import RollershutterDevice def setup_platform(hass, config, add_devices, discovery_info=None): - """ Sets up the Demo binary sensors. """ + """ Sets up the Demo rollershutters. """ add_devices([ DemoRollershutter(hass, 'Kitchen Window', 0), DemoRollershutter(hass, 'Living Room Window', 100), @@ -17,7 +17,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None): class DemoRollershutter(RollershutterDevice): - """ Represents a rollershutter within Home Assistant. """ + """ Represents a rollershutter.. """ # pylint: disable=no-self-use def __init__(self, hass, name, position): @@ -29,14 +29,17 @@ class DemoRollershutter(RollershutterDevice): @property def name(self): + """ Returns the name of the rollershutter. """ return self._name @property def should_poll(self): + """ No polling needed for a demo rollershutter. """ return False @property def current_position(self): + """ Returns the current position of the rollershutter. """ return self._position def move_up(self, **kwargs): @@ -62,11 +65,13 @@ class DemoRollershutter(RollershutterDevice): self._listener = None def _listen(self): + """ Listens for changes. """ if self._listener is None: self._listener = track_utc_time_change(self.hass, self._time_changed) def _time_changed(self, now): + """ Track time changes. """ if self._moving_up: self._position -= 10 else: diff --git a/homeassistant/components/sensor/arest.py b/homeassistant/components/sensor/arest.py index f1faa7cc932..3a0ce01719b 100644 --- a/homeassistant/components/sensor/arest.py +++ b/homeassistant/components/sensor/arest.py @@ -127,15 +127,14 @@ class ArestSensor(Entity): if 'error' in values: return values['error'] elif 'value' in values: - if self._corr_factor is not None \ - and self._decimal_places is not None: - return round((float(values['value']) * - float(self._corr_factor)), self._decimal_places) - elif self._corr_factor is not None \ - and self._decimal_places is None: - return round(float(values['value']) * float(self._corr_factor)) - else: - return values['value'] + value = values['value'] + if self._corr_factor is not None: + value = float(value) * float(self._corr_factor) + if self._decimal_places is not None: + value = round(value, self._decimal_places) + if self._decimal_places == 0: + value = int(value) + return value else: return values.get(self._variable, 'n/a') diff --git a/homeassistant/components/sensor/command_sensor.py b/homeassistant/components/sensor/command_sensor.py index b5beaab13d0..e60723f6bfa 100644 --- a/homeassistant/components/sensor/command_sensor.py +++ b/homeassistant/components/sensor/command_sensor.py @@ -35,8 +35,8 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None): data, config.get('name', DEFAULT_NAME), config.get('unit_of_measurement'), - config.get('correction_factor', 1.0), - config.get('decimal_places', 0) + config.get('correction_factor', None), + config.get('decimal_places', None) )]) @@ -49,7 +49,7 @@ class CommandSensor(Entity): self._name = name self._state = False self._unit_of_measurement = unit_of_measurement - self._corr_factor = float(corr_factor) + self._corr_factor = corr_factor self._decimal_places = decimal_places self.update() @@ -76,10 +76,12 @@ class CommandSensor(Entity): try: if value is not None: if self._corr_factor is not None: - self._state = round((float(value) * self._corr_factor), - self._decimal_places) - else: - self._state = value + value = float(value) * float(self._corr_factor) + if self._decimal_places is not None: + value = round(value, self._decimal_places) + if self._decimal_places == 0: + value = int(value) + self._state = value except ValueError: self._state = value diff --git a/homeassistant/components/sensor/mysensors.py b/homeassistant/components/sensor/mysensors.py index 7c8fbc47e2a..fb61173d8ee 100644 --- a/homeassistant/components/sensor/mysensors.py +++ b/homeassistant/components/sensor/mysensors.py @@ -76,7 +76,8 @@ def setup_platform(hass, config, add_devices, discovery_info=None): return False persistence = config.get(CONF_PERSISTENCE, True) - persistence_file = config.get(CONF_PERSISTENCE_FILE, 'mysensors.pickle') + persistence_file = config.get(CONF_PERSISTENCE_FILE, + hass.config.path('mysensors.pickle')) version = config.get(CONF_VERSION, '1.4') gateway = mysensors.SerialGateway(port, sensor_update, diff --git a/homeassistant/components/sensor/rest.py b/homeassistant/components/sensor/rest.py index 53609dbb237..f50113350da 100644 --- a/homeassistant/components/sensor/rest.py +++ b/homeassistant/components/sensor/rest.py @@ -136,18 +136,13 @@ class RestSensor(Entity): try: if value is not None: value = RestSensor.extract_value(value, self._variable) - if self._corr_factor is not None \ - and self._decimal_places is not None: - self._state = round( - (float(value) * - float(self._corr_factor)), - self._decimal_places) - elif self._corr_factor is not None \ - and self._decimal_places is None: - self._state = round(float(value) * - float(self._corr_factor)) - else: - self._state = value + if self._corr_factor is not None: + value = float(value) * float(self._corr_factor) + if self._decimal_places is not None: + value = round(value, self._decimal_places) + if self._decimal_places == 0: + value = int(value) + self._state = value except ValueError: self._state = RestSensor.extract_value(value, self._variable)