From 3508f74fb2b191f05e30e972e0496c6223beb503 Mon Sep 17 00:00:00 2001 From: Johan Bloemberg Date: Tue, 7 Mar 2017 23:20:27 +0100 Subject: [PATCH] Remove connection status state. (#6475) Current implementation of connection status doesn't follow convention and is not properly configurable. Might be added again in the future as a full fledged entity or some other way. For now users can rely on error logging to determine connection status. --- homeassistant/components/rflink.py | 9 --------- tests/components/test_rflink.py | 4 ---- 2 files changed, 13 deletions(-) diff --git a/homeassistant/components/rflink.py b/homeassistant/components/rflink.py index 10ccf32068f..5999957066f 100644 --- a/homeassistant/components/rflink.py +++ b/homeassistant/components/rflink.py @@ -152,9 +152,6 @@ def async_setup(hass, config): def connect(): """Set up connection and hook it into HA for reconnect/shutdown.""" _LOGGER.info('Initiating Rflink connection') - hass.states.async_set( - '{domain}.connection_status'.format( - domain=DOMAIN), 'connecting') # Rflink create_rflink_connection decides based on the value of host # (string or None) if serial or tcp mode should be used @@ -180,9 +177,6 @@ def async_setup(hass, config): _LOGGER.exception( "Error connecting to Rflink, reconnecting in %s", reconnect_interval) - hass.states.async_set( - '{domain}.connection_status'.format( - domain=DOMAIN), 'error') hass.loop.call_later(reconnect_interval, reconnect, exc) return @@ -195,9 +189,6 @@ def async_setup(hass, config): lambda x: transport.close()) _LOGGER.info('Connected to Rflink') - hass.states.async_set( - '{domain}.connection_status'.format( - domain=DOMAIN), 'connected') hass.async_add_job(connect) return True diff --git a/tests/components/test_rflink.py b/tests/components/test_rflink.py index 555ec9372ba..9a83644dcfd 100644 --- a/tests/components/test_rflink.py +++ b/tests/components/test_rflink.py @@ -205,15 +205,11 @@ def test_error_when_not_connected(hass, monkeypatch): _, mock_create, _, disconnect_callback = yield from mock_rflink( hass, config, domain, monkeypatch, failures=failures) - assert hass.states.get('rflink.connection_status').state == 'connected' - # rflink initiated disconnect disconnect_callback(None) yield from asyncio.sleep(0, loop=hass.loop) - assert hass.states.get('rflink.connection_status').state == 'error' - success = yield from hass.services.async_call( domain, SERVICE_TURN_OFF, {ATTR_ENTITY_ID: 'switch.test'}) assert not success, 'changing state should not succeed when disconnected'