diff --git a/homeassistant/components/updater.py b/homeassistant/components/updater.py index 40899af9803..515e5f431a5 100644 --- a/homeassistant/components/updater.py +++ b/homeassistant/components/updater.py @@ -61,8 +61,9 @@ def setup(hass, config): """Setup the updater component.""" if 'dev' in CURRENT_VERSION: # This component only makes sense in release versions - _LOGGER.warning('Updater not supported in development version') - return False + _LOGGER.warning(('Updater component enabled in dev. ' + 'You will not receive notifications of new ' + 'versions but analytics will be submitted.')) config = config.get(DOMAIN, {}) huuid = _load_uuid(hass) if config.get(CONF_REPORTING) else None @@ -80,12 +81,18 @@ def check_newest_version(hass, huuid): """Check if a new version is available and report if one is.""" newest, releasenotes = get_newest_version(huuid) - if newest is not None: - if StrictVersion(newest) > StrictVersion(CURRENT_VERSION): - hass.states.set( - ENTITY_ID, newest, {ATTR_FRIENDLY_NAME: 'Update Available', - ATTR_RELEASE_NOTES: releasenotes} - ) + if newest is None or 'dev' in CURRENT_VERSION: + return + + if StrictVersion(newest) > StrictVersion(CURRENT_VERSION): + _LOGGER.info('The latest available version is %s.', newest) + hass.states.set( + ENTITY_ID, newest, {ATTR_FRIENDLY_NAME: 'Update Available', + ATTR_RELEASE_NOTES: releasenotes} + ) + elif StrictVersion(newest) == StrictVersion(CURRENT_VERSION): + _LOGGER.info('You are on the latest version (%s) of Home Assistant.', + newest) def get_newest_version(huuid): @@ -95,7 +102,7 @@ def get_newest_version(huuid): 'os_name': platform.system(), "arch": platform.machine(), 'python_version': platform.python_version(), 'virtualenv': (os.environ.get('VIRTUAL_ENV') is not None), - 'docker': False} + 'docker': False, 'dev': ('dev' in CURRENT_VERSION)} if platform.system() == 'Windows': info_object['os_version'] = platform.win32_ver()[0] @@ -114,9 +121,8 @@ def get_newest_version(huuid): try: req = requests.post(UPDATER_URL, json=info_object) res = req.json() - _LOGGER.info(('The latest version is %s. ' - 'Information submitted includes %s'), - res['version'], info_object) + _LOGGER.info(('Submitted analytics to Home Assistant servers. ' + 'Information submitted includes %s'), info_object) return (res['version'], res['release-notes']) except requests.RequestException: _LOGGER.exception('Could not contact HASS Update to check for updates') diff --git a/tests/components/test_updater.py b/tests/components/test_updater.py index 7cc2ba8d962..94a43c1f281 100644 --- a/tests/components/test_updater.py +++ b/tests/components/test_updater.py @@ -89,15 +89,6 @@ class TestUpdater(unittest.TestCase): mock_get.side_effect = KeyError self.assertIsNone(updater.get_newest_version(uuid)) - def test_updater_disabled_on_dev(self): - """Test if the updater component is disabled on dev.""" - updater.CURRENT_VERSION = MOCK_CURRENT_VERSION + 'dev' - - with assert_setup_component(1) as config: - assert not setup_component( - self.hass, updater.DOMAIN, {updater.DOMAIN: {}}) - assert config['updater'] == {'reporting': True} - def test_uuid_function(self): """Test if the uuid function works.""" path = self.hass.config.path(updater.UPDATER_UUID_FILE)