From b7c336a687356c8f4f81bbfd2f1b53af7b94c250 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi>
Date: Mon, 23 Jul 2018 11:16:05 +0300
Subject: [PATCH] Pylint cleanups (#15626)

* Pylint 2 no-else-return fixes

* Remove unneeded abstract-class-not-used pylint disable
---
 .../alarm_control_panel/alarmdotcom.py        |  6 +--
 .../components/alarm_control_panel/arlo.py    |  6 +--
 .../components/alarm_control_panel/canary.py  |  4 +-
 .../alarm_control_panel/homematicip_cloud.py  |  2 +-
 .../components/alarm_control_panel/ifttt.py   |  2 +-
 .../components/alarm_control_panel/manual.py  |  2 +-
 .../alarm_control_panel/manual_mqtt.py        |  2 +-
 .../components/alarm_control_panel/mqtt.py    |  2 +-
 .../alarm_control_panel/simplisafe.py         |  2 +-
 homeassistant/components/alexa/smart_home.py  |  2 +-
 homeassistant/components/august.py            |  4 +-
 homeassistant/components/auth/__init__.py     |  2 +-
 .../components/automation/__init__.py         |  2 +-
 .../components/automation/homeassistant.py    |  2 +-
 .../components/binary_sensor/netatmo.py       |  2 +-
 .../components/binary_sensor/rachio.py        |  7 ++-
 .../components/binary_sensor/raincloud.py     |  2 +-
 .../components/binary_sensor/threshold.py     |  4 +-
 .../components/binary_sensor/volvooncall.py   |  2 +-
 .../components/binary_sensor/workday.py       |  4 +-
 .../components/binary_sensor/xiaomi_aqara.py  | 10 ++--
 homeassistant/components/camera/__init__.py   |  2 +-
 homeassistant/components/camera/amcrest.py    |  2 +-
 homeassistant/components/camera/axis.py       |  2 +-
 homeassistant/components/camera/netatmo.py    |  2 +-
 homeassistant/components/camera/uvc.py        |  7 ++-
 homeassistant/components/climate/ecobee.py    | 10 ++--
 homeassistant/components/climate/homematic.py |  2 +-
 homeassistant/components/climate/melissa.py   | 34 ++++++-------
 homeassistant/components/climate/nest.py      |  2 +-
 homeassistant/components/climate/netatmo.py   |  2 +-
 homeassistant/components/climate/proliphix.py |  4 +-
 homeassistant/components/climate/tuya.py      |  2 +-
 homeassistant/components/climate/venstar.py   |  6 +--
 homeassistant/components/climate/vera.py      | 10 ++--
 homeassistant/components/climate/wink.py      |  6 +--
 homeassistant/components/climate/zwave.py     |  2 +-
 homeassistant/components/cover/demo.py        |  4 +-
 homeassistant/components/cover/zwave.py       |  9 ++--
 .../components/deconz/config_flow.py          |  2 +-
 .../components/device_tracker/__init__.py     |  2 +-
 .../components/device_tracker/aruba.py        |  4 +-
 .../device_tracker/bt_home_hub_5.py           |  3 +-
 .../components/device_tracker/ddwrt.py        |  5 +-
 .../components/device_tracker/geofency.py     | 17 +++----
 .../components/device_tracker/locative.py     |  4 +-
 .../components/device_tracker/meraki.py       | 15 +++---
 .../components/device_tracker/sky_hub.py      |  3 +-
 .../components/device_tracker/tomato.py       |  2 +-
 .../components/google_assistant/trait.py      |  4 +-
 homeassistant/components/graphite.py          |  4 +-
 homeassistant/components/hassio/__init__.py   |  2 +-
 .../components/homekit/type_thermostats.py    |  3 +-
 homeassistant/components/homekit/util.py      |  6 +--
 .../homematicip_cloud/config_flow.py          |  3 +-
 homeassistant/components/http/auth.py         |  5 +-
 homeassistant/components/http/static.py       |  5 +-
 homeassistant/components/hue/config_flow.py   |  2 +-
 homeassistant/components/knx.py               |  2 +-
 homeassistant/components/light/abode.py       |  2 +-
 homeassistant/components/light/flux_led.py    |  2 +-
 homeassistant/components/logbook.py           |  6 +--
 .../components/media_player/anthemav.py       |  2 +-
 .../components/media_player/apple_tv.py       | 14 +++---
 .../components/media_player/bluesound.py      |  7 ++-
 .../components/media_player/braviatv.py       | 34 ++++++-------
 homeassistant/components/media_player/cast.py | 14 +++---
 .../components/media_player/channels.py       |  2 +-
 homeassistant/components/media_player/cmus.py |  2 +-
 .../components/media_player/denonavr.py       |  2 +-
 .../components/media_player/directv.py        |  2 +-
 homeassistant/components/media_player/emby.py | 16 +++---
 homeassistant/components/media_player/kodi.py |  2 +-
 .../components/media_player/liveboxplaytv.py  |  2 +-
 .../components/media_player/mpchc.py          |  2 +-
 homeassistant/components/media_player/mpd.py  | 10 ++--
 homeassistant/components/media_player/plex.py | 12 ++---
 homeassistant/components/media_player/roku.py | 14 +++---
 .../components/media_player/russound_rio.py   |  5 +-
 .../components/media_player/soundtouch.py     |  2 +-
 .../components/media_player/vizio.py          |  2 +-
 .../components/media_player/volumio.py        |  2 +-
 .../components/mysensors/__init__.py          |  5 +-
 homeassistant/components/mysensors/gateway.py |  6 +--
 homeassistant/components/nest/config_flow.py  |  6 +--
 homeassistant/components/netgear_lte.py       |  2 +-
 homeassistant/components/notify/html5.py      |  2 +-
 homeassistant/components/notify/rest.py       |  2 +-
 homeassistant/components/notify/telegram.py   |  6 +--
 homeassistant/components/notify/twitter.py    |  4 +-
 homeassistant/components/octoprint.py         |  2 +-
 homeassistant/components/rachio.py            |  3 +-
 homeassistant/components/recorder/__init__.py |  2 +-
 homeassistant/components/recorder/models.py   |  2 +-
 homeassistant/components/rflink.py            |  2 +-
 homeassistant/components/scene/lifx_cloud.py  |  2 +-
 homeassistant/components/sensor/abode.py      |  8 +--
 .../components/sensor/api_streams.py          |  4 +-
 homeassistant/components/sensor/arlo.py       |  2 +-
 homeassistant/components/sensor/buienradar.py | 14 +++---
 .../components/sensor/currencylayer.py        |  3 +-
 homeassistant/components/sensor/darksky.py    | 12 ++---
 homeassistant/components/sensor/dovado.py     |  9 ++--
 homeassistant/components/sensor/dsmr.py       |  4 +-
 .../components/sensor/eight_sleep.py          |  2 +-
 .../components/sensor/fritzbox_netmonitor.py  |  3 +-
 homeassistant/components/sensor/gpsd.py       |  2 +-
 .../components/sensor/history_stats.py        |  2 +-
 homeassistant/components/sensor/hive.py       |  2 +-
 homeassistant/components/sensor/isy994.py     |  6 +--
 homeassistant/components/sensor/mfi.py        |  6 +--
 .../components/sensor/mold_indicator.py       |  7 ++-
 homeassistant/components/sensor/moon.py       | 12 ++---
 homeassistant/components/sensor/nut.py        | 13 +++--
 homeassistant/components/sensor/octoprint.py  |  3 +-
 .../components/sensor/openhardwaremonitor.py  |  9 ++--
 homeassistant/components/sensor/qnap.py       |  2 +-
 homeassistant/components/sensor/snmp.py       |  9 ++--
 .../components/sensor/synologydsm.py          |  2 +-
 homeassistant/components/sensor/tado.py       |  6 +--
 homeassistant/components/sensor/tahoma.py     |  6 +--
 .../components/sensor/tellduslive.py          |  6 +--
 homeassistant/components/sensor/time_date.py  |  4 +-
 homeassistant/components/sensor/vera.py       |  8 +--
 .../components/sensor/volvooncall.py          |  2 +-
 .../components/sensor/worldtidesinfo.py       |  2 +-
 .../components/sensor/worxlandroid.py         |  6 +--
 .../components/sensor/xiaomi_aqara.py         |  4 +-
 homeassistant/components/sensor/zwave.py      |  4 +-
 homeassistant/components/switch/wemo.py       |  4 +-
 .../components/telegram_bot/__init__.py       |  2 +-
 .../components/telegram_bot/polling.py        |  3 +-
 homeassistant/components/tellduslive.py       | 10 ++--
 homeassistant/components/volvooncall.py       |  7 ++-
 homeassistant/components/wink/__init__.py     |  7 ++-
 homeassistant/components/zwave/util.py        |  2 +-
 homeassistant/config.py                       |  3 +-
 homeassistant/helpers/condition.py            |  4 +-
 homeassistant/helpers/config_validation.py    | 19 ++++---
 homeassistant/helpers/data_entry_flow.py      |  2 +-
 homeassistant/helpers/deprecation.py          |  3 +-
 homeassistant/helpers/event.py                |  6 +--
 homeassistant/helpers/script.py               |  4 +-
 homeassistant/helpers/service.py              |  8 ++-
 homeassistant/helpers/state.py                |  6 +--
 homeassistant/helpers/template.py             |  6 +--
 homeassistant/remote.py                       |  6 +--
 homeassistant/scripts/macos/__init__.py       |  4 +-
 homeassistant/setup.py                        |  4 +-
 homeassistant/util/__init__.py                |  2 +-
 homeassistant/util/dt.py                      |  4 +-
 homeassistant/util/temperature.py             |  2 +-
 homeassistant/util/yaml.py                    |  7 ++-
 pylintrc                                      |  2 -
 tests/common.py                               | 13 +++--
 tests/components/alexa/test_smart_home.py     |  2 +-
 tests/components/camera/test_uvc.py           |  3 +-
 .../components/device_tracker/test_tomato.py  |  4 +-
 .../components/device_tracker/test_xiaomi.py  | 11 ++--
 tests/components/light/test_hue.py            |  2 +-
 tests/components/notify/test_group.py         |  3 +-
 tests/components/recorder/models_original.py  |  5 +-
 tests/components/sensor/test_radarr.py        | 15 +++---
 tests/components/sensor/test_sonarr.py        | 19 ++++---
 tests/components/switch/test_flux.py          | 50 +++++++------------
 tests/components/test_graphite.py             |  7 ++-
 166 files changed, 428 insertions(+), 493 deletions(-)

diff --git a/homeassistant/components/alarm_control_panel/alarmdotcom.py b/homeassistant/components/alarm_control_panel/alarmdotcom.py
index 87e85f09da0..736334c956a 100644
--- a/homeassistant/components/alarm_control_panel/alarmdotcom.py
+++ b/homeassistant/components/alarm_control_panel/alarmdotcom.py
@@ -83,7 +83,7 @@ class AlarmDotCom(alarm.AlarmControlPanel):
         """Return one or more digits/characters."""
         if self._code is None:
             return None
-        elif isinstance(self._code, str) and re.search('^\\d+$', self._code):
+        if isinstance(self._code, str) and re.search('^\\d+$', self._code):
             return 'Number'
         return 'Any'
 
@@ -92,9 +92,9 @@ class AlarmDotCom(alarm.AlarmControlPanel):
         """Return the state of the device."""
         if self._alarm.state.lower() == 'disarmed':
             return STATE_ALARM_DISARMED
-        elif self._alarm.state.lower() == 'armed stay':
+        if self._alarm.state.lower() == 'armed stay':
             return STATE_ALARM_ARMED_HOME
-        elif self._alarm.state.lower() == 'armed away':
+        if self._alarm.state.lower() == 'armed away':
             return STATE_ALARM_ARMED_AWAY
         return STATE_UNKNOWN
 
diff --git a/homeassistant/components/alarm_control_panel/arlo.py b/homeassistant/components/alarm_control_panel/arlo.py
index 20887157cb4..0f8913f85a0 100644
--- a/homeassistant/components/alarm_control_panel/arlo.py
+++ b/homeassistant/components/alarm_control_panel/arlo.py
@@ -122,10 +122,10 @@ class ArloBaseStation(AlarmControlPanel):
         """Convert Arlo mode to Home Assistant state."""
         if mode == ARMED:
             return STATE_ALARM_ARMED_AWAY
-        elif mode == DISARMED:
+        if mode == DISARMED:
             return STATE_ALARM_DISARMED
-        elif mode == self._home_mode_name:
+        if mode == self._home_mode_name:
             return STATE_ALARM_ARMED_HOME
-        elif mode == self._away_mode_name:
+        if mode == self._away_mode_name:
             return STATE_ALARM_ARMED_AWAY
         return mode
diff --git a/homeassistant/components/alarm_control_panel/canary.py b/homeassistant/components/alarm_control_panel/canary.py
index 2e0e9994e10..3cd44dcc84c 100644
--- a/homeassistant/components/alarm_control_panel/canary.py
+++ b/homeassistant/components/alarm_control_panel/canary.py
@@ -55,9 +55,9 @@ class CanaryAlarm(AlarmControlPanel):
         mode = location.mode
         if mode.name == LOCATION_MODE_AWAY:
             return STATE_ALARM_ARMED_AWAY
-        elif mode.name == LOCATION_MODE_HOME:
+        if mode.name == LOCATION_MODE_HOME:
             return STATE_ALARM_ARMED_HOME
-        elif mode.name == LOCATION_MODE_NIGHT:
+        if mode.name == LOCATION_MODE_NIGHT:
             return STATE_ALARM_ARMED_NIGHT
         return None
 
diff --git a/homeassistant/components/alarm_control_panel/homematicip_cloud.py b/homeassistant/components/alarm_control_panel/homematicip_cloud.py
index 43cb4494978..79f872951db 100644
--- a/homeassistant/components/alarm_control_panel/homematicip_cloud.py
+++ b/homeassistant/components/alarm_control_panel/homematicip_cloud.py
@@ -66,7 +66,7 @@ class HomematicipSecurityZone(HomematicipGenericDevice, AlarmControlPanel):
             active = self._home.get_security_zones_activation()
             if active == (True, True):
                 return STATE_ALARM_ARMED_AWAY
-            elif active == (False, True):
+            if active == (False, True):
                 return STATE_ALARM_ARMED_HOME
 
         return STATE_ALARM_DISARMED
diff --git a/homeassistant/components/alarm_control_panel/ifttt.py b/homeassistant/components/alarm_control_panel/ifttt.py
index 209c5367c92..9941f70a2e4 100644
--- a/homeassistant/components/alarm_control_panel/ifttt.py
+++ b/homeassistant/components/alarm_control_panel/ifttt.py
@@ -128,7 +128,7 @@ class IFTTTAlarmPanel(alarm.AlarmControlPanel):
         """Return one or more digits/characters."""
         if self._code is None:
             return None
-        elif isinstance(self._code, str) and re.search('^\\d+$', self._code):
+        if isinstance(self._code, str) and re.search('^\\d+$', self._code):
             return 'Number'
         return 'Any'
 
diff --git a/homeassistant/components/alarm_control_panel/manual.py b/homeassistant/components/alarm_control_panel/manual.py
index 2f2f89b9dfc..b2b7c45d410 100644
--- a/homeassistant/components/alarm_control_panel/manual.py
+++ b/homeassistant/components/alarm_control_panel/manual.py
@@ -205,7 +205,7 @@ class ManualAlarm(alarm.AlarmControlPanel):
         """Return one or more digits/characters."""
         if self._code is None:
             return None
-        elif isinstance(self._code, str) and re.search('^\\d+$', self._code):
+        if isinstance(self._code, str) and re.search('^\\d+$', self._code):
             return 'Number'
         return 'Any'
 
diff --git a/homeassistant/components/alarm_control_panel/manual_mqtt.py b/homeassistant/components/alarm_control_panel/manual_mqtt.py
index e313f96fb7c..942d0dc159a 100644
--- a/homeassistant/components/alarm_control_panel/manual_mqtt.py
+++ b/homeassistant/components/alarm_control_panel/manual_mqtt.py
@@ -241,7 +241,7 @@ class ManualMQTTAlarm(alarm.AlarmControlPanel):
         """Return one or more digits/characters."""
         if self._code is None:
             return None
-        elif isinstance(self._code, str) and re.search('^\\d+$', self._code):
+        if isinstance(self._code, str) and re.search('^\\d+$', self._code):
             return 'Number'
         return 'Any'
 
diff --git a/homeassistant/components/alarm_control_panel/mqtt.py b/homeassistant/components/alarm_control_panel/mqtt.py
index d6198301d76..c5408304018 100644
--- a/homeassistant/components/alarm_control_panel/mqtt.py
+++ b/homeassistant/components/alarm_control_panel/mqtt.py
@@ -123,7 +123,7 @@ class MqttAlarm(MqttAvailability, alarm.AlarmControlPanel):
         """Return one or more digits/characters."""
         if self._code is None:
             return None
-        elif isinstance(self._code, str) and re.search('^\\d+$', self._code):
+        if isinstance(self._code, str) and re.search('^\\d+$', self._code):
             return 'Number'
         return 'Any'
 
diff --git a/homeassistant/components/alarm_control_panel/simplisafe.py b/homeassistant/components/alarm_control_panel/simplisafe.py
index f818df4bd71..b400a927b5e 100644
--- a/homeassistant/components/alarm_control_panel/simplisafe.py
+++ b/homeassistant/components/alarm_control_panel/simplisafe.py
@@ -82,7 +82,7 @@ class SimpliSafeAlarm(AlarmControlPanel):
         """Return one or more digits/characters."""
         if self._code is None:
             return None
-        elif isinstance(self._code, str) and re.search('^\\d+$', self._code):
+        if isinstance(self._code, str) and re.search('^\\d+$', self._code):
             return 'Number'
         return 'Any'
 
diff --git a/homeassistant/components/alexa/smart_home.py b/homeassistant/components/alexa/smart_home.py
index 80fa4ccb4bf..042d878fceb 100644
--- a/homeassistant/components/alexa/smart_home.py
+++ b/homeassistant/components/alexa/smart_home.py
@@ -315,7 +315,7 @@ class _AlexaLockController(_AlexaInterface):
 
         if self.entity.state == STATE_LOCKED:
             return 'LOCKED'
-        elif self.entity.state == STATE_UNLOCKED:
+        if self.entity.state == STATE_UNLOCKED:
             return 'UNLOCKED'
         return 'JAMMED'
 
diff --git a/homeassistant/components/august.py b/homeassistant/components/august.py
index 2a7da86c6cf..eb25ee8fb08 100644
--- a/homeassistant/components/august.py
+++ b/homeassistant/components/august.py
@@ -123,9 +123,9 @@ def setup_august(hass, config, api, authenticator):
             discovery.load_platform(hass, component, DOMAIN, {}, config)
 
         return True
-    elif state == AuthenticationState.BAD_PASSWORD:
+    if state == AuthenticationState.BAD_PASSWORD:
         return False
-    elif state == AuthenticationState.REQUIRES_VALIDATION:
+    if state == AuthenticationState.REQUIRES_VALIDATION:
         request_configuration(hass, config, api, authenticator)
         return True
 
diff --git a/homeassistant/components/auth/__init__.py b/homeassistant/components/auth/__init__.py
index 435555c2e31..3eac6a370d2 100644
--- a/homeassistant/components/auth/__init__.py
+++ b/homeassistant/components/auth/__init__.py
@@ -264,7 +264,7 @@ class GrantTokenView(HomeAssistantView):
         if grant_type == 'authorization_code':
             return await self._async_handle_auth_code(hass, client_id, data)
 
-        elif grant_type == 'refresh_token':
+        if grant_type == 'refresh_token':
             return await self._async_handle_refresh_token(
                 hass, client_id, data)
 
diff --git a/homeassistant/components/automation/__init__.py b/homeassistant/components/automation/__init__.py
index 2a7a3887b34..8b1cd3cad84 100644
--- a/homeassistant/components/automation/__init__.py
+++ b/homeassistant/components/automation/__init__.py
@@ -297,7 +297,7 @@ class AutomationEntity(ToggleEntity):
             return
 
         # HomeAssistant is starting up
-        elif self.hass.state == CoreState.not_running:
+        if self.hass.state == CoreState.not_running:
             @asyncio.coroutine
             def async_enable_automation(event):
                 """Start automation on startup."""
diff --git a/homeassistant/components/automation/homeassistant.py b/homeassistant/components/automation/homeassistant.py
index 6b8ee577a09..74cf195bc61 100644
--- a/homeassistant/components/automation/homeassistant.py
+++ b/homeassistant/components/automation/homeassistant.py
@@ -44,7 +44,7 @@ def async_trigger(hass, config, action):
 
     # Automation are enabled while hass is starting up, fire right away
     # Check state because a config reload shouldn't trigger it.
-    elif hass.state == CoreState.starting:
+    if hass.state == CoreState.starting:
         hass.async_run_job(action, {
             'trigger': {
                 'platform': 'homeassistant',
diff --git a/homeassistant/components/binary_sensor/netatmo.py b/homeassistant/components/binary_sensor/netatmo.py
index 7c3a3e1dd30..73a373a15ff 100644
--- a/homeassistant/components/binary_sensor/netatmo.py
+++ b/homeassistant/components/binary_sensor/netatmo.py
@@ -142,7 +142,7 @@ class NetatmoBinarySensor(BinarySensorDevice):
         """Return the class of this sensor, from DEVICE_CLASSES."""
         if self._cameratype == 'NACamera':
             return WELCOME_SENSOR_TYPES.get(self._sensor_name)
-        elif self._cameratype == 'NOC':
+        if self._cameratype == 'NOC':
             return PRESENCE_SENSOR_TYPES.get(self._sensor_name)
         return TAG_SENSOR_TYPES.get(self._sensor_name)
 
diff --git a/homeassistant/components/binary_sensor/rachio.py b/homeassistant/components/binary_sensor/rachio.py
index cc3079c6e53..59bf8a21064 100644
--- a/homeassistant/components/binary_sensor/rachio.py
+++ b/homeassistant/components/binary_sensor/rachio.py
@@ -111,11 +111,10 @@ class RachioControllerOnlineBinarySensor(RachioControllerBinarySensor):
 
         if data[KEY_STATUS] == STATUS_ONLINE:
             return True
-        elif data[KEY_STATUS] == STATUS_OFFLINE:
+        if data[KEY_STATUS] == STATUS_OFFLINE:
             return False
-        else:
-            _LOGGER.warning('"%s" reported in unknown state "%s"', self.name,
-                            data[KEY_STATUS])
+        _LOGGER.warning('"%s" reported in unknown state "%s"', self.name,
+                        data[KEY_STATUS])
 
     def _handle_update(self, *args, **kwargs) -> None:
         """Handle an update to the state of this sensor."""
diff --git a/homeassistant/components/binary_sensor/raincloud.py b/homeassistant/components/binary_sensor/raincloud.py
index 288b46c2370..3cbd179154f 100644
--- a/homeassistant/components/binary_sensor/raincloud.py
+++ b/homeassistant/components/binary_sensor/raincloud.py
@@ -67,6 +67,6 @@ class RainCloudBinarySensor(RainCloudEntity, BinarySensorDevice):
         """Return the icon of this device."""
         if self._sensor_type == 'is_watering':
             return 'mdi:water' if self.is_on else 'mdi:water-off'
-        elif self._sensor_type == 'status':
+        if self._sensor_type == 'status':
             return 'mdi:pipe' if self.is_on else 'mdi:pipe-disconnected'
         return ICON_MAP.get(self._sensor_type)
diff --git a/homeassistant/components/binary_sensor/threshold.py b/homeassistant/components/binary_sensor/threshold.py
index 79c36fb2ef2..360671d1cea 100644
--- a/homeassistant/components/binary_sensor/threshold.py
+++ b/homeassistant/components/binary_sensor/threshold.py
@@ -129,9 +129,9 @@ class ThresholdSensor(BinarySensorDevice):
         if self._threshold_lower is not None and \
                 self._threshold_upper is not None:
             return TYPE_RANGE
-        elif self._threshold_lower is not None:
+        if self._threshold_lower is not None:
             return TYPE_LOWER
-        elif self._threshold_upper is not None:
+        if self._threshold_upper is not None:
             return TYPE_UPPER
 
     @property
diff --git a/homeassistant/components/binary_sensor/volvooncall.py b/homeassistant/components/binary_sensor/volvooncall.py
index 39f520ddc6d..402feefa99f 100644
--- a/homeassistant/components/binary_sensor/volvooncall.py
+++ b/homeassistant/components/binary_sensor/volvooncall.py
@@ -28,7 +28,7 @@ class VolvoSensor(VolvoEntity, BinarySensorDevice):
         val = getattr(self.vehicle, self._attribute)
         if self._attribute == 'bulb_failures':
             return bool(val)
-        elif self._attribute in ['doors', 'windows']:
+        if self._attribute in ['doors', 'windows']:
             return any([val[key] for key in val if 'Open' in key])
         return val != 'Normal'
 
diff --git a/homeassistant/components/binary_sensor/workday.py b/homeassistant/components/binary_sensor/workday.py
index b37be3f6cb6..00d2a95e356 100644
--- a/homeassistant/components/binary_sensor/workday.py
+++ b/homeassistant/components/binary_sensor/workday.py
@@ -135,7 +135,7 @@ class IsWorkdaySensor(BinarySensorDevice):
         """Check if given day is in the includes list."""
         if day in self._workdays:
             return True
-        elif 'holiday' in self._workdays and now in self._obj_holidays:
+        if 'holiday' in self._workdays and now in self._obj_holidays:
             return True
 
         return False
@@ -144,7 +144,7 @@ class IsWorkdaySensor(BinarySensorDevice):
         """Check if given day is in the excludes list."""
         if day in self._excludes:
             return True
-        elif 'holiday' in self._excludes and now in self._obj_holidays:
+        if 'holiday' in self._excludes and now in self._obj_holidays:
             return True
 
         return False
diff --git a/homeassistant/components/binary_sensor/xiaomi_aqara.py b/homeassistant/components/binary_sensor/xiaomi_aqara.py
index be5d9a689d1..2a9746b4a01 100644
--- a/homeassistant/components/binary_sensor/xiaomi_aqara.py
+++ b/homeassistant/components/binary_sensor/xiaomi_aqara.py
@@ -124,7 +124,7 @@ class XiaomiNatgasSensor(XiaomiBinarySensor):
                 return False
             self._state = True
             return True
-        elif value == '0':
+        if value == '0':
             if self._state:
                 self._state = False
                 return True
@@ -184,7 +184,7 @@ class XiaomiMotionSensor(XiaomiBinarySensor):
                 return False
             self._state = True
             return True
-        elif value == NO_MOTION:
+        if value == NO_MOTION:
             if not self._state:
                 return False
             self._state = False
@@ -224,7 +224,7 @@ class XiaomiDoorSensor(XiaomiBinarySensor):
                 return False
             self._state = True
             return True
-        elif value == 'close':
+        if value == 'close':
             self._open_since = 0
             if self._state:
                 self._state = False
@@ -254,7 +254,7 @@ class XiaomiWaterLeakSensor(XiaomiBinarySensor):
                 return False
             self._state = True
             return True
-        elif value == 'no_leak':
+        if value == 'no_leak':
             if self._state:
                 self._state = False
                 return True
@@ -290,7 +290,7 @@ class XiaomiSmokeSensor(XiaomiBinarySensor):
                 return False
             self._state = True
             return True
-        elif value == '0':
+        if value == '0':
             if self._state:
                 self._state = False
                 return True
diff --git a/homeassistant/components/camera/__init__.py b/homeassistant/components/camera/__init__.py
index 22354b51956..e84377ee419 100644
--- a/homeassistant/components/camera/__init__.py
+++ b/homeassistant/components/camera/__init__.py
@@ -342,7 +342,7 @@ class Camera(Entity):
         """Return the camera state."""
         if self.is_recording:
             return STATE_RECORDING
-        elif self.is_streaming:
+        if self.is_streaming:
             return STATE_STREAMING
         return STATE_IDLE
 
diff --git a/homeassistant/components/camera/amcrest.py b/homeassistant/components/camera/amcrest.py
index 3c63e56b319..4cb218bc019 100644
--- a/homeassistant/components/camera/amcrest.py
+++ b/homeassistant/components/camera/amcrest.py
@@ -64,7 +64,7 @@ class AmcrestCam(Camera):
             yield from super().handle_async_mjpeg_stream(request)
             return
 
-        elif self._stream_source == STREAM_SOURCE_LIST['mjpeg']:
+        if self._stream_source == STREAM_SOURCE_LIST['mjpeg']:
             # stream an MJPEG image stream directly from the camera
             websession = async_get_clientsession(self.hass)
             streaming_url = self._camera.mjpeg_url(typeno=self._resolution)
diff --git a/homeassistant/components/camera/axis.py b/homeassistant/components/camera/axis.py
index 51c3bc89b05..5b39718939a 100644
--- a/homeassistant/components/camera/axis.py
+++ b/homeassistant/components/camera/axis.py
@@ -23,7 +23,7 @@ def _get_image_url(host, port, mode):
     """Set the URL to get the image."""
     if mode == 'mjpeg':
         return 'http://{}:{}/axis-cgi/mjpg/video.cgi'.format(host, port)
-    elif mode == 'single':
+    if mode == 'single':
         return 'http://{}:{}/axis-cgi/jpg/image.cgi'.format(host, port)
 
 
diff --git a/homeassistant/components/camera/netatmo.py b/homeassistant/components/camera/netatmo.py
index 34a78e19f9f..1c7dc4c7ce0 100644
--- a/homeassistant/components/camera/netatmo.py
+++ b/homeassistant/components/camera/netatmo.py
@@ -105,6 +105,6 @@ class NetatmoCamera(Camera):
         """Return the camera model."""
         if self._cameratype == "NOC":
             return "Presence"
-        elif self._cameratype == "NACamera":
+        if self._cameratype == "NACamera":
             return "Welcome"
         return None
diff --git a/homeassistant/components/camera/uvc.py b/homeassistant/components/camera/uvc.py
index e992020e2b2..b5306c31c84 100644
--- a/homeassistant/components/camera/uvc.py
+++ b/homeassistant/components/camera/uvc.py
@@ -171,10 +171,9 @@ class UnifiVideoCamera(Camera):
                 if retry:
                     self._login()
                     return _get_image(retry=False)
-                else:
-                    _LOGGER.error(
-                        "Unable to log into camera, unable to get snapshot")
-                    raise
+                _LOGGER.error(
+                    "Unable to log into camera, unable to get snapshot")
+                raise
 
         return _get_image()
 
diff --git a/homeassistant/components/climate/ecobee.py b/homeassistant/components/climate/ecobee.py
index e64c2d5000e..71878827153 100644
--- a/homeassistant/components/climate/ecobee.py
+++ b/homeassistant/components/climate/ecobee.py
@@ -177,7 +177,7 @@ class Thermostat(ClimateDevice):
             return None
         if self.current_operation == STATE_HEAT:
             return self.thermostat['runtime']['desiredHeat'] / 10.0
-        elif self.current_operation == STATE_COOL:
+        if self.current_operation == STATE_COOL:
             return self.thermostat['runtime']['desiredCool'] / 10.0
         return None
 
@@ -217,15 +217,15 @@ class Thermostat(ClimateDevice):
                             return 'away'
                         # A permanent hold from away climate
                         return AWAY_MODE
-                    elif event['holdClimateRef'] != "":
+                    if event['holdClimateRef'] != "":
                         # Any other hold based on climate
                         return event['holdClimateRef']
                     # Any hold not based on a climate is a temp hold
                     return TEMPERATURE_HOLD
-                elif event['type'].startswith('auto'):
+                if event['type'].startswith('auto'):
                     # All auto modes are treated as holds
                     return event['type'][4:].lower()
-                elif event['type'] == 'vacation':
+                if event['type'] == 'vacation':
                     self.vacation = event['name']
                     return VACATION_HOLD
         return None
@@ -317,7 +317,7 @@ class Thermostat(ClimateDevice):
         if hold == hold_mode:
             # no change, so no action required
             return
-        elif hold_mode == 'None' or hold_mode is None:
+        if hold_mode == 'None' or hold_mode is None:
             if hold == VACATION_HOLD:
                 self.data.ecobee.delete_vacation(
                     self.thermostat_index, self.vacation)
diff --git a/homeassistant/components/climate/homematic.py b/homeassistant/components/climate/homematic.py
index b8fb7a984fa..a2725f6f3aa 100644
--- a/homeassistant/components/climate/homematic.py
+++ b/homeassistant/components/climate/homematic.py
@@ -87,7 +87,7 @@ class HMThermostat(HMDevice, ClimateDevice):
 
         # HM ip etrv 2 uses the set_point_mode to say if its
         # auto or manual
-        elif not set_point_mode == -1:
+        if not set_point_mode == -1:
             code = set_point_mode
         # Other devices use the control_mode
         else:
diff --git a/homeassistant/components/climate/melissa.py b/homeassistant/components/climate/melissa.py
index 9c005b62dcc..a0adc12bfbf 100644
--- a/homeassistant/components/climate/melissa.py
+++ b/homeassistant/components/climate/melissa.py
@@ -192,9 +192,9 @@ class MelissaClimate(ClimateDevice):
         """Translate Melissa states to hass states."""
         if state == self._api.STATE_ON:
             return STATE_ON
-        elif state == self._api.STATE_OFF:
+        if state == self._api.STATE_OFF:
             return STATE_OFF
-        elif state == self._api.STATE_IDLE:
+        if state == self._api.STATE_IDLE:
             return STATE_IDLE
         return None
 
@@ -202,11 +202,11 @@ class MelissaClimate(ClimateDevice):
         """Translate Melissa modes to hass states."""
         if mode == self._api.MODE_HEAT:
             return STATE_HEAT
-        elif mode == self._api.MODE_COOL:
+        if mode == self._api.MODE_COOL:
             return STATE_COOL
-        elif mode == self._api.MODE_DRY:
+        if mode == self._api.MODE_DRY:
             return STATE_DRY
-        elif mode == self._api.MODE_FAN:
+        if mode == self._api.MODE_FAN:
             return STATE_FAN_ONLY
         _LOGGER.warning(
             "Operation mode %s could not be mapped to hass", mode)
@@ -216,11 +216,11 @@ class MelissaClimate(ClimateDevice):
         """Translate Melissa fan modes to hass modes."""
         if fan == self._api.FAN_AUTO:
             return STATE_AUTO
-        elif fan == self._api.FAN_LOW:
+        if fan == self._api.FAN_LOW:
             return SPEED_LOW
-        elif fan == self._api.FAN_MEDIUM:
+        if fan == self._api.FAN_MEDIUM:
             return SPEED_MEDIUM
-        elif fan == self._api.FAN_HIGH:
+        if fan == self._api.FAN_HIGH:
             return SPEED_HIGH
         _LOGGER.warning("Fan mode %s could not be mapped to hass", fan)
         return None
@@ -229,24 +229,22 @@ class MelissaClimate(ClimateDevice):
         """Translate hass states to melissa modes."""
         if mode == STATE_HEAT:
             return self._api.MODE_HEAT
-        elif mode == STATE_COOL:
+        if mode == STATE_COOL:
             return self._api.MODE_COOL
-        elif mode == STATE_DRY:
+        if mode == STATE_DRY:
             return self._api.MODE_DRY
-        elif mode == STATE_FAN_ONLY:
+        if mode == STATE_FAN_ONLY:
             return self._api.MODE_FAN
-        else:
-            _LOGGER.warning("Melissa have no setting for %s mode", mode)
+        _LOGGER.warning("Melissa have no setting for %s mode", mode)
 
     def hass_fan_to_melissa(self, fan):
         """Translate hass fan modes to melissa modes."""
         if fan == STATE_AUTO:
             return self._api.FAN_AUTO
-        elif fan == SPEED_LOW:
+        if fan == SPEED_LOW:
             return self._api.FAN_LOW
-        elif fan == SPEED_MEDIUM:
+        if fan == SPEED_MEDIUM:
             return self._api.FAN_MEDIUM
-        elif fan == SPEED_HIGH:
+        if fan == SPEED_HIGH:
             return self._api.FAN_HIGH
-        else:
-            _LOGGER.warning("Melissa have no setting for %s fan mode", fan)
+        _LOGGER.warning("Melissa have no setting for %s fan mode", fan)
diff --git a/homeassistant/components/climate/nest.py b/homeassistant/components/climate/nest.py
index dc1f74613bc..fa3943c3e27 100644
--- a/homeassistant/components/climate/nest.py
+++ b/homeassistant/components/climate/nest.py
@@ -147,7 +147,7 @@ class NestThermostat(ClimateDevice):
         """Return current operation ie. heat, cool, idle."""
         if self._mode in [STATE_HEAT, STATE_COOL, STATE_OFF, STATE_ECO]:
             return self._mode
-        elif self._mode == NEST_MODE_HEAT_COOL:
+        if self._mode == NEST_MODE_HEAT_COOL:
             return STATE_AUTO
         return STATE_UNKNOWN
 
diff --git a/homeassistant/components/climate/netatmo.py b/homeassistant/components/climate/netatmo.py
index 431834151fd..b4bed367878 100644
--- a/homeassistant/components/climate/netatmo.py
+++ b/homeassistant/components/climate/netatmo.py
@@ -99,7 +99,7 @@ class NetatmoThermostat(ClimateDevice):
         state = self._data.thermostatdata.relay_cmd
         if state == 0:
             return STATE_IDLE
-        elif state == 100:
+        if state == 100:
             return STATE_HEAT
 
     @property
diff --git a/homeassistant/components/climate/proliphix.py b/homeassistant/components/climate/proliphix.py
index 34fcfd667b6..9338c219fe5 100644
--- a/homeassistant/components/climate/proliphix.py
+++ b/homeassistant/components/climate/proliphix.py
@@ -102,9 +102,9 @@ class ProliphixThermostat(ClimateDevice):
         state = self._pdp.hvac_state
         if state in (1, 2):
             return STATE_IDLE
-        elif state == 3:
+        if state == 3:
             return STATE_HEAT
-        elif state == 6:
+        if state == 6:
             return STATE_COOL
 
     def set_temperature(self, **kwargs):
diff --git a/homeassistant/components/climate/tuya.py b/homeassistant/components/climate/tuya.py
index 9a114c243b6..19267d693a0 100644
--- a/homeassistant/components/climate/tuya.py
+++ b/homeassistant/components/climate/tuya.py
@@ -87,7 +87,7 @@ class TuyaClimateDevice(TuyaDevice, ClimateDevice):
         unit = self.tuya.temperature_unit()
         if unit == 'CELSIUS':
             return TEMP_CELSIUS
-        elif unit == 'FAHRENHEIT':
+        if unit == 'FAHRENHEIT':
             return TEMP_FAHRENHEIT
         return TEMP_CELSIUS
 
diff --git a/homeassistant/components/climate/venstar.py b/homeassistant/components/climate/venstar.py
index c2b82e1cc84..4bacf64cf9e 100644
--- a/homeassistant/components/climate/venstar.py
+++ b/homeassistant/components/climate/venstar.py
@@ -152,9 +152,9 @@ class VenstarThermostat(ClimateDevice):
         """Return current operation ie. heat, cool, idle."""
         if self._client.mode == self._client.MODE_HEAT:
             return STATE_HEAT
-        elif self._client.mode == self._client.MODE_COOL:
+        if self._client.mode == self._client.MODE_COOL:
             return STATE_COOL
-        elif self._client.mode == self._client.MODE_AUTO:
+        if self._client.mode == self._client.MODE_AUTO:
             return STATE_AUTO
         return STATE_OFF
 
@@ -178,7 +178,7 @@ class VenstarThermostat(ClimateDevice):
         """Return the target temperature we try to reach."""
         if self._client.mode == self._client.MODE_HEAT:
             return self._client.heattemp
-        elif self._client.mode == self._client.MODE_COOL:
+        if self._client.mode == self._client.MODE_COOL:
             return self._client.cooltemp
         return None
 
diff --git a/homeassistant/components/climate/vera.py b/homeassistant/components/climate/vera.py
index 4deb4d9ea2e..0f89b15e5a1 100644
--- a/homeassistant/components/climate/vera.py
+++ b/homeassistant/components/climate/vera.py
@@ -55,11 +55,11 @@ class VeraThermostat(VeraDevice, ClimateDevice):
         mode = self.vera_device.get_hvac_mode()
         if mode == 'HeatOn':
             return OPERATION_LIST[0]  # heat
-        elif mode == 'CoolOn':
+        if mode == 'CoolOn':
             return OPERATION_LIST[1]  # cool
-        elif mode == 'AutoChangeOver':
+        if mode == 'AutoChangeOver':
             return OPERATION_LIST[2]  # auto
-        elif mode == 'Off':
+        if mode == 'Off':
             return OPERATION_LIST[3]  # off
         return 'Off'
 
@@ -74,9 +74,9 @@ class VeraThermostat(VeraDevice, ClimateDevice):
         mode = self.vera_device.get_fan_mode()
         if mode == "ContinuousOn":
             return FAN_OPERATION_LIST[0]  # on
-        elif mode == "Auto":
+        if mode == "Auto":
             return FAN_OPERATION_LIST[1]  # auto
-        elif mode == "PeriodicOn":
+        if mode == "PeriodicOn":
             return FAN_OPERATION_LIST[2]  # cycle
         return "Auto"
 
diff --git a/homeassistant/components/climate/wink.py b/homeassistant/components/climate/wink.py
index 12a6960f833..15e555db8b9 100644
--- a/homeassistant/components/climate/wink.py
+++ b/homeassistant/components/climate/wink.py
@@ -224,7 +224,7 @@ class WinkThermostat(WinkDevice, ClimateDevice):
         if self.current_operation != STATE_AUTO and not self.is_away_mode_on:
             if self.current_operation == STATE_COOL:
                 return self.wink.current_max_set_point()
-            elif self.current_operation == STATE_HEAT:
+            if self.current_operation == STATE_HEAT:
                 return self.wink.current_min_set_point()
         return None
 
@@ -311,7 +311,7 @@ class WinkThermostat(WinkDevice, ClimateDevice):
         """Return whether the fan is on."""
         if self.wink.current_fan_mode() == 'on':
             return STATE_ON
-        elif self.wink.current_fan_mode() == 'auto':
+        if self.wink.current_fan_mode() == 'auto':
             return STATE_AUTO
         # No Fan available so disable slider
         return None
@@ -483,7 +483,7 @@ class WinkAC(WinkDevice, ClimateDevice):
         speed = self.wink.current_fan_speed()
         if speed <= 0.33:
             return SPEED_LOW
-        elif speed <= 0.66:
+        if speed <= 0.66:
             return SPEED_MEDIUM
         return SPEED_HIGH
 
diff --git a/homeassistant/components/climate/zwave.py b/homeassistant/components/climate/zwave.py
index b1dcacb5654..f87f2e83f5d 100644
--- a/homeassistant/components/climate/zwave.py
+++ b/homeassistant/components/climate/zwave.py
@@ -186,7 +186,7 @@ class ZWaveClimate(ZWaveDeviceEntity, ClimateDevice):
         """Return the unit of measurement."""
         if self._unit == 'C':
             return TEMP_CELSIUS
-        elif self._unit == 'F':
+        if self._unit == 'F':
             return TEMP_FAHRENHEIT
         return self._unit
 
diff --git a/homeassistant/components/cover/demo.py b/homeassistant/components/cover/demo.py
index b1533bd68c8..b81ac4e45e1 100644
--- a/homeassistant/components/cover/demo.py
+++ b/homeassistant/components/cover/demo.py
@@ -97,7 +97,7 @@ class DemoCover(CoverDevice):
         """Close the cover."""
         if self._position == 0:
             return
-        elif self._position is None:
+        if self._position is None:
             self._closed = True
             self.schedule_update_ha_state()
             return
@@ -119,7 +119,7 @@ class DemoCover(CoverDevice):
         """Open the cover."""
         if self._position == 100:
             return
-        elif self._position is None:
+        if self._position is None:
             self._closed = False
             self.schedule_update_ha_state()
             return
diff --git a/homeassistant/components/cover/zwave.py b/homeassistant/components/cover/zwave.py
index d5de8863543..8c8c88ecb87 100644
--- a/homeassistant/components/cover/zwave.py
+++ b/homeassistant/components/cover/zwave.py
@@ -27,11 +27,10 @@ def get_device(hass, values, node_config, **kwargs):
             zwave.const.COMMAND_CLASS_SWITCH_MULTILEVEL
             and values.primary.index == 0):
         return ZwaveRollershutter(hass, values, invert_buttons)
-    elif (values.primary.command_class ==
-          zwave.const.COMMAND_CLASS_SWITCH_BINARY):
+    if values.primary.command_class == zwave.const.COMMAND_CLASS_SWITCH_BINARY:
         return ZwaveGarageDoorSwitch(values)
-    elif (values.primary.command_class ==
-          zwave.const.COMMAND_CLASS_BARRIER_OPERATOR):
+    if values.primary.command_class == \
+       zwave.const.COMMAND_CLASS_BARRIER_OPERATOR:
         return ZwaveGarageDoorBarrier(values)
     return None
 
@@ -84,7 +83,7 @@ class ZwaveRollershutter(zwave.ZWaveDeviceEntity, CoverDevice):
         if self._current_position is not None:
             if self._current_position <= 5:
                 return 0
-            elif self._current_position >= 95:
+            if self._current_position >= 95:
                 return 100
             return self._current_position
 
diff --git a/homeassistant/components/deconz/config_flow.py b/homeassistant/components/deconz/config_flow.py
index b67d32508be..a6f67506227 100644
--- a/homeassistant/components/deconz/config_flow.py
+++ b/homeassistant/components/deconz/config_flow.py
@@ -57,7 +57,7 @@ class DeconzFlowHandler(data_entry_flow.FlowHandler):
         if len(self.bridges) == 1:
             self.deconz_config = self.bridges[0]
             return await self.async_step_link()
-        elif len(self.bridges) > 1:
+        if len(self.bridges) > 1:
             hosts = []
             for bridge in self.bridges:
                 hosts.append(bridge[CONF_HOST])
diff --git a/homeassistant/components/device_tracker/__init__.py b/homeassistant/components/device_tracker/__init__.py
index 391f36ad623..74cb0a77fef 100644
--- a/homeassistant/components/device_tracker/__init__.py
+++ b/homeassistant/components/device_tracker/__init__.py
@@ -537,7 +537,7 @@ class Device(Entity):
         """
         if not self.last_seen:
             return
-        elif self.location_name:
+        if self.location_name:
             self._state = self.location_name
         elif self.gps is not None and self.source_type == SOURCE_TYPE_GPS:
             zone_state = async_active_zone(
diff --git a/homeassistant/components/device_tracker/aruba.py b/homeassistant/components/device_tracker/aruba.py
index 61eee99e721..142842b12d2 100644
--- a/homeassistant/components/device_tracker/aruba.py
+++ b/homeassistant/components/device_tracker/aruba.py
@@ -94,10 +94,10 @@ class ArubaDeviceScanner(DeviceScanner):
         if query == 1:
             _LOGGER.error("Timeout")
             return
-        elif query == 2:
+        if query == 2:
             _LOGGER.error("Unexpected response from router")
             return
-        elif query == 3:
+        if query == 3:
             ssh.sendline('yes')
             ssh.expect('password:')
         elif query == 4:
diff --git a/homeassistant/components/device_tracker/bt_home_hub_5.py b/homeassistant/components/device_tracker/bt_home_hub_5.py
index 707850d2215..93bc9270650 100644
--- a/homeassistant/components/device_tracker/bt_home_hub_5.py
+++ b/homeassistant/components/device_tracker/bt_home_hub_5.py
@@ -94,8 +94,7 @@ def _get_homehub_data(url):
         return
     if response.status_code == 200:
         return _parse_homehub_response(response.text)
-    else:
-        _LOGGER.error("Invalid response from Home Hub: %s", response)
+    _LOGGER.error("Invalid response from Home Hub: %s", response)
 
 
 def _parse_homehub_response(data_str):
diff --git a/homeassistant/components/device_tracker/ddwrt.py b/homeassistant/components/device_tracker/ddwrt.py
index 3e17fdd3329..539d4fde5ef 100644
--- a/homeassistant/components/device_tracker/ddwrt.py
+++ b/homeassistant/components/device_tracker/ddwrt.py
@@ -131,13 +131,12 @@ class DdWrtDeviceScanner(DeviceScanner):
             return
         if response.status_code == 200:
             return _parse_ddwrt_response(response.text)
-        elif response.status_code == 401:
+        if response.status_code == 401:
             # Authentication error
             _LOGGER.exception(
                 "Failed to authenticate, check your username and password")
             return
-        else:
-            _LOGGER.error("Invalid response from DD-WRT: %s", response)
+        _LOGGER.error("Invalid response from DD-WRT: %s", response)
 
 
 def _parse_ddwrt_response(data_str):
diff --git a/homeassistant/components/device_tracker/geofency.py b/homeassistant/components/device_tracker/geofency.py
index adb5c6f6d28..7231c5127be 100644
--- a/homeassistant/components/device_tracker/geofency.py
+++ b/homeassistant/components/device_tracker/geofency.py
@@ -70,16 +70,15 @@ class GeofencyView(HomeAssistantView):
 
         if self._is_mobile_beacon(data):
             return (yield from self._set_location(hass, data, None))
+        if data['entry'] == LOCATION_ENTRY:
+            location_name = data['name']
         else:
-            if data['entry'] == LOCATION_ENTRY:
-                location_name = data['name']
-            else:
-                location_name = STATE_NOT_HOME
-                if ATTR_CURRENT_LATITUDE in data:
-                    data[ATTR_LATITUDE] = data[ATTR_CURRENT_LATITUDE]
-                    data[ATTR_LONGITUDE] = data[ATTR_CURRENT_LONGITUDE]
-
-            return (yield from self._set_location(hass, data, location_name))
+            location_name = STATE_NOT_HOME
+            if ATTR_CURRENT_LATITUDE in data:
+                data[ATTR_LATITUDE] = data[ATTR_CURRENT_LATITUDE]
+                data[ATTR_LONGITUDE] = data[ATTR_CURRENT_LONGITUDE]
+
+        return (yield from self._set_location(hass, data, location_name))
 
     @staticmethod
     def _validate_data(data):
diff --git a/homeassistant/components/device_tracker/locative.py b/homeassistant/components/device_tracker/locative.py
index aee584aa953..354d3b0980c 100644
--- a/homeassistant/components/device_tracker/locative.py
+++ b/homeassistant/components/device_tracker/locative.py
@@ -84,7 +84,7 @@ class LocativeView(HomeAssistantView):
                         gps=gps_location))
             return 'Setting location to {}'.format(location_name)
 
-        elif direction == 'exit':
+        if direction == 'exit':
             current_state = hass.states.get(
                 '{}.{}'.format(DOMAIN, device))
 
@@ -102,7 +102,7 @@ class LocativeView(HomeAssistantView):
             return 'Ignoring exit from {} (already in {})'.format(
                 location_name, current_state)
 
-        elif direction == 'test':
+        if direction == 'test':
             # In the app, a test message can be sent. Just return something to
             # the user to let them know that it works.
             return 'Received test message.'
diff --git a/homeassistant/components/device_tracker/meraki.py b/homeassistant/components/device_tracker/meraki.py
index 9bbc6bf9ffe..c996b7e643b 100644
--- a/homeassistant/components/device_tracker/meraki.py
+++ b/homeassistant/components/device_tracker/meraki.py
@@ -74,17 +74,16 @@ class MerakiView(HomeAssistantView):
             _LOGGER.error("Invalid Secret received from Meraki")
             return self.json_message('Invalid secret',
                                      HTTP_UNPROCESSABLE_ENTITY)
-        elif data['version'] != VERSION:
+        if data['version'] != VERSION:
             _LOGGER.error("Invalid API version: %s", data['version'])
             return self.json_message('Invalid version',
                                      HTTP_UNPROCESSABLE_ENTITY)
-        else:
-            _LOGGER.debug('Valid Secret')
-            if data['type'] not in ('DevicesSeen', 'BluetoothDevicesSeen'):
-                _LOGGER.error("Unknown Device %s", data['type'])
-                return self.json_message('Invalid device type',
-                                         HTTP_UNPROCESSABLE_ENTITY)
-            _LOGGER.debug("Processing %s", data['type'])
+        _LOGGER.debug('Valid Secret')
+        if data['type'] not in ('DevicesSeen', 'BluetoothDevicesSeen'):
+            _LOGGER.error("Unknown Device %s", data['type'])
+            return self.json_message('Invalid device type',
+                                     HTTP_UNPROCESSABLE_ENTITY)
+        _LOGGER.debug("Processing %s", data['type'])
         if not data["data"]["observations"]:
             _LOGGER.debug("No observations found")
             return
diff --git a/homeassistant/components/device_tracker/sky_hub.py b/homeassistant/components/device_tracker/sky_hub.py
index 0c289ce9a82..deab486ec6e 100644
--- a/homeassistant/components/device_tracker/sky_hub.py
+++ b/homeassistant/components/device_tracker/sky_hub.py
@@ -91,8 +91,7 @@ def _get_skyhub_data(url):
         return
     if response.status_code == 200:
         return _parse_skyhub_response(response.text)
-    else:
-        _LOGGER.error("Invalid response from Sky Hub: %s", response)
+    _LOGGER.error("Invalid response from Sky Hub: %s", response)
 
 
 def _parse_skyhub_response(data_str):
diff --git a/homeassistant/components/device_tracker/tomato.py b/homeassistant/components/device_tracker/tomato.py
index 12e1cb0099a..718adad4212 100644
--- a/homeassistant/components/device_tracker/tomato.py
+++ b/homeassistant/components/device_tracker/tomato.py
@@ -107,7 +107,7 @@ class TomatoDeviceScanner(DeviceScanner):
                             json.loads(value.replace("'", '"'))
                 return True
 
-            elif response.status_code == 401:
+            if response.status_code == 401:
                 # Authentication error
                 _LOGGER.exception((
                     "Failed to authenticate, "
diff --git a/homeassistant/components/google_assistant/trait.py b/homeassistant/components/google_assistant/trait.py
index 2f60f226042..74ee55c5e93 100644
--- a/homeassistant/components/google_assistant/trait.py
+++ b/homeassistant/components/google_assistant/trait.py
@@ -106,9 +106,9 @@ class BrightnessTrait(_Trait):
         """Test if state is supported."""
         if domain == light.DOMAIN:
             return features & light.SUPPORT_BRIGHTNESS
-        elif domain == cover.DOMAIN:
+        if domain == cover.DOMAIN:
             return features & cover.SUPPORT_SET_POSITION
-        elif domain == media_player.DOMAIN:
+        if domain == media_player.DOMAIN:
             return features & media_player.SUPPORT_VOLUME_SET
 
         return False
diff --git a/homeassistant/components/graphite.py b/homeassistant/components/graphite.py
index e4626d0f016..2b768bc3786 100644
--- a/homeassistant/components/graphite.py
+++ b/homeassistant/components/graphite.py
@@ -137,8 +137,8 @@ class GraphiteFeeder(threading.Thread):
                 _LOGGER.debug("Event processing thread stopped")
                 self._queue.task_done()
                 return
-            elif (event.event_type == EVENT_STATE_CHANGED and
-                  event.data.get('new_state')):
+            if event.event_type == EVENT_STATE_CHANGED and \
+               event.data.get('new_state'):
                 _LOGGER.debug("Processing STATE_CHANGED event for %s",
                               event.data['entity_id'])
                 try:
diff --git a/homeassistant/components/hassio/__init__.py b/homeassistant/components/hassio/__init__.py
index 6ab86435371..13bc6e9c558 100644
--- a/homeassistant/components/hassio/__init__.py
+++ b/homeassistant/components/hassio/__init__.py
@@ -140,7 +140,7 @@ def async_check_config(hass):
 
     if not result:
         return "Hass.io config check API error"
-    elif result['result'] == "error":
+    if result['result'] == "error":
         return result['message']
     return None
 
diff --git a/homeassistant/components/homekit/type_thermostats.py b/homeassistant/components/homekit/type_thermostats.py
index 73a29990fba..8517122f6a8 100644
--- a/homeassistant/components/homekit/type_thermostats.py
+++ b/homeassistant/components/homekit/type_thermostats.py
@@ -124,8 +124,7 @@ class Thermostat(HomeAccessory):
                 if hass_value == STATE_OFF:
                     self.hass.services.call(DOMAIN, SERVICE_TURN_OFF, params)
                     return
-                else:
-                    self.hass.services.call(DOMAIN, SERVICE_TURN_ON, params)
+                self.hass.services.call(DOMAIN, SERVICE_TURN_ON, params)
             params = {ATTR_ENTITY_ID: self.entity_id,
                       ATTR_OPERATION_MODE: hass_value}
             self.hass.services.call(DOMAIN, SERVICE_SET_OPERATION_MODE, params)
diff --git a/homeassistant/components/homekit/util.py b/homeassistant/components/homekit/util.py
index c2f8951c8d8..23a907d43f7 100644
--- a/homeassistant/components/homekit/util.py
+++ b/homeassistant/components/homekit/util.py
@@ -142,10 +142,10 @@ def density_to_air_quality(density):
     """Map PM2.5 density to HomeKit AirQuality level."""
     if density <= 35:
         return 1
-    elif density <= 75:
+    if density <= 75:
         return 2
-    elif density <= 115:
+    if density <= 115:
         return 3
-    elif density <= 150:
+    if density <= 150:
         return 4
     return 5
diff --git a/homeassistant/components/homematicip_cloud/config_flow.py b/homeassistant/components/homematicip_cloud/config_flow.py
index 9e5356d914a..3be89172e27 100644
--- a/homeassistant/components/homematicip_cloud/config_flow.py
+++ b/homeassistant/components/homematicip_cloud/config_flow.py
@@ -70,8 +70,7 @@ class HomematicipCloudFlowHandler(data_entry_flow.FlowHandler):
                         HMIPC_NAME: self.auth.config.get(HMIPC_NAME)
                     })
             return self.async_abort(reason='conection_aborted')
-        else:
-            errors['base'] = 'press_the_button'
+        errors['base'] = 'press_the_button'
 
         return self.async_show_form(step_id='link', errors=errors)
 
diff --git a/homeassistant/components/http/auth.py b/homeassistant/components/http/auth.py
index 2cc62dce38e..4c71504104e 100644
--- a/homeassistant/components/http/auth.py
+++ b/homeassistant/components/http/auth.py
@@ -109,7 +109,7 @@ async def async_validate_auth_header(request, api_password=None):
         request['hass_user'] = access_token.refresh_token.user
         return True
 
-    elif auth_type == 'Basic' and api_password is not None:
+    if auth_type == 'Basic' and api_password is not None:
         decoded = base64.b64decode(auth_val).decode('utf-8')
         try:
             username, password = decoded.split(':', 1)
@@ -123,5 +123,4 @@ async def async_validate_auth_header(request, api_password=None):
         return hmac.compare_digest(api_password.encode('utf-8'),
                                    password.encode('utf-8'))
 
-    else:
-        return False
+    return False
diff --git a/homeassistant/components/http/static.py b/homeassistant/components/http/static.py
index cd07ab6df69..8b28a7cf288 100644
--- a/homeassistant/components/http/static.py
+++ b/homeassistant/components/http/static.py
@@ -31,10 +31,9 @@ class CachingStaticResource(StaticResource):
 
         if filepath.is_dir():
             return await super()._handle(request)
-        elif filepath.is_file():
+        if filepath.is_file():
             return CachingFileResponse(filepath, chunk_size=self._chunk_size)
-        else:
-            raise HTTPNotFound
+        raise HTTPNotFound
 
 
 # pylint: disable=too-many-ancestors
diff --git a/homeassistant/components/hue/config_flow.py b/homeassistant/components/hue/config_flow.py
index af67a594495..a7fe3ff04e0 100644
--- a/homeassistant/components/hue/config_flow.py
+++ b/homeassistant/components/hue/config_flow.py
@@ -84,7 +84,7 @@ class HueFlowHandler(data_entry_flow.FlowHandler):
                 reason='all_configured'
             )
 
-        elif len(hosts) == 1:
+        if len(hosts) == 1:
             self.host = hosts[0]
             return await self.async_step_link()
 
diff --git a/homeassistant/components/knx.py b/homeassistant/components/knx.py
index f8db21118ec..c6101230031 100644
--- a/homeassistant/components/knx.py
+++ b/homeassistant/components/knx.py
@@ -172,7 +172,7 @@ class KNXModule:
         """Return the connection_config."""
         if CONF_KNX_TUNNELING in self.config[DOMAIN]:
             return self.connection_config_tunneling()
-        elif CONF_KNX_ROUTING in self.config[DOMAIN]:
+        if CONF_KNX_ROUTING in self.config[DOMAIN]:
             return self.connection_config_routing()
         return self.connection_config_auto()
 
diff --git a/homeassistant/components/light/abode.py b/homeassistant/components/light/abode.py
index 8b7e09d86bc..431f5d12ff0 100644
--- a/homeassistant/components/light/abode.py
+++ b/homeassistant/components/light/abode.py
@@ -88,7 +88,7 @@ class AbodeLight(AbodeDevice, Light):
         """Flag supported features."""
         if self._device.is_dimmable and self._device.has_color:
             return SUPPORT_BRIGHTNESS | SUPPORT_COLOR
-        elif self._device.is_dimmable:
+        if self._device.is_dimmable:
             return SUPPORT_BRIGHTNESS
 
         return 0
diff --git a/homeassistant/components/light/flux_led.py b/homeassistant/components/light/flux_led.py
index c5cd9a8c4fd..2b53fb65054 100644
--- a/homeassistant/components/light/flux_led.py
+++ b/homeassistant/components/light/flux_led.py
@@ -245,7 +245,7 @@ class FluxLight(Light):
             return
 
         # Effect selection
-        elif effect in EFFECT_MAP:
+        if effect in EFFECT_MAP:
             self._bulb.setPresetPattern(EFFECT_MAP[effect], 50)
             return
 
diff --git a/homeassistant/components/logbook.py b/homeassistant/components/logbook.py
index b9970e3466e..c4fcf53a9c1 100644
--- a/homeassistant/components/logbook.py
+++ b/homeassistant/components/logbook.py
@@ -380,16 +380,16 @@ def _entry_message_from_state(domain, state):
             return 'is away'
         return 'is at {}'.format(state.state)
 
-    elif domain == 'sun':
+    if domain == 'sun':
         if state.state == sun.STATE_ABOVE_HORIZON:
             return 'has risen'
         return 'has set'
 
-    elif state.state == STATE_ON:
+    if state.state == STATE_ON:
         # Future: combine groups and its entity entries ?
         return "turned on"
 
-    elif state.state == STATE_OFF:
+    if state.state == STATE_OFF:
         return "turned off"
 
     return "changed to {}".format(state.state)
diff --git a/homeassistant/components/media_player/anthemav.py b/homeassistant/components/media_player/anthemav.py
index 474751c2574..a74629917b3 100644
--- a/homeassistant/components/media_player/anthemav.py
+++ b/homeassistant/components/media_player/anthemav.py
@@ -100,7 +100,7 @@ class AnthemAVR(MediaPlayerDevice):
 
         if pwrstate is True:
             return STATE_ON
-        elif pwrstate is False:
+        if pwrstate is False:
             return STATE_OFF
         return STATE_UNKNOWN
 
diff --git a/homeassistant/components/media_player/apple_tv.py b/homeassistant/components/media_player/apple_tv.py
index 97b9b64c7cb..d4a7ad19807 100644
--- a/homeassistant/components/media_player/apple_tv.py
+++ b/homeassistant/components/media_player/apple_tv.py
@@ -103,11 +103,11 @@ class AppleTvDevice(MediaPlayerDevice):
             if state in (const.PLAY_STATE_IDLE, const.PLAY_STATE_NO_MEDIA,
                          const.PLAY_STATE_LOADING):
                 return STATE_IDLE
-            elif state == const.PLAY_STATE_PLAYING:
+            if state == const.PLAY_STATE_PLAYING:
                 return STATE_PLAYING
-            elif state in (const.PLAY_STATE_PAUSED,
-                           const.PLAY_STATE_FAST_FORWARD,
-                           const.PLAY_STATE_FAST_BACKWARD):
+            if state in (const.PLAY_STATE_PAUSED,
+                         const.PLAY_STATE_FAST_FORWARD,
+                         const.PLAY_STATE_FAST_BACKWARD):
                 # Catch fast forward/backward here so "play" is default action
                 return STATE_PAUSED
             return STATE_STANDBY  # Bad or unknown state?
@@ -140,9 +140,9 @@ class AppleTvDevice(MediaPlayerDevice):
             media_type = self._playing.media_type
             if media_type == const.MEDIA_TYPE_VIDEO:
                 return MEDIA_TYPE_VIDEO
-            elif media_type == const.MEDIA_TYPE_MUSIC:
+            if media_type == const.MEDIA_TYPE_MUSIC:
                 return MEDIA_TYPE_MUSIC
-            elif media_type == const.MEDIA_TYPE_TV:
+            if media_type == const.MEDIA_TYPE_TV:
                 return MEDIA_TYPE_TVSHOW
 
     @property
@@ -221,7 +221,7 @@ class AppleTvDevice(MediaPlayerDevice):
             state = self.state
             if state == STATE_PAUSED:
                 return self.atv.remote_control.play()
-            elif state == STATE_PLAYING:
+            if state == STATE_PLAYING:
                 return self.atv.remote_control.pause()
 
     def async_media_play(self):
diff --git a/homeassistant/components/media_player/bluesound.py b/homeassistant/components/media_player/bluesound.py
index c96889f4fe4..a6b345b1d3b 100644
--- a/homeassistant/components/media_player/bluesound.py
+++ b/homeassistant/components/media_player/bluesound.py
@@ -530,7 +530,7 @@ class BluesoundPlayer(MediaPlayerDevice):
         status = self._status.get('state', None)
         if status in ('pause', 'stop'):
             return STATE_PAUSED
-        elif status in ('stream', 'play'):
+        if status in ('stream', 'play'):
             return STATE_PLAYING
         return STATE_IDLE
 
@@ -974,6 +974,5 @@ class BluesoundPlayer(MediaPlayerDevice):
             if volume > 0:
                 self._lastvol = volume
             return await self.send_bluesound_command('Volume?level=0')
-        else:
-            return await self.send_bluesound_command(
-                'Volume?level=' + str(float(self._lastvol) * 100))
+        return await self.send_bluesound_command(
+            'Volume?level=' + str(float(self._lastvol) * 100))
diff --git a/homeassistant/components/media_player/braviatv.py b/homeassistant/components/media_player/braviatv.py
index 464baed1686..07a379db45c 100644
--- a/homeassistant/components/media_player/braviatv.py
+++ b/homeassistant/components/media_player/braviatv.py
@@ -88,23 +88,23 @@ def setup_bravia(config, pin, hass, add_devices):
     if pin is None:
         request_configuration(config, hass, add_devices)
         return
-    else:
-        mac = _get_mac_address(host)
-        if mac is not None:
-            mac = mac.decode('utf8')
-        # If we came here and configuring this host, mark as done
-        if host in _CONFIGURING:
-            request_id = _CONFIGURING.pop(host)
-            configurator = hass.components.configurator
-            configurator.request_done(request_id)
-            _LOGGER.info("Discovery configuration done")
-
-        # Save config
-        save_json(
-            hass.config.path(BRAVIA_CONFIG_FILE),
-            {host: {'pin': pin, 'host': host, 'mac': mac}})
-
-        add_devices([BraviaTVDevice(host, mac, name, pin)])
+
+    mac = _get_mac_address(host)
+    if mac is not None:
+        mac = mac.decode('utf8')
+    # If we came here and configuring this host, mark as done
+    if host in _CONFIGURING:
+        request_id = _CONFIGURING.pop(host)
+        configurator = hass.components.configurator
+        configurator.request_done(request_id)
+        _LOGGER.info("Discovery configuration done")
+
+    # Save config
+    save_json(
+        hass.config.path(BRAVIA_CONFIG_FILE),
+        {host: {'pin': pin, 'host': host, 'mac': mac}})
+
+    add_devices([BraviaTVDevice(host, mac, name, pin)])
 
 
 def request_configuration(config, hass, add_devices):
diff --git a/homeassistant/components/media_player/cast.py b/homeassistant/components/media_player/cast.py
index 32ceadf248f..099b365c50b 100644
--- a/homeassistant/components/media_player/cast.py
+++ b/homeassistant/components/media_player/cast.py
@@ -499,13 +499,13 @@ class CastDevice(MediaPlayerDevice):
         """Return the state of the player."""
         if self.media_status is None:
             return None
-        elif self.media_status.player_is_playing:
+        if self.media_status.player_is_playing:
             return STATE_PLAYING
-        elif self.media_status.player_is_paused:
+        if self.media_status.player_is_paused:
             return STATE_PAUSED
-        elif self.media_status.player_is_idle:
+        if self.media_status.player_is_idle:
             return STATE_IDLE
-        elif self._chromecast is not None and self._chromecast.is_idle:
+        if self._chromecast is not None and self._chromecast.is_idle:
             return STATE_OFF
         return None
 
@@ -534,11 +534,11 @@ class CastDevice(MediaPlayerDevice):
         """Content type of current playing media."""
         if self.media_status is None:
             return None
-        elif self.media_status.media_is_tvshow:
+        if self.media_status.media_is_tvshow:
             return MEDIA_TYPE_TVSHOW
-        elif self.media_status.media_is_movie:
+        if self.media_status.media_is_movie:
             return MEDIA_TYPE_MOVIE
-        elif self.media_status.media_is_musictrack:
+        if self.media_status.media_is_musictrack:
             return MEDIA_TYPE_MUSIC
         return None
 
diff --git a/homeassistant/components/media_player/channels.py b/homeassistant/components/media_player/channels.py
index 41713e0c5bc..6ccc6061703 100644
--- a/homeassistant/components/media_player/channels.py
+++ b/homeassistant/components/media_player/channels.py
@@ -217,7 +217,7 @@ class ChannelsPlayer(MediaPlayerDevice):
         """Image url of current playing media."""
         if self.now_playing_image_url:
             return self.now_playing_image_url
-        elif self.channel_image_url:
+        if self.channel_image_url:
             return self.channel_image_url
 
         return 'https://getchannels.com/assets/img/icon-1024.png'
diff --git a/homeassistant/components/media_player/cmus.py b/homeassistant/components/media_player/cmus.py
index 0758b5f3058..978a1088aa6 100644
--- a/homeassistant/components/media_player/cmus.py
+++ b/homeassistant/components/media_player/cmus.py
@@ -91,7 +91,7 @@ class CmusDevice(MediaPlayerDevice):
         """Return the media state."""
         if self.status.get('status') == 'playing':
             return STATE_PLAYING
-        elif self.status.get('status') == 'paused':
+        if self.status.get('status') == 'paused':
             return STATE_PAUSED
         return STATE_OFF
 
diff --git a/homeassistant/components/media_player/denonavr.py b/homeassistant/components/media_player/denonavr.py
index 2b2b9eb5c28..654374de08a 100644
--- a/homeassistant/components/media_player/denonavr.py
+++ b/homeassistant/components/media_player/denonavr.py
@@ -261,7 +261,7 @@ class DenonDevice(MediaPlayerDevice):
         """Title of current playing media."""
         if self._current_source not in self._receiver.playing_func_list:
             return self._current_source
-        elif self._title is not None:
+        if self._title is not None:
             return self._title
         return self._frequency
 
diff --git a/homeassistant/components/media_player/directv.py b/homeassistant/components/media_player/directv.py
index 0adb02b6a65..89547892550 100644
--- a/homeassistant/components/media_player/directv.py
+++ b/homeassistant/components/media_player/directv.py
@@ -140,7 +140,7 @@ class DirecTvDevice(MediaPlayerDevice):
         """Return the title of current episode of TV show."""
         if self._is_standby:
             return None
-        elif 'episodeTitle' in self._current:
+        if 'episodeTitle' in self._current:
             return self._current['episodeTitle']
         return None
 
diff --git a/homeassistant/components/media_player/emby.py b/homeassistant/components/media_player/emby.py
index 4f9a4019268..1dfb19a33be 100644
--- a/homeassistant/components/media_player/emby.py
+++ b/homeassistant/components/media_player/emby.py
@@ -206,11 +206,11 @@ class EmbyDevice(MediaPlayerDevice):
         state = self.device.state
         if state == 'Paused':
             return STATE_PAUSED
-        elif state == 'Playing':
+        if state == 'Playing':
             return STATE_PLAYING
-        elif state == 'Idle':
+        if state == 'Idle':
             return STATE_IDLE
-        elif state == 'Off':
+        if state == 'Off':
             return STATE_OFF
 
     @property
@@ -230,15 +230,15 @@ class EmbyDevice(MediaPlayerDevice):
         media_type = self.device.media_type
         if media_type == 'Episode':
             return MEDIA_TYPE_TVSHOW
-        elif media_type == 'Movie':
+        if media_type == 'Movie':
             return MEDIA_TYPE_MOVIE
-        elif media_type == 'Trailer':
+        if media_type == 'Trailer':
             return MEDIA_TYPE_TRAILER
-        elif media_type == 'Music':
+        if media_type == 'Music':
             return MEDIA_TYPE_MUSIC
-        elif media_type == 'Video':
+        if media_type == 'Video':
             return MEDIA_TYPE_GENERIC_VIDEO
-        elif media_type == 'Audio':
+        if media_type == 'Audio':
             return MEDIA_TYPE_MUSIC
         return None
 
diff --git a/homeassistant/components/media_player/kodi.py b/homeassistant/components/media_player/kodi.py
index 0585692e77d..8758e969db1 100644
--- a/homeassistant/components/media_player/kodi.py
+++ b/homeassistant/components/media_player/kodi.py
@@ -749,7 +749,7 @@ class KodiDevice(MediaPlayerDevice):
         if media_type == "CHANNEL":
             return self.server.Player.Open(
                 {"item": {"channelid": int(media_id)}})
-        elif media_type == "PLAYLIST":
+        if media_type == "PLAYLIST":
             return self.server.Player.Open(
                 {"item": {"playlistid": int(media_id)}})
 
diff --git a/homeassistant/components/media_player/liveboxplaytv.py b/homeassistant/components/media_player/liveboxplaytv.py
index 6b161f86ab0..1b5948c964a 100644
--- a/homeassistant/components/media_player/liveboxplaytv.py
+++ b/homeassistant/components/media_player/liveboxplaytv.py
@@ -202,7 +202,7 @@ class LiveboxPlayTvDevice(MediaPlayerDevice):
         state = self._client.media_state
         if state == 'PLAY':
             return STATE_PLAYING
-        elif state == 'PAUSE':
+        if state == 'PAUSE':
             return STATE_PAUSED
 
         return STATE_ON if self._client.is_on else STATE_OFF
diff --git a/homeassistant/components/media_player/mpchc.py b/homeassistant/components/media_player/mpchc.py
index ad8dd0bf056..773825e0d57 100644
--- a/homeassistant/components/media_player/mpchc.py
+++ b/homeassistant/components/media_player/mpchc.py
@@ -93,7 +93,7 @@ class MpcHcDevice(MediaPlayerDevice):
             return STATE_OFF
         if state == 'playing':
             return STATE_PLAYING
-        elif state == 'paused':
+        if state == 'paused':
             return STATE_PAUSED
 
         return STATE_IDLE
diff --git a/homeassistant/components/media_player/mpd.py b/homeassistant/components/media_player/mpd.py
index 73417e5f25d..4b3dfc2ccbb 100644
--- a/homeassistant/components/media_player/mpd.py
+++ b/homeassistant/components/media_player/mpd.py
@@ -141,11 +141,11 @@ class MpdDevice(MediaPlayerDevice):
         """Return the media state."""
         if self._status is None:
             return STATE_OFF
-        elif self._status['state'] == 'play':
+        if self._status['state'] == 'play':
             return STATE_PLAYING
-        elif self._status['state'] == 'pause':
+        if self._status['state'] == 'pause':
             return STATE_PAUSED
-        elif self._status['state'] == 'stop':
+        if self._status['state'] == 'stop':
             return STATE_OFF
 
         return STATE_OFF
@@ -182,9 +182,9 @@ class MpdDevice(MediaPlayerDevice):
             if file_name is None:
                 return "None"
             return os.path.basename(file_name)
-        elif name is None:
+        if name is None:
             return title
-        elif title is None:
+        if title is None:
             return name
 
         return '{}: {}'.format(name, title)
diff --git a/homeassistant/components/media_player/plex.py b/homeassistant/components/media_player/plex.py
index ca6b9722a49..e3c6f453c35 100644
--- a/homeassistant/components/media_player/plex.py
+++ b/homeassistant/components/media_player/plex.py
@@ -573,11 +573,11 @@ class PlexClient(MediaPlayerDevice):
             _LOGGER.debug("Clip content type detected, "
                           "compatibility may vary: %s", self.entity_id)
             return MEDIA_TYPE_TVSHOW
-        elif self._session_type == 'episode':
+        if self._session_type == 'episode':
             return MEDIA_TYPE_TVSHOW
-        elif self._session_type == 'movie':
+        if self._session_type == 'movie':
             return MEDIA_TYPE_MOVIE
-        elif self._session_type == 'track':
+        if self._session_type == 'track':
             return MEDIA_TYPE_MUSIC
 
         return None
@@ -654,7 +654,7 @@ class PlexClient(MediaPlayerDevice):
         if not self._make:
             return None
         # no mute support
-        elif self.make.lower() == "shield android tv":
+        if self.make.lower() == "shield android tv":
             _LOGGER.debug(
                 "Shield Android TV client detected, disabling mute "
                 "controls: %s", self.entity_id)
@@ -663,7 +663,7 @@ class PlexClient(MediaPlayerDevice):
                     SUPPORT_VOLUME_SET | SUPPORT_PLAY |
                     SUPPORT_TURN_OFF)
         # Only supports play,pause,stop (and off which really is stop)
-        elif self.make.lower().startswith("tivo"):
+        if self.make.lower().startswith("tivo"):
             _LOGGER.debug(
                 "Tivo client detected, only enabling pause, play, "
                 "stop, and off controls: %s", self.entity_id)
@@ -671,7 +671,7 @@ class PlexClient(MediaPlayerDevice):
                     SUPPORT_TURN_OFF)
         # Not all devices support playback functionality
         # Playback includes volume, stop/play/pause, etc.
-        elif self.device and 'playback' in self._device_protocol_capabilities:
+        if self.device and 'playback' in self._device_protocol_capabilities:
             return (SUPPORT_PAUSE | SUPPORT_PREVIOUS_TRACK |
                     SUPPORT_NEXT_TRACK | SUPPORT_STOP |
                     SUPPORT_VOLUME_SET | SUPPORT_PLAY |
diff --git a/homeassistant/components/media_player/roku.py b/homeassistant/components/media_player/roku.py
index a46e781de59..5f28660f4bd 100644
--- a/homeassistant/components/media_player/roku.py
+++ b/homeassistant/components/media_player/roku.py
@@ -134,9 +134,9 @@ class RokuDevice(MediaPlayerDevice):
         if (self.current_app.name == "Power Saver" or
                 self.current_app.is_screensaver):
             return STATE_IDLE
-        elif self.current_app.name == "Roku":
+        if self.current_app.name == "Roku":
             return STATE_HOME
-        elif self.current_app.name is not None:
+        if self.current_app.name is not None:
             return STATE_PLAYING
 
         return STATE_UNKNOWN
@@ -156,9 +156,9 @@ class RokuDevice(MediaPlayerDevice):
         """Content type of current playing media."""
         if self.current_app is None:
             return None
-        elif self.current_app.name == "Power Saver":
+        if self.current_app.name == "Power Saver":
             return None
-        elif self.current_app.name == "Roku":
+        if self.current_app.name == "Roku":
             return None
         return MEDIA_TYPE_MOVIE
 
@@ -167,11 +167,11 @@ class RokuDevice(MediaPlayerDevice):
         """Image url of current playing media."""
         if self.current_app is None:
             return None
-        elif self.current_app.name == "Roku":
+        if self.current_app.name == "Roku":
             return None
-        elif self.current_app.name == "Power Saver":
+        if self.current_app.name == "Power Saver":
             return None
-        elif self.current_app.id is None:
+        if self.current_app.id is None:
             return None
 
         return 'http://{0}:{1}/query/icon/{2}'.format(
diff --git a/homeassistant/components/media_player/russound_rio.py b/homeassistant/components/media_player/russound_rio.py
index 31b04ceb3cd..e9f8ab5f199 100644
--- a/homeassistant/components/media_player/russound_rio.py
+++ b/homeassistant/components/media_player/russound_rio.py
@@ -100,8 +100,7 @@ class RussoundZoneDevice(MediaPlayerDevice):
             if value in (None, "", "------"):
                 return None
             return value
-        else:
-            return None
+        return None
 
     def _zone_callback_handler(self, zone_id, *args):
         if zone_id == self._zone_id:
@@ -134,7 +133,7 @@ class RussoundZoneDevice(MediaPlayerDevice):
         status = self._zone_var('status', "OFF")
         if status == 'ON':
             return STATE_ON
-        elif status == 'OFF':
+        if status == 'OFF':
             return STATE_OFF
 
     @property
diff --git a/homeassistant/components/media_player/soundtouch.py b/homeassistant/components/media_player/soundtouch.py
index 9c4a0e9fa17..8f14031481a 100644
--- a/homeassistant/components/media_player/soundtouch.py
+++ b/homeassistant/components/media_player/soundtouch.py
@@ -269,7 +269,7 @@ class SoundTouchDevice(MediaPlayerDevice):
         """Title of current playing media."""
         if self._status.station_name is not None:
             return self._status.station_name
-        elif self._status.artist is not None:
+        if self._status.artist is not None:
             return self._status.artist + " - " + self._status.track
 
         return None
diff --git a/homeassistant/components/media_player/vizio.py b/homeassistant/components/media_player/vizio.py
index 203a2c2b408..046aecbb92e 100644
--- a/homeassistant/components/media_player/vizio.py
+++ b/homeassistant/components/media_player/vizio.py
@@ -95,7 +95,7 @@ class VizioDevice(MediaPlayerDevice):
         if is_on is None:
             self._state = STATE_UNKNOWN
             return
-        elif is_on is False:
+        if is_on is False:
             self._state = STATE_OFF
         else:
             self._state = STATE_ON
diff --git a/homeassistant/components/media_player/volumio.py b/homeassistant/components/media_player/volumio.py
index 11ab1615617..c4ddd38fc4f 100644
--- a/homeassistant/components/media_player/volumio.py
+++ b/homeassistant/components/media_player/volumio.py
@@ -142,7 +142,7 @@ class Volumio(MediaPlayerDevice):
         status = self._state.get('status', None)
         if status == 'pause':
             return STATE_PAUSED
-        elif status == 'play':
+        if status == 'play':
             return STATE_PLAYING
 
         return STATE_IDLE
diff --git a/homeassistant/components/mysensors/__init__.py b/homeassistant/components/mysensors/__init__.py
index 3066819638f..980efcf5805 100644
--- a/homeassistant/components/mysensors/__init__.py
+++ b/homeassistant/components/mysensors/__init__.py
@@ -52,9 +52,8 @@ def is_persistence_file(value):
     """Validate that persistence file path ends in either .pickle or .json."""
     if value.endswith(('.json', '.pickle')):
         return value
-    else:
-        raise vol.Invalid(
-            '{} does not end in either `.json` or `.pickle`'.format(value))
+    raise vol.Invalid(
+        '{} does not end in either `.json` or `.pickle`'.format(value))
 
 
 def deprecated(key):
diff --git a/homeassistant/components/mysensors/gateway.py b/homeassistant/components/mysensors/gateway.py
index 73222cb6be2..a7de62cd329 100644
--- a/homeassistant/components/mysensors/gateway.py
+++ b/homeassistant/components/mysensors/gateway.py
@@ -38,10 +38,8 @@ def is_serial_port(value):
         ports = ('COM{}'.format(idx + 1) for idx in range(256))
         if value in ports:
             return value
-        else:
-            raise vol.Invalid('{} is not a serial port'.format(value))
-    else:
-        return cv.isdevice(value)
+        raise vol.Invalid('{} is not a serial port'.format(value))
+    return cv.isdevice(value)
 
 
 def is_socket_address(value):
diff --git a/homeassistant/components/nest/config_flow.py b/homeassistant/components/nest/config_flow.py
index b5c095f34b8..f97e0dc8ff5 100644
--- a/homeassistant/components/nest/config_flow.py
+++ b/homeassistant/components/nest/config_flow.py
@@ -65,14 +65,14 @@ class NestFlowHandler(data_entry_flow.FlowHandler):
         if self.hass.config_entries.async_entries(DOMAIN):
             return self.async_abort(reason='already_setup')
 
-        elif not flows:
+        if not flows:
             return self.async_abort(reason='no_flows')
 
-        elif len(flows) == 1:
+        if len(flows) == 1:
             self.flow_impl = list(flows)[0]
             return await self.async_step_link()
 
-        elif user_input is not None:
+        if user_input is not None:
             self.flow_impl = user_input['flow_impl']
             return await self.async_step_link()
 
diff --git a/homeassistant/components/netgear_lte.py b/homeassistant/components/netgear_lte.py
index d6bd83dd41f..7f54e6fd6f9 100644
--- a/homeassistant/components/netgear_lte.py
+++ b/homeassistant/components/netgear_lte.py
@@ -61,7 +61,7 @@ class LTEData:
         """Get the requested or the only modem_data value."""
         if CONF_HOST in config:
             return self.modem_data.get(config[CONF_HOST])
-        elif len(self.modem_data) == 1:
+        if len(self.modem_data) == 1:
             return next(iter(self.modem_data.values()))
 
         return None
diff --git a/homeassistant/components/notify/html5.py b/homeassistant/components/notify/html5.py
index 7529608387d..e280aa67e40 100644
--- a/homeassistant/components/notify/html5.py
+++ b/homeassistant/components/notify/html5.py
@@ -280,7 +280,7 @@ class HTML5PushCallbackView(HomeAssistantView):
             return self.json_message('Authorization header must '
                                      'start with Bearer',
                                      status_code=HTTP_UNAUTHORIZED)
-        elif len(parts) != 2:
+        if len(parts) != 2:
             return self.json_message('Authorization header must '
                                      'be Bearer token',
                                      status_code=HTTP_UNAUTHORIZED)
diff --git a/homeassistant/components/notify/rest.py b/homeassistant/components/notify/rest.py
index 40b09dc3c72..dd35f986f78 100644
--- a/homeassistant/components/notify/rest.py
+++ b/homeassistant/components/notify/rest.py
@@ -95,7 +95,7 @@ class RestNotificationService(BaseNotificationService):
                 """Recursive template creator helper function."""
                 if isinstance(value, list):
                     return [_data_template_creator(item) for item in value]
-                elif isinstance(value, dict):
+                if isinstance(value, dict):
                     return {key: _data_template_creator(item)
                             for key, item in value.items()}
                 value.hass = self._hass
diff --git a/homeassistant/components/notify/telegram.py b/homeassistant/components/notify/telegram.py
index 899ccf9b09a..b012506acd9 100644
--- a/homeassistant/components/notify/telegram.py
+++ b/homeassistant/components/notify/telegram.py
@@ -73,7 +73,7 @@ class TelegramNotificationService(BaseNotificationService):
                 self.hass.services.call(
                     DOMAIN, 'send_photo', service_data=service_data)
             return
-        elif data is not None and ATTR_VIDEO in data:
+        if data is not None and ATTR_VIDEO in data:
             videos = data.get(ATTR_VIDEO, None)
             videos = videos if isinstance(videos, list) else [videos]
             for video_data in videos:
@@ -81,11 +81,11 @@ class TelegramNotificationService(BaseNotificationService):
                 self.hass.services.call(
                     DOMAIN, 'send_video', service_data=service_data)
             return
-        elif data is not None and ATTR_LOCATION in data:
+        if data is not None and ATTR_LOCATION in data:
             service_data.update(data.get(ATTR_LOCATION))
             return self.hass.services.call(
                 DOMAIN, 'send_location', service_data=service_data)
-        elif data is not None and ATTR_DOCUMENT in data:
+        if data is not None and ATTR_DOCUMENT in data:
             service_data.update(data.get(ATTR_DOCUMENT))
             return self.hass.services.call(
                 DOMAIN, 'send_document', service_data=service_data)
diff --git a/homeassistant/components/notify/twitter.py b/homeassistant/components/notify/twitter.py
index e38e7fcaa0f..6076cd5393a 100644
--- a/homeassistant/components/notify/twitter.py
+++ b/homeassistant/components/notify/twitter.py
@@ -194,9 +194,9 @@ class TwitterNotificationService(BaseNotificationService):
 
         if media_type.startswith('image/gif'):
             return 'tweet_gif'
-        elif media_type.startswith('video/'):
+        if media_type.startswith('video/'):
             return 'tweet_video'
-        elif media_type.startswith('image/'):
+        if media_type.startswith('image/'):
             return 'tweet_image'
 
         return None
diff --git a/homeassistant/components/octoprint.py b/homeassistant/components/octoprint.py
index bc936265f6f..ff52ad94d8b 100644
--- a/homeassistant/components/octoprint.py
+++ b/homeassistant/components/octoprint.py
@@ -154,7 +154,7 @@ def get_value_from_json(json_dict, sensor_type, group, tool):
             return 0
         return json_dict[group][sensor_type]
 
-    elif tool is not None:
+    if tool is not None:
         if sensor_type in json_dict[group][tool]:
             return json_dict[group][tool][sensor_type]
 
diff --git a/homeassistant/components/rachio.py b/homeassistant/components/rachio.py
index 90854efe8b1..7162913087d 100644
--- a/homeassistant/components/rachio.py
+++ b/homeassistant/components/rachio.py
@@ -122,8 +122,7 @@ def setup(hass, config) -> bool:
         _LOGGER.error("No Rachio devices found in account %s",
                       person.username)
         return False
-    else:
-        _LOGGER.info("%d Rachio device(s) found", len(person.controllers))
+    _LOGGER.info("%d Rachio device(s) found", len(person.controllers))
 
     # Enable component
     hass.data[DOMAIN] = person
diff --git a/homeassistant/components/recorder/__init__.py b/homeassistant/components/recorder/__init__.py
index 43c2aa5c7b1..60df6327009 100644
--- a/homeassistant/components/recorder/__init__.py
+++ b/homeassistant/components/recorder/__init__.py
@@ -284,7 +284,7 @@ class Recorder(threading.Thread):
                 self._close_connection()
                 self.queue.task_done()
                 return
-            elif isinstance(event, PurgeTask):
+            if isinstance(event, PurgeTask):
                 purge.purge_old_data(self, event.keep_days, event.repack)
                 self.queue.task_done()
                 continue
diff --git a/homeassistant/components/recorder/models.py b/homeassistant/components/recorder/models.py
index 32d6291b90c..e7948446231 100644
--- a/homeassistant/components/recorder/models.py
+++ b/homeassistant/components/recorder/models.py
@@ -168,7 +168,7 @@ def _process_timestamp(ts):
     """Process a timestamp into datetime object."""
     if ts is None:
         return None
-    elif ts.tzinfo is None:
+    if ts.tzinfo is None:
         return dt_util.UTC.localize(ts)
 
     return dt_util.as_utc(ts)
diff --git a/homeassistant/components/rflink.py b/homeassistant/components/rflink.py
index 272a5b868ec..b8af971b3ff 100644
--- a/homeassistant/components/rflink.py
+++ b/homeassistant/components/rflink.py
@@ -100,7 +100,7 @@ def identify_event_type(event):
     """
     if EVENT_KEY_COMMAND in event:
         return EVENT_KEY_COMMAND
-    elif EVENT_KEY_SENSOR in event:
+    if EVENT_KEY_SENSOR in event:
         return EVENT_KEY_SENSOR
     return 'unknown'
 
diff --git a/homeassistant/components/scene/lifx_cloud.py b/homeassistant/components/scene/lifx_cloud.py
index 6fe91d0acd2..a9ec1ef679c 100644
--- a/homeassistant/components/scene/lifx_cloud.py
+++ b/homeassistant/components/scene/lifx_cloud.py
@@ -58,7 +58,7 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
             devices.append(LifxCloudScene(hass, headers, timeout, scene))
         async_add_devices(devices)
         return True
-    elif status == 401:
+    if status == 401:
         _LOGGER.error("Unauthorized (bad token?) on %s", url)
         return False
 
diff --git a/homeassistant/components/sensor/abode.py b/homeassistant/components/sensor/abode.py
index b51ab288c1a..26247c77454 100644
--- a/homeassistant/components/sensor/abode.py
+++ b/homeassistant/components/sensor/abode.py
@@ -67,9 +67,9 @@ class AbodeSensor(AbodeDevice):
         """Return the state of the sensor."""
         if self._sensor_type == 'temp':
             return self._device.temp
-        elif self._sensor_type == 'humidity':
+        if self._sensor_type == 'humidity':
             return self._device.humidity
-        elif self._sensor_type == 'lux':
+        if self._sensor_type == 'lux':
             return self._device.lux
 
     @property
@@ -77,7 +77,7 @@ class AbodeSensor(AbodeDevice):
         """Return the units of measurement."""
         if self._sensor_type == 'temp':
             return self._device.temp_unit
-        elif self._sensor_type == 'humidity':
+        if self._sensor_type == 'humidity':
             return self._device.humidity_unit
-        elif self._sensor_type == 'lux':
+        if self._sensor_type == 'lux':
             return self._device.lux_unit
diff --git a/homeassistant/components/sensor/api_streams.py b/homeassistant/components/sensor/api_streams.py
index a8ef179280b..0d193dee79b 100644
--- a/homeassistant/components/sensor/api_streams.py
+++ b/homeassistant/components/sensor/api_streams.py
@@ -38,9 +38,9 @@ class StreamHandler(logging.Handler):
         else:
             if not record.msg.startswith('WS'):
                 return
-            elif len(record.args) < 2:
+            if len(record.args) < 2:
                 return
-            elif record.args[1] == 'Connected':
+            if record.args[1] == 'Connected':
                 self.entity.count += 1
             elif record.args[1] == 'Closed connection':
                 self.entity.count -= 1
diff --git a/homeassistant/components/sensor/arlo.py b/homeassistant/components/sensor/arlo.py
index eeb0c966ab4..6d764b1c916 100644
--- a/homeassistant/components/sensor/arlo.py
+++ b/homeassistant/components/sensor/arlo.py
@@ -123,7 +123,7 @@ class ArloSensor(Entity):
         """Return the device class of the sensor."""
         if self._sensor_type == 'temperature':
             return DEVICE_CLASS_TEMPERATURE
-        elif self._sensor_type == 'humidity':
+        if self._sensor_type == 'humidity':
             return DEVICE_CLASS_HUMIDITY
         return None
 
diff --git a/homeassistant/components/sensor/buienradar.py b/homeassistant/components/sensor/buienradar.py
index e366a83a65d..33c7e432fca 100644
--- a/homeassistant/components/sensor/buienradar.py
+++ b/homeassistant/components/sensor/buienradar.py
@@ -262,13 +262,13 @@ class BrSensor(Entity):
                         self._entity_picture = img
                         return True
                 return False
-            else:
-                try:
-                    self._state = data.get(FORECAST)[fcday].get(self.type[:-3])
-                    return True
-                except IndexError:
-                    _LOGGER.warning("No forecast for fcday=%s...", fcday)
-                    return False
+
+            try:
+                self._state = data.get(FORECAST)[fcday].get(self.type[:-3])
+                return True
+            except IndexError:
+                _LOGGER.warning("No forecast for fcday=%s...", fcday)
+                return False
 
         if self.type == SYMBOL or self.type.startswith(CONDITION):
             # update weather symbol & status text
diff --git a/homeassistant/components/sensor/currencylayer.py b/homeassistant/components/sensor/currencylayer.py
index 0834bbc99d8..4a7face0156 100644
--- a/homeassistant/components/sensor/currencylayer.py
+++ b/homeassistant/components/sensor/currencylayer.py
@@ -54,8 +54,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
         sensors.append(CurrencylayerSensor(rest, base, variable))
     if 'error' in response.json():
         return False
-    else:
-        add_devices(sensors, True)
+    add_devices(sensors, True)
 
 
 class CurrencylayerSensor(Entity):
diff --git a/homeassistant/components/sensor/darksky.py b/homeassistant/components/sensor/darksky.py
index 2e57e1bd447..b2bb7bb4da2 100644
--- a/homeassistant/components/sensor/darksky.py
+++ b/homeassistant/components/sensor/darksky.py
@@ -352,12 +352,12 @@ class DarkSkySensor(Entity):
         # percentages
         if self.type in ['precip_probability', 'cloud_cover', 'humidity']:
             return round(state * 100, 1)
-        elif (self.type in ['dew_point', 'temperature', 'apparent_temperature',
-                            'temperature_min', 'temperature_max',
-                            'apparent_temperature_min',
-                            'apparent_temperature_max',
-                            'precip_accumulation',
-                            'pressure', 'ozone', 'uvIndex']):
+        if self.type in ['dew_point', 'temperature', 'apparent_temperature',
+                         'temperature_min', 'temperature_max',
+                         'apparent_temperature_min',
+                         'apparent_temperature_max',
+                         'precip_accumulation',
+                         'pressure', 'ozone', 'uvIndex']:
             return round(state, 1)
         return state
 
diff --git a/homeassistant/components/sensor/dovado.py b/homeassistant/components/sensor/dovado.py
index ee2292d4122..2a78d4ad864 100644
--- a/homeassistant/components/sensor/dovado.py
+++ b/homeassistant/components/sensor/dovado.py
@@ -129,17 +129,16 @@ class DovadoSensor(Entity):
         if self._sensor == SENSOR_NETWORK:
             match = re.search(r"\((.+)\)", state)
             return match.group(1) if match else None
-        elif self._sensor == SENSOR_SIGNAL:
+        if self._sensor == SENSOR_SIGNAL:
             try:
                 return int(state.split()[0])
             except ValueError:
                 return 0
-        elif self._sensor == SENSOR_SMS_UNREAD:
+        if self._sensor == SENSOR_SMS_UNREAD:
             return int(state)
-        elif self._sensor in [SENSOR_UPLOAD, SENSOR_DOWNLOAD]:
+        if self._sensor in [SENSOR_UPLOAD, SENSOR_DOWNLOAD]:
             return round(float(state) / 1e6, 1)
-        else:
-            return state
+        return state
 
     def update(self):
         """Update sensor values."""
diff --git a/homeassistant/components/sensor/dsmr.py b/homeassistant/components/sensor/dsmr.py
index d7982f1c9db..3a1bf1da39e 100644
--- a/homeassistant/components/sensor/dsmr.py
+++ b/homeassistant/components/sensor/dsmr.py
@@ -255,7 +255,7 @@ class DSMREntity(Entity):
             return ICON_POWER_FAILURE
         if 'Power' in self._name:
             return ICON_POWER
-        elif 'Gas' in self._name:
+        if 'Gas' in self._name:
             return ICON_GAS
 
     @property
@@ -285,7 +285,7 @@ class DSMREntity(Entity):
         # used for normal rate.
         if value == '0002':
             return 'normal'
-        elif value == '0001':
+        if value == '0001':
             return 'low'
 
         return STATE_UNKNOWN
diff --git a/homeassistant/components/sensor/eight_sleep.py b/homeassistant/components/sensor/eight_sleep.py
index fd7c1aee3ae..5899ef267cb 100644
--- a/homeassistant/components/sensor/eight_sleep.py
+++ b/homeassistant/components/sensor/eight_sleep.py
@@ -149,7 +149,7 @@ class EightUserSensor(EightSleepUserEntity):
         """Return the unit the value is expressed in."""
         if 'current_sleep' in self._sensor or 'last_sleep' in self._sensor:
             return 'Score'
-        elif 'bed_temp' in self._sensor:
+        if 'bed_temp' in self._sensor:
             if self._units == 'si':
                 return '°C'
             return '°F'
diff --git a/homeassistant/components/sensor/fritzbox_netmonitor.py b/homeassistant/components/sensor/fritzbox_netmonitor.py
index 857e6cc4a07..b980323abe1 100644
--- a/homeassistant/components/sensor/fritzbox_netmonitor.py
+++ b/homeassistant/components/sensor/fritzbox_netmonitor.py
@@ -65,8 +65,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
     if fstatus is None:
         _LOGGER.error("Failed to establish connection to FRITZ!Box: %s", host)
         return 1
-    else:
-        _LOGGER.info("Successfully connected to FRITZ!Box")
+    _LOGGER.info("Successfully connected to FRITZ!Box")
 
     add_devices([FritzboxMonitorSensor(name, fstatus)], True)
 
diff --git a/homeassistant/components/sensor/gpsd.py b/homeassistant/components/sensor/gpsd.py
index 1d270419933..f463d0fb8d1 100644
--- a/homeassistant/components/sensor/gpsd.py
+++ b/homeassistant/components/sensor/gpsd.py
@@ -91,7 +91,7 @@ class GpsdSensor(Entity):
         """Return the state of GPSD."""
         if self.agps_thread.data_stream.mode == 3:
             return "3D Fix"
-        elif self.agps_thread.data_stream.mode == 2:
+        if self.agps_thread.data_stream.mode == 2:
             return "2D Fix"
         return STATE_UNKNOWN
 
diff --git a/homeassistant/components/sensor/history_stats.py b/homeassistant/components/sensor/history_stats.py
index f1f12b6ecab..c3d0fe8f1b6 100644
--- a/homeassistant/components/sensor/history_stats.py
+++ b/homeassistant/components/sensor/history_stats.py
@@ -294,7 +294,7 @@ class HistoryStatsHelper:
         minutes, seconds = divmod(seconds, 60)
         if days > 0:
             return '%dd %dh %dm' % (days, hours, minutes)
-        elif hours > 0:
+        if hours > 0:
             return '%dh %dm' % (hours, minutes)
         return '%dm' % minutes
 
diff --git a/homeassistant/components/sensor/hive.py b/homeassistant/components/sensor/hive.py
index 8c9409ef5ff..2d609070415 100644
--- a/homeassistant/components/sensor/hive.py
+++ b/homeassistant/components/sensor/hive.py
@@ -55,7 +55,7 @@ class HiveSensorEntity(Entity):
         """Return the state of the sensor."""
         if self.device_type == "Hub_OnlineStatus":
             return self.session.sensor.hub_online_status(self.node_id)
-        elif self.device_type == "Hive_OutsideTemperature":
+        if self.device_type == "Hive_OutsideTemperature":
             return self.session.weather.temperature()
 
     @property
diff --git a/homeassistant/components/sensor/isy994.py b/homeassistant/components/sensor/isy994.py
index 3eabce9458c..19dcfc87014 100644
--- a/homeassistant/components/sensor/isy994.py
+++ b/homeassistant/components/sensor/isy994.py
@@ -262,10 +262,8 @@ class ISYSensorDevice(ISYDevice):
                 if friendly_name in (TEMP_CELSIUS, TEMP_FAHRENHEIT):
                     friendly_name = self.hass.config.units.temperature_unit
                 return friendly_name
-            else:
-                return self._node.uom[0]
-        else:
-            return None
+            return self._node.uom[0]
+        return None
 
     @property
     def state(self) -> str:
diff --git a/homeassistant/components/sensor/mfi.py b/homeassistant/components/sensor/mfi.py
index ab6bd8270ce..f575768b505 100644
--- a/homeassistant/components/sensor/mfi.py
+++ b/homeassistant/components/sensor/mfi.py
@@ -96,7 +96,7 @@ class MfiSensor(Entity):
             tag = None
         if tag is None:
             return STATE_OFF
-        elif self._port.model == 'Input Digital':
+        if self._port.model == 'Input Digital':
             return STATE_ON if self._port.value > 0 else STATE_OFF
         digits = DIGITS.get(self._port.tag, 0)
         return round(self._port.value, digits)
@@ -111,9 +111,9 @@ class MfiSensor(Entity):
 
         if tag == 'temperature':
             return TEMP_CELSIUS
-        elif tag == 'active_pwr':
+        if tag == 'active_pwr':
             return 'Watts'
-        elif self._port.model == 'Input Digital':
+        if self._port.model == 'Input Digital':
             return 'State'
         return tag
 
diff --git a/homeassistant/components/sensor/mold_indicator.py b/homeassistant/components/sensor/mold_indicator.py
index 62d8af2ee8f..319185923cd 100644
--- a/homeassistant/components/sensor/mold_indicator.py
+++ b/homeassistant/components/sensor/mold_indicator.py
@@ -107,11 +107,10 @@ class MoldIndicator(Entity):
         # convert to celsius if necessary
         if unit == TEMP_FAHRENHEIT:
             return util.temperature.fahrenheit_to_celsius(temp)
-        elif unit == TEMP_CELSIUS:
+        if unit == TEMP_CELSIUS:
             return temp
-        else:
-            _LOGGER.error("Temp sensor has unsupported unit: %s (allowed: %s, "
-                          "%s)", unit, TEMP_CELSIUS, TEMP_FAHRENHEIT)
+        _LOGGER.error("Temp sensor has unsupported unit: %s (allowed: %s, "
+                      "%s)", unit, TEMP_CELSIUS, TEMP_FAHRENHEIT)
 
         return None
 
diff --git a/homeassistant/components/sensor/moon.py b/homeassistant/components/sensor/moon.py
index d909eb3c0f2..50f4f72078c 100644
--- a/homeassistant/components/sensor/moon.py
+++ b/homeassistant/components/sensor/moon.py
@@ -51,17 +51,17 @@ class MoonSensor(Entity):
         """Return the state of the device."""
         if self._state == 0:
             return 'new_moon'
-        elif self._state < 7:
+        if self._state < 7:
             return 'waxing_crescent'
-        elif self._state == 7:
+        if self._state == 7:
             return 'first_quarter'
-        elif self._state < 14:
+        if self._state < 14:
             return 'waxing_gibbous'
-        elif self._state == 14:
+        if self._state == 14:
             return 'full_moon'
-        elif self._state < 21:
+        if self._state < 21:
             return 'waning_gibbous'
-        elif self._state == 21:
+        if self._state == 21:
             return 'last_quarter'
         return 'waning_crescent'
 
diff --git a/homeassistant/components/sensor/nut.py b/homeassistant/components/sensor/nut.py
index ff0cd8ef891..7126bd89ef9 100644
--- a/homeassistant/components/sensor/nut.py
+++ b/homeassistant/components/sensor/nut.py
@@ -236,13 +236,12 @@ class NUTSensor(Entity):
         """Return UPS display state."""
         if self._data.status is None:
             return STATE_TYPES['OFF']
-        else:
-            try:
-                return " ".join(
-                    STATE_TYPES[state]
-                    for state in self._data.status[KEY_STATUS].split())
-            except KeyError:
-                return STATE_UNKNOWN
+        try:
+            return " ".join(
+                STATE_TYPES[state]
+                for state in self._data.status[KEY_STATUS].split())
+        except KeyError:
+            return STATE_UNKNOWN
 
     def update(self):
         """Get the latest status and use it to update our sensor state."""
diff --git a/homeassistant/components/sensor/octoprint.py b/homeassistant/components/sensor/octoprint.py
index df181c67c03..9e62846e4d3 100644
--- a/homeassistant/components/sensor/octoprint.py
+++ b/homeassistant/components/sensor/octoprint.py
@@ -112,8 +112,7 @@ class OctoPrintSensor(Entity):
             if self._state is None:
                 self._state = 0
             return round(self._state, 2)
-        else:
-            return self._state
+        return self._state
 
     @property
     def unit_of_measurement(self):
diff --git a/homeassistant/components/sensor/openhardwaremonitor.py b/homeassistant/components/sensor/openhardwaremonitor.py
index dc221f6b07d..1b345c752ff 100644
--- a/homeassistant/components/sensor/openhardwaremonitor.py
+++ b/homeassistant/components/sensor/openhardwaremonitor.py
@@ -101,11 +101,10 @@ class OpenHardwareMonitorDevice(Entity):
 
                 self.attributes = _attributes
                 return
-            else:
-                array = array[path_number][OHM_CHILDREN]
-                _attributes.update({
-                    'level_%s' % path_index: values[OHM_NAME]
-                })
+            array = array[path_number][OHM_CHILDREN]
+            _attributes.update({
+                'level_%s' % path_index: values[OHM_NAME]
+            })
 
 
 class OpenHardwareMonitorData:
diff --git a/homeassistant/components/sensor/qnap.py b/homeassistant/components/sensor/qnap.py
index a44823d86ba..8b25eb3de31 100644
--- a/homeassistant/components/sensor/qnap.py
+++ b/homeassistant/components/sensor/qnap.py
@@ -241,7 +241,7 @@ class QNAPCPUSensor(QNAPSensor):
         """Return the state of the sensor."""
         if self.var_id == 'cpu_temp':
             return self._api.data['system_stats']['cpu']['temp_c']
-        elif self.var_id == 'cpu_usage':
+        if self.var_id == 'cpu_usage':
             return self._api.data['system_stats']['cpu']['usage_percent']
 
 
diff --git a/homeassistant/components/sensor/snmp.py b/homeassistant/components/sensor/snmp.py
index 0ba74f0e7ed..5600f906f34 100644
--- a/homeassistant/components/sensor/snmp.py
+++ b/homeassistant/components/sensor/snmp.py
@@ -83,11 +83,10 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
     if errindication and not accept_errors:
         _LOGGER.error("Please check the details in the configuration file")
         return False
-    else:
-        data = SnmpData(
-            host, port, community, baseoid, version, accept_errors,
-            default_value)
-        add_devices([SnmpSensor(data, name, unit, value_template)], True)
+    data = SnmpData(
+        host, port, community, baseoid, version, accept_errors,
+        default_value)
+    add_devices([SnmpSensor(data, name, unit, value_template)], True)
 
 
 class SnmpSensor(Entity):
diff --git a/homeassistant/components/sensor/synologydsm.py b/homeassistant/components/sensor/synologydsm.py
index 124cec97617..d431805ab19 100644
--- a/homeassistant/components/sensor/synologydsm.py
+++ b/homeassistant/components/sensor/synologydsm.py
@@ -214,7 +214,7 @@ class SynoNasUtilSensor(SynoNasSensor):
 
             if self.var_id in network_sensors:
                 return round(attr / 1024.0, 1)
-            elif self.var_id in memory_sensors:
+            if self.var_id in memory_sensors:
                 return round(attr / 1024.0 / 1024.0, 1)
         else:
             return getattr(self._api.utilisation, self.var_id)
diff --git a/homeassistant/components/sensor/tado.py b/homeassistant/components/sensor/tado.py
index 737b3d08368..aa6314b8c5b 100644
--- a/homeassistant/components/sensor/tado.py
+++ b/homeassistant/components/sensor/tado.py
@@ -122,9 +122,9 @@ class TadoSensor(Entity):
         """Return the unit of measurement."""
         if self.zone_variable == "temperature":
             return self.hass.config.units.temperature_unit
-        elif self.zone_variable == "humidity":
+        if self.zone_variable == "humidity":
             return '%'
-        elif self.zone_variable == "heating":
+        if self.zone_variable == "heating":
             return '%'
 
     @property
@@ -132,7 +132,7 @@ class TadoSensor(Entity):
         """Icon for the sensor."""
         if self.zone_variable == "temperature":
             return 'mdi:thermometer'
-        elif self.zone_variable == "humidity":
+        if self.zone_variable == "humidity":
             return 'mdi:water-percent'
 
     def update(self):
diff --git a/homeassistant/components/sensor/tahoma.py b/homeassistant/components/sensor/tahoma.py
index aedecfe61e5..6c6c296652a 100644
--- a/homeassistant/components/sensor/tahoma.py
+++ b/homeassistant/components/sensor/tahoma.py
@@ -46,11 +46,11 @@ class TahomaSensor(TahomaDevice, Entity):
         """Return the unit of measurement of this entity, if any."""
         if self.tahoma_device.type == 'Temperature Sensor':
             return None
-        elif self.tahoma_device.type == 'io:SomfyContactIOSystemSensor':
+        if self.tahoma_device.type == 'io:SomfyContactIOSystemSensor':
             return None
-        elif self.tahoma_device.type == 'io:LightIOSystemSensor':
+        if self.tahoma_device.type == 'io:LightIOSystemSensor':
             return 'lx'
-        elif self.tahoma_device.type == 'Humidity Sensor':
+        if self.tahoma_device.type == 'Humidity Sensor':
             return '%'
 
     def update(self):
diff --git a/homeassistant/components/sensor/tellduslive.py b/homeassistant/components/sensor/tellduslive.py
index 048ca988e3d..123c11021b4 100644
--- a/homeassistant/components/sensor/tellduslive.py
+++ b/homeassistant/components/sensor/tellduslive.py
@@ -96,11 +96,11 @@ class TelldusLiveSensor(TelldusLiveEntity):
         """Return the state of the sensor."""
         if not self.available:
             return None
-        elif self._type == SENSOR_TYPE_TEMPERATURE:
+        if self._type == SENSOR_TYPE_TEMPERATURE:
             return self._value_as_temperature
-        elif self._type == SENSOR_TYPE_HUMIDITY:
+        if self._type == SENSOR_TYPE_HUMIDITY:
             return self._value_as_humidity
-        elif self._type == SENSOR_TYPE_LUMINANCE:
+        if self._type == SENSOR_TYPE_LUMINANCE:
             return self._value_as_luminance
         return self._value
 
diff --git a/homeassistant/components/sensor/time_date.py b/homeassistant/components/sensor/time_date.py
index bfdf0c3c3aa..0668b5bdbce 100644
--- a/homeassistant/components/sensor/time_date.py
+++ b/homeassistant/components/sensor/time_date.py
@@ -81,7 +81,7 @@ class TimeDateSensor(Entity):
         """Icon to use in the frontend, if any."""
         if 'date' in self.type and 'time' in self.type:
             return 'mdi:calendar-clock'
-        elif 'date' in self.type:
+        if 'date' in self.type:
             return 'mdi:calendar'
         return 'mdi:clock'
 
@@ -92,7 +92,7 @@ class TimeDateSensor(Entity):
         if self.type == 'date':
             now = dt_util.start_of_local_day(dt_util.as_local(now))
             return now + timedelta(seconds=86400)
-        elif self.type == 'beat':
+        if self.type == 'beat':
             interval = 86.4
         else:
             interval = 60
diff --git a/homeassistant/components/sensor/vera.py b/homeassistant/components/sensor/vera.py
index 4fc92db1d90..eaef3dcf7f7 100644
--- a/homeassistant/components/sensor/vera.py
+++ b/homeassistant/components/sensor/vera.py
@@ -51,13 +51,13 @@ class VeraSensor(VeraDevice, Entity):
         import pyvera as veraApi
         if self.vera_device.category == veraApi.CATEGORY_TEMPERATURE_SENSOR:
             return self._temperature_units
-        elif self.vera_device.category == veraApi.CATEGORY_LIGHT_SENSOR:
+        if self.vera_device.category == veraApi.CATEGORY_LIGHT_SENSOR:
             return 'lx'
-        elif self.vera_device.category == veraApi.CATEGORY_UV_SENSOR:
+        if self.vera_device.category == veraApi.CATEGORY_UV_SENSOR:
             return 'level'
-        elif self.vera_device.category == veraApi.CATEGORY_HUMIDITY_SENSOR:
+        if self.vera_device.category == veraApi.CATEGORY_HUMIDITY_SENSOR:
             return '%'
-        elif self.vera_device.category == veraApi.CATEGORY_POWER_METER:
+        if self.vera_device.category == veraApi.CATEGORY_POWER_METER:
             return 'watts'
 
     def update(self):
diff --git a/homeassistant/components/sensor/volvooncall.py b/homeassistant/components/sensor/volvooncall.py
index 343bcdf2033..78e8a7e76c6 100644
--- a/homeassistant/components/sensor/volvooncall.py
+++ b/homeassistant/components/sensor/volvooncall.py
@@ -43,7 +43,7 @@ class VolvoSensor(VolvoEntity):
             if 'mil' in self.unit_of_measurement:
                 return round(val, 2)
             return round(val, 1)
-        elif self._attribute == 'distance_to_empty':
+        if self._attribute == 'distance_to_empty':
             return int(floor(val))
         return int(round(val))
 
diff --git a/homeassistant/components/sensor/worldtidesinfo.py b/homeassistant/components/sensor/worldtidesinfo.py
index 05d61173da0..597a971e208 100644
--- a/homeassistant/components/sensor/worldtidesinfo.py
+++ b/homeassistant/components/sensor/worldtidesinfo.py
@@ -85,7 +85,7 @@ class WorldTidesInfoSensor(Entity):
                 tidetime = time.strftime('%I:%M %p', time.localtime(
                     self.data['extremes'][0]['dt']))
                 return "High tide at %s" % (tidetime)
-            elif "Low" in str(self.data['extremes'][0]['type']):
+            if "Low" in str(self.data['extremes'][0]['type']):
                 tidetime = time.strftime('%I:%M %p', time.localtime(
                     self.data['extremes'][0]['dt']))
                 return "Low tide at %s" % (tidetime)
diff --git a/homeassistant/components/sensor/worxlandroid.py b/homeassistant/components/sensor/worxlandroid.py
index ddf506bf4eb..c49ce36bd49 100644
--- a/homeassistant/components/sensor/worxlandroid.py
+++ b/homeassistant/components/sensor/worxlandroid.py
@@ -152,11 +152,11 @@ class WorxLandroidSensor(Entity):
 
             if state_obj[14] == 1:
                 return 'manual-stop'
-            elif state_obj[5] == 1 and state_obj[13] == 0:
+            if state_obj[5] == 1 and state_obj[13] == 0:
                 return 'charging'
-            elif state_obj[5] == 1 and state_obj[13] == 1:
+            if state_obj[5] == 1 and state_obj[13] == 1:
                 return 'charging-complete'
-            elif state_obj[15] == 1:
+            if state_obj[15] == 1:
                 return 'going-home'
             return 'mowing'
 
diff --git a/homeassistant/components/sensor/xiaomi_aqara.py b/homeassistant/components/sensor/xiaomi_aqara.py
index 3192d0d2f60..32139b21976 100644
--- a/homeassistant/components/sensor/xiaomi_aqara.py
+++ b/homeassistant/components/sensor/xiaomi_aqara.py
@@ -91,9 +91,9 @@ class XiaomiSensor(XiaomiDevice):
             value = max(value - 300, 0)
         if self._data_key == 'temperature' and (value < -50 or value > 60):
             return False
-        elif self._data_key == 'humidity' and (value <= 0 or value > 100):
+        if self._data_key == 'humidity' and (value <= 0 or value > 100):
             return False
-        elif self._data_key == 'pressure' and value == 0:
+        if self._data_key == 'pressure' and value == 0:
             return False
         self._state = round(value, 1)
         return True
diff --git a/homeassistant/components/sensor/zwave.py b/homeassistant/components/sensor/zwave.py
index d2166dde64e..c6356efe157 100644
--- a/homeassistant/components/sensor/zwave.py
+++ b/homeassistant/components/sensor/zwave.py
@@ -64,7 +64,7 @@ class ZWaveMultilevelSensor(ZWaveSensor):
         """Return the state of the sensor."""
         if self._units in ('C', 'F'):
             return round(self._state, 1)
-        elif isinstance(self._state, float):
+        if isinstance(self._state, float):
             return round(self._state, 2)
 
         return self._state
@@ -74,7 +74,7 @@ class ZWaveMultilevelSensor(ZWaveSensor):
         """Return the unit the value is expressed in."""
         if self._units == 'C':
             return TEMP_CELSIUS
-        elif self._units == 'F':
+        if self._units == 'F':
             return TEMP_FAHRENHEIT
         return self._units
 
diff --git a/homeassistant/components/switch/wemo.py b/homeassistant/components/switch/wemo.py
index c189c312b25..35ea435bf48 100644
--- a/homeassistant/components/switch/wemo.py
+++ b/homeassistant/components/switch/wemo.py
@@ -166,9 +166,9 @@ class WemoSwitch(SwitchDevice):
             standby_state = int(self.insight_params['state'])
             if standby_state == WEMO_ON:
                 return STATE_ON
-            elif standby_state == WEMO_OFF:
+            if standby_state == WEMO_OFF:
                 return STATE_OFF
-            elif standby_state == WEMO_STANDBY:
+            if standby_state == WEMO_STANDBY:
                 return STATE_STANDBY
             return STATE_UNKNOWN
 
diff --git a/homeassistant/components/telegram_bot/__init__.py b/homeassistant/components/telegram_bot/__init__.py
index b9329a46b72..53695102601 100644
--- a/homeassistant/components/telegram_bot/__init__.py
+++ b/homeassistant/components/telegram_bot/__init__.py
@@ -502,7 +502,7 @@ class TelegramNotificationService:
                                   text, chat_id=chat_id, message_id=message_id,
                                   inline_message_id=inline_message_id,
                                   **params)
-        elif type_edit == SERVICE_EDIT_CAPTION:
+        if type_edit == SERVICE_EDIT_CAPTION:
             func_send = self.bot.editMessageCaption
             params[ATTR_CAPTION] = kwargs.get(ATTR_CAPTION)
         else:
diff --git a/homeassistant/components/telegram_bot/polling.py b/homeassistant/components/telegram_bot/polling.py
index ba8dc54b264..6ee42b32504 100644
--- a/homeassistant/components/telegram_bot/polling.py
+++ b/homeassistant/components/telegram_bot/polling.py
@@ -92,8 +92,7 @@ class TelegramPoll(BaseTelegramBotEntity):
             if resp.status == 200:
                 _json = yield from resp.json()
                 return _json
-            else:
-                raise WrongHttpStatus('wrong status {}'.format(resp.status))
+            raise WrongHttpStatus('wrong status {}'.format(resp.status))
         finally:
             if resp is not None:
                 yield from resp.release()
diff --git a/homeassistant/components/tellduslive.py b/homeassistant/components/tellduslive.py
index bb235647d1b..c2b7ba9ba0f 100644
--- a/homeassistant/components/tellduslive.py
+++ b/homeassistant/components/tellduslive.py
@@ -240,11 +240,11 @@ class TelldusLiveClient:
             from tellduslive import (DIM, UP, TURNON)
             if device.methods & DIM:
                 return 'light'
-            elif device.methods & UP:
+            if device.methods & UP:
                 return 'cover'
-            elif device.methods & TURNON:
+            if device.methods & TURNON:
                 return 'switch'
-            elif device.methods == 0:
+            if device.methods == 0:
                 return 'binary_sensor'
             _LOGGER.warning(
                 "Unidentified device type (methods: %d)", device.methods)
@@ -349,9 +349,9 @@ class TelldusLiveEntity(Entity):
                                  BATTERY_OK)
         if self.device.battery == BATTERY_LOW:
             return 1
-        elif self.device.battery == BATTERY_UNKNOWN:
+        if self.device.battery == BATTERY_UNKNOWN:
             return None
-        elif self.device.battery == BATTERY_OK:
+        if self.device.battery == BATTERY_OK:
             return 100
         return self.device.battery  # Percentage
 
diff --git a/homeassistant/components/volvooncall.py b/homeassistant/components/volvooncall.py
index 6557be2fb1b..0ce8870bedf 100644
--- a/homeassistant/components/volvooncall.py
+++ b/homeassistant/components/volvooncall.py
@@ -136,12 +136,11 @@ class VolvoData:
         if (vehicle.registration_number and
                 vehicle.registration_number.lower()) in self.names:
             return self.names[vehicle.registration_number.lower()]
-        elif (vehicle.vin and
-              vehicle.vin.lower() in self.names):
+        if vehicle.vin and vehicle.vin.lower() in self.names:
             return self.names[vehicle.vin.lower()]
-        elif vehicle.registration_number:
+        if vehicle.registration_number:
             return vehicle.registration_number
-        elif vehicle.vin:
+        if vehicle.vin:
             return vehicle.vin
         return ''
 
diff --git a/homeassistant/components/wink/__init__.py b/homeassistant/components/wink/__init__.py
index a8acc437546..c996572bf51 100644
--- a/homeassistant/components/wink/__init__.py
+++ b/homeassistant/components/wink/__init__.py
@@ -173,10 +173,9 @@ def _request_app_setup(hass, config):
                        ATTR_CLIENT_SECRET: client_secret})
             setup(hass, config)
             return
-        else:
-            error_msg = "Your input was invalid. Please try again."
-            _configurator = hass.data[DOMAIN]['configuring'][DOMAIN]
-            configurator.notify_errors(_configurator, error_msg)
+        error_msg = "Your input was invalid. Please try again."
+        _configurator = hass.data[DOMAIN]['configuring'][DOMAIN]
+        configurator.notify_errors(_configurator, error_msg)
 
     start_url = "{}{}".format(hass.config.api.base_url,
                               WINK_AUTH_CALLBACK_PATH)
diff --git a/homeassistant/components/zwave/util.py b/homeassistant/components/zwave/util.py
index b62eeb67d32..312d72575a9 100644
--- a/homeassistant/components/zwave/util.py
+++ b/homeassistant/components/zwave/util.py
@@ -82,7 +82,7 @@ async def check_has_unique_id(entity, ready_callback, timeout_callback, loop):
         if entity.unique_id:
             ready_callback(waited)
             return
-        elif waited >= const.NODE_READY_WAIT_SECS:
+        if waited >= const.NODE_READY_WAIT_SECS:
             # Wait up to NODE_READY_WAIT_SECS seconds for unique_id to appear.
             timeout_callback(waited)
             return
diff --git a/homeassistant/config.py b/homeassistant/config.py
index 230a10498f3..d458ce44d37 100644
--- a/homeassistant/config.py
+++ b/homeassistant/config.py
@@ -572,8 +572,7 @@ def _recursive_merge(conf, package):
         else:
             if conf.get(key) is not None:
                 return key
-            else:
-                conf[key] = pack_conf
+            conf[key] = pack_conf
     return error
 
 
diff --git a/homeassistant/helpers/condition.py b/homeassistant/helpers/condition.py
index 504c9d4b067..930f68c3da4 100644
--- a/homeassistant/helpers/condition.py
+++ b/homeassistant/helpers/condition.py
@@ -257,13 +257,13 @@ def sun(hass, before=None, after=None, before_offset=None, after_offset=None):
     if before == SUN_EVENT_SUNRISE and utcnow > sunrise + before_offset:
         return False
 
-    elif before == SUN_EVENT_SUNSET and utcnow > sunset + before_offset:
+    if before == SUN_EVENT_SUNSET and utcnow > sunset + before_offset:
         return False
 
     if after == SUN_EVENT_SUNRISE and utcnow < sunrise + after_offset:
         return False
 
-    elif after == SUN_EVENT_SUNSET and utcnow < sunset + after_offset:
+    if after == SUN_EVENT_SUNSET and utcnow < sunset + after_offset:
         return False
 
     return True
diff --git a/homeassistant/helpers/config_validation.py b/homeassistant/helpers/config_validation.py
index 0bd490940a9..056d45ad656 100644
--- a/homeassistant/helpers/config_validation.py
+++ b/homeassistant/helpers/config_validation.py
@@ -361,7 +361,7 @@ def temperature_unit(value) -> str:
     value = str(value).upper()
     if value == 'C':
         return TEMP_CELSIUS
-    elif value == 'F':
+    if value == 'F':
         return TEMP_FAHRENHEIT
     raise vol.Invalid('invalid temperature unit (expected C or F)')
 
@@ -435,15 +435,14 @@ def socket_timeout(value):
     """
     if value is None:
         return _GLOBAL_DEFAULT_TIMEOUT
-    else:
-        try:
-            float_value = float(value)
-            if float_value > 0.0:
-                return float_value
-            raise vol.Invalid('Invalid socket timeout value.'
-                              ' float > 0.0 required.')
-        except Exception as _:
-            raise vol.Invalid('Invalid socket timeout: {err}'.format(err=_))
+    try:
+        float_value = float(value)
+        if float_value > 0.0:
+            return float_value
+        raise vol.Invalid('Invalid socket timeout value.'
+                          ' float > 0.0 required.')
+    except Exception as _:
+        raise vol.Invalid('Invalid socket timeout: {err}'.format(err=_))
 
 
 # pylint: disable=no-value-for-parameter
diff --git a/homeassistant/helpers/data_entry_flow.py b/homeassistant/helpers/data_entry_flow.py
index 5a0b2ca56ea..4f412eb58e7 100644
--- a/homeassistant/helpers/data_entry_flow.py
+++ b/homeassistant/helpers/data_entry_flow.py
@@ -23,7 +23,7 @@ class _BaseFlowManagerView(HomeAssistantView):
             data.pop('data')
             return data
 
-        elif result['type'] != data_entry_flow.RESULT_TYPE_FORM:
+        if result['type'] != data_entry_flow.RESULT_TYPE_FORM:
             return result
 
         import voluptuous_serialize
diff --git a/homeassistant/helpers/deprecation.py b/homeassistant/helpers/deprecation.py
index 73a09464439..8b621b2f01c 100644
--- a/homeassistant/helpers/deprecation.py
+++ b/homeassistant/helpers/deprecation.py
@@ -33,8 +33,7 @@ def deprecated_substitute(substitute_name):
 
                 # Return the old property
                 return getattr(self, substitute_name)
-            else:
-                return func(self)
+            return func(self)
         return func_wrapper
     return decorator
 
diff --git a/homeassistant/helpers/event.py b/homeassistant/helpers/event.py
index 712b48da0d7..c8488fa3334 100644
--- a/homeassistant/helpers/event.py
+++ b/homeassistant/helpers/event.py
@@ -374,7 +374,7 @@ def _process_state_match(parameter):
     if parameter is None or parameter == MATCH_ALL:
         return lambda _: True
 
-    elif isinstance(parameter, str) or not hasattr(parameter, '__iter__'):
+    if isinstance(parameter, str) or not hasattr(parameter, '__iter__'):
         return lambda state: state == parameter
 
     parameter = tuple(parameter)
@@ -386,11 +386,11 @@ def _process_time_match(parameter):
     if parameter is None or parameter == MATCH_ALL:
         return lambda _: True
 
-    elif isinstance(parameter, str) and parameter.startswith('/'):
+    if isinstance(parameter, str) and parameter.startswith('/'):
         parameter = float(parameter[1:])
         return lambda time: time % parameter == 0
 
-    elif isinstance(parameter, str) or not hasattr(parameter, '__iter__'):
+    if isinstance(parameter, str) or not hasattr(parameter, '__iter__'):
         return lambda time: time == parameter
 
     parameter = tuple(parameter)
diff --git a/homeassistant/helpers/script.py b/homeassistant/helpers/script.py
index f2ae36e7fd0..a139be4b260 100644
--- a/homeassistant/helpers/script.py
+++ b/homeassistant/helpers/script.py
@@ -119,7 +119,7 @@ class Script():
                     self.hass.async_add_job(self._change_listener)
                 return
 
-            elif CONF_WAIT_TEMPLATE in action:
+            if CONF_WAIT_TEMPLATE in action:
                 # Call ourselves in the future to continue work
                 wait_template = action[CONF_WAIT_TEMPLATE]
                 wait_template.hass = self.hass
@@ -147,7 +147,7 @@ class Script():
 
                 return
 
-            elif CONF_CONDITION in action:
+            if CONF_CONDITION in action:
                 if not self._async_check_condition(action, variables):
                     break
 
diff --git a/homeassistant/helpers/service.py b/homeassistant/helpers/service.py
index e10d608fc62..8aa3b553f3a 100644
--- a/homeassistant/helpers/service.py
+++ b/homeassistant/helpers/service.py
@@ -103,12 +103,10 @@ def extract_entity_ids(hass, service_call, expand_group=True):
         return [ent_id for ent_id in
                 group.expand_entity_ids(service_ent_id)]
 
-    else:
-
-        if isinstance(service_ent_id, str):
-            return [service_ent_id]
+    if isinstance(service_ent_id, str):
+        return [service_ent_id]
 
-        return service_ent_id
+    return service_ent_id
 
 
 @bind_hass
diff --git a/homeassistant/helpers/state.py b/homeassistant/helpers/state.py
index b2360f3aca5..4a3f915e810 100644
--- a/homeassistant/helpers/state.py
+++ b/homeassistant/helpers/state.py
@@ -214,9 +214,9 @@ def state_as_number(state):
     if state.state in (STATE_ON, STATE_LOCKED, STATE_ABOVE_HORIZON,
                        STATE_OPEN, STATE_HOME, STATE_HEAT, STATE_COOL):
         return 1
-    elif state.state in (STATE_OFF, STATE_UNLOCKED, STATE_UNKNOWN,
-                         STATE_BELOW_HORIZON, STATE_CLOSED, STATE_NOT_HOME,
-                         STATE_IDLE):
+    if state.state in (STATE_OFF, STATE_UNLOCKED, STATE_UNKNOWN,
+                       STATE_BELOW_HORIZON, STATE_CLOSED, STATE_NOT_HOME,
+                       STATE_IDLE):
         return 0
 
     return float(state.state)
diff --git a/homeassistant/helpers/template.py b/homeassistant/helpers/template.py
index 4d09416398b..ea620c9bccd 100644
--- a/homeassistant/helpers/template.py
+++ b/homeassistant/helpers/template.py
@@ -51,7 +51,7 @@ def render_complex(value, variables=None):
     if isinstance(value, list):
         return [render_complex(item, variables)
                 for item in value]
-    elif isinstance(value, dict):
+    if isinstance(value, dict):
         return {key: render_complex(item, variables)
                 for key, item in value.items()}
     return value.async_render(variables)
@@ -318,7 +318,7 @@ class TemplateMethods:
             if point_state is None:
                 _LOGGER.warning("Closest:Unable to find state %s", args[0])
                 return None
-            elif not loc_helper.has_location(point_state):
+            if not loc_helper.has_location(point_state):
                 _LOGGER.warning(
                     "Closest:State does not contain valid location: %s",
                     point_state)
@@ -420,7 +420,7 @@ class TemplateMethods:
         """Return state or entity_id if given."""
         if isinstance(entity_id_or_state, State):
             return entity_id_or_state
-        elif isinstance(entity_id_or_state, str):
+        if isinstance(entity_id_or_state, str):
             return self._hass.states.get(entity_id_or_state)
         return None
 
diff --git a/homeassistant/remote.py b/homeassistant/remote.py
index b8e6a862b46..7147fab1080 100644
--- a/homeassistant/remote.py
+++ b/homeassistant/remote.py
@@ -117,9 +117,9 @@ class JSONEncoder(json.JSONEncoder):
         """
         if isinstance(o, datetime):
             return o.isoformat()
-        elif isinstance(o, set):
+        if isinstance(o, set):
             return list(o)
-        elif hasattr(o, 'as_dict'):
+        if hasattr(o, 'as_dict'):
             return o.as_dict()
 
         return json.JSONEncoder.default(self, o)
@@ -133,7 +133,7 @@ def validate_api(api):
         if req.status_code == 200:
             return APIStatus.OK
 
-        elif req.status_code == 401:
+        if req.status_code == 401:
             return APIStatus.INVALID_PASSWORD
 
         return APIStatus.UNKNOWN
diff --git a/homeassistant/scripts/macos/__init__.py b/homeassistant/scripts/macos/__init__.py
index 275a33627a9..6c6557897ee 100644
--- a/homeassistant/scripts/macos/__init__.py
+++ b/homeassistant/scripts/macos/__init__.py
@@ -52,10 +52,10 @@ def run(args):
     if args[0] == 'install':
         install_osx()
         return 0
-    elif args[0] == 'uninstall':
+    if args[0] == 'uninstall':
         uninstall_osx()
         return 0
-    elif args[0] == 'restart':
+    if args[0] == 'restart':
         uninstall_osx()
         # A small delay is needed on some systems to let the unload finish.
         time.sleep(0.5)
diff --git a/homeassistant/setup.py b/homeassistant/setup.py
index 45482d5d14e..0641a461130 100644
--- a/homeassistant/setup.py
+++ b/homeassistant/setup.py
@@ -157,7 +157,7 @@ async def _async_setup_component(hass: core.HomeAssistant,
     if result is False:
         log_error("Component failed to initialize.")
         return False
-    elif result is not True:
+    if result is not True:
         log_error("Component did not return boolean if setup was successful. "
                   "Disabling component.")
         loader.set_component(hass, domain, None)
@@ -204,7 +204,7 @@ async def async_prepare_setup_platform(hass: core.HomeAssistant, config,
         return None
 
     # Already loaded
-    elif platform_path in hass.config.components:
+    if platform_path in hass.config.components:
         return platform
 
     try:
diff --git a/homeassistant/util/__init__.py b/homeassistant/util/__init__.py
index a1c0fb0024c..6b539e99186 100644
--- a/homeassistant/util/__init__.py
+++ b/homeassistant/util/__init__.py
@@ -56,7 +56,7 @@ def repr_helper(inp: Any) -> str:
         return ", ".join(
             repr_helper(key)+"="+repr_helper(item) for key, item
             in inp.items())
-    elif isinstance(inp, datetime):
+    if isinstance(inp, datetime):
         return as_local(inp).isoformat()
 
     return str(inp)
diff --git a/homeassistant/util/dt.py b/homeassistant/util/dt.py
index 0f07a90e9bb..bae38f27ee2 100644
--- a/homeassistant/util/dt.py
+++ b/homeassistant/util/dt.py
@@ -65,7 +65,7 @@ def as_utc(dattim: dt.datetime) -> dt.datetime:
     """
     if dattim.tzinfo == UTC:
         return dattim
-    elif dattim.tzinfo is None:
+    if dattim.tzinfo is None:
         dattim = DEFAULT_TIME_ZONE.localize(dattim)  # type: ignore
 
     return dattim.astimezone(UTC)
@@ -86,7 +86,7 @@ def as_local(dattim: dt.datetime) -> dt.datetime:
     """Convert a UTC datetime object to local time zone."""
     if dattim.tzinfo == DEFAULT_TIME_ZONE:
         return dattim
-    elif dattim.tzinfo is None:
+    if dattim.tzinfo is None:
         dattim = UTC.localize(dattim)
 
     return dattim.astimezone(DEFAULT_TIME_ZONE)
diff --git a/homeassistant/util/temperature.py b/homeassistant/util/temperature.py
index 913d6456906..6e2b378b218 100644
--- a/homeassistant/util/temperature.py
+++ b/homeassistant/util/temperature.py
@@ -29,6 +29,6 @@ def convert(temperature: float, from_unit: str, to_unit: str,
 
     if from_unit == to_unit:
         return temperature
-    elif from_unit == TEMP_CELSIUS:
+    if from_unit == TEMP_CELSIUS:
         return celsius_to_fahrenheit(temperature, interval)
     return fahrenheit_to_celsius(temperature, interval)
diff --git a/homeassistant/util/yaml.py b/homeassistant/util/yaml.py
index ddf7eb44601..7ce16600e1b 100644
--- a/homeassistant/util/yaml.py
+++ b/homeassistant/util/yaml.py
@@ -216,11 +216,10 @@ def _env_var_yaml(loader: SafeLineLoader,
     # Check for a default value
     if len(args) > 1:
         return os.getenv(args[0], ' '.join(args[1:]))
-    elif args[0] in os.environ:
+    if args[0] in os.environ:
         return os.environ[args[0]]
-    else:
-        _LOGGER.error("Environment variable %s not defined.", node.value)
-        raise HomeAssistantError(node.value)
+    _LOGGER.error("Environment variable %s not defined.", node.value)
+    raise HomeAssistantError(node.value)
 
 
 def _load_secret_yaml(secret_path: str) -> Dict:
diff --git a/pylintrc b/pylintrc
index d47437cb121..1e9e490adfe 100644
--- a/pylintrc
+++ b/pylintrc
@@ -4,7 +4,6 @@
 # duplicate-code - unavoidable
 # cyclic-import - doesn't test if both import on load
 # abstract-class-little-used - prevents from setting right foundation
-# abstract-class-not-used - is flaky, should not show up but does
 # unused-argument - generic callbacks and setup methods create a lot of warnings
 # global-statement - used for the on-demand requirement installation
 # redefined-variable-type - this is Python, we're duck typing!
@@ -14,7 +13,6 @@
 # inconsistent-return-statements - doesn't handle raise
 disable=
   abstract-class-little-used,
-  abstract-class-not-used,
   abstract-method,
   cyclic-import,
   duplicate-code,
diff --git a/tests/common.py b/tests/common.py
index 3e8e813164e..314799b185b 100644
--- a/tests/common.py
+++ b/tests/common.py
@@ -496,14 +496,13 @@ class MockToggleDevice(entity.ToggleEntity):
         """Return the last call."""
         if not self.calls:
             return None
-        elif method is None:
+        if method is None:
             return self.calls[-1]
-        else:
-            try:
-                return next(call for call in reversed(self.calls)
-                            if call[0] == method)
-            except StopIteration:
-                return None
+        try:
+            return next(call for call in reversed(self.calls)
+                        if call[0] == method)
+        except StopIteration:
+            return None
 
 
 class MockConfigEntry(config_entries.ConfigEntry):
diff --git a/tests/components/alexa/test_smart_home.py b/tests/components/alexa/test_smart_home.py
index ce4ec5aa146..cf8535653a9 100644
--- a/tests/components/alexa/test_smart_home.py
+++ b/tests/components/alexa/test_smart_home.py
@@ -124,7 +124,7 @@ def discovery_test(device, hass, expected_endpoints=1):
 
     if expected_endpoints == 1:
         return endpoints[0]
-    elif expected_endpoints > 1:
+    if expected_endpoints > 1:
         return endpoints
     return None
 
diff --git a/tests/components/camera/test_uvc.py b/tests/components/camera/test_uvc.py
index 2de0782fd91..18292d32a02 100644
--- a/tests/components/camera/test_uvc.py
+++ b/tests/components/camera/test_uvc.py
@@ -45,8 +45,7 @@ class TestUVCSetup(unittest.TestCase):
             """Create a mock camera."""
             if uuid == 'id3':
                 return {'model': 'airCam'}
-            else:
-                return {'model': 'UVC'}
+            return {'model': 'UVC'}
 
         mock_remote.return_value.index.return_value = mock_cameras
         mock_remote.return_value.get_camera.side_effect = mock_get_camera
diff --git a/tests/components/device_tracker/test_tomato.py b/tests/components/device_tracker/test_tomato.py
index cce39ce43a7..0c20350a845 100644
--- a/tests/components/device_tracker/test_tomato.py
+++ b/tests/components/device_tracker/test_tomato.py
@@ -22,9 +22,9 @@ def mock_session_response(*args, **kwargs):
     # Password: bar
     if args[0].headers['Authorization'] != 'Basic Zm9vOmJhcg==':
         return MockSessionResponse(None, 401)
-    elif "gimmie_bad_data" in args[0].body:
+    if "gimmie_bad_data" in args[0].body:
         return MockSessionResponse('This shouldn\'t (wldev = be here.;', 200)
-    elif "gimmie_good_data" in args[0].body:
+    if "gimmie_good_data" in args[0].body:
         return MockSessionResponse(
             "wldev = [ ['eth1','F4:F5:D8:AA:AA:AA',"
             "-42,5500,1000,7043,0],['eth1','58:EF:68:00:00:00',"
diff --git a/tests/components/device_tracker/test_xiaomi.py b/tests/components/device_tracker/test_xiaomi.py
index bdd921f395f..0705fb2c399 100644
--- a/tests/components/device_tracker/test_xiaomi.py
+++ b/tests/components/device_tracker/test_xiaomi.py
@@ -55,21 +55,21 @@ def mocked_requests(*args, **kwargs):
             "code": "401",
             "msg": "Invalid token"
         }, 200)
-    elif data and data.get('username', None) == TOKEN_TIMEOUT_USERNAME:
+    if data and data.get('username', None) == TOKEN_TIMEOUT_USERNAME:
         # deliver an expired token
         return MockResponse({
             "url": "/cgi-bin/luci/;stok=ef5860/web/home",
             "token": "timedOut",
             "code": "0"
         }, 200)
-    elif str(args[0]).startswith(URL_AUTHORIZE):
+    if str(args[0]).startswith(URL_AUTHORIZE):
         # deliver an authorized token
         return MockResponse({
             "url": "/cgi-bin/luci/;stok=ef5860/web/home",
             "token": "ef5860",
             "code": "0"
         }, 200)
-    elif str(args[0]).endswith("timedOut/" + URL_LIST_END) \
+    if str(args[0]).endswith("timedOut/" + URL_LIST_END) \
             and FIRST_CALL is True:
         FIRST_CALL = False
         # deliver an error when called with expired token
@@ -77,7 +77,7 @@ def mocked_requests(*args, **kwargs):
             "code": "401",
             "msg": "Invalid token"
         }, 200)
-    elif str(args[0]).endswith(URL_LIST_END):
+    if str(args[0]).endswith(URL_LIST_END):
         # deliver the device list
         return MockResponse({
             "mac": "1C:98:EC:0E:D5:A4",
@@ -149,8 +149,7 @@ def mocked_requests(*args, **kwargs):
             ],
             "code": 0
         }, 200)
-    else:
-        _LOGGER.debug('UNKNOWN ROUTE')
+    _LOGGER.debug('UNKNOWN ROUTE')
 
 
 class TestXiaomiDeviceScanner(unittest.TestCase):
diff --git a/tests/components/light/test_hue.py b/tests/components/light/test_hue.py
index a1e3867f9c3..db8d7e5f1e1 100644
--- a/tests/components/light/test_hue.py
+++ b/tests/components/light/test_hue.py
@@ -182,7 +182,7 @@ def mock_bridge(hass):
 
         if path == 'lights':
             return bridge.mock_light_responses.popleft()
-        elif path == 'groups':
+        if path == 'groups':
             return bridge.mock_group_responses.popleft()
         return None
 
diff --git a/tests/components/notify/test_group.py b/tests/components/notify/test_group.py
index a847de51142..8e7ef4348f7 100644
--- a/tests/components/notify/test_group.py
+++ b/tests/components/notify/test_group.py
@@ -26,8 +26,7 @@ class TestNotifyGroup(unittest.TestCase):
         def mock_get_service(hass, config, discovery_info=None):
             if config['name'] == 'demo1':
                 return self.service1
-            else:
-                return self.service2
+            return self.service2
 
         with assert_setup_component(2), \
                 patch.object(demo, 'get_service', mock_get_service):
diff --git a/tests/components/recorder/models_original.py b/tests/components/recorder/models_original.py
index 31ec5ee7ed7..990414d7713 100644
--- a/tests/components/recorder/models_original.py
+++ b/tests/components/recorder/models_original.py
@@ -157,7 +157,6 @@ def _process_timestamp(ts):
     """Process a timestamp into datetime object."""
     if ts is None:
         return None
-    elif ts.tzinfo is None:
+    if ts.tzinfo is None:
         return dt_util.UTC.localize(ts)
-    else:
-        return dt_util.as_utc(ts)
+    return dt_util.as_utc(ts)
diff --git a/tests/components/sensor/test_radarr.py b/tests/components/sensor/test_radarr.py
index 94eeafad7b1..0d6aca9d0b7 100644
--- a/tests/components/sensor/test_radarr.py
+++ b/tests/components/sensor/test_radarr.py
@@ -83,7 +83,7 @@ def mocked_requests_get(*args, **kwargs):
                 "id": 12
             }
         ], 200)
-    elif 'api/command' in url:
+    if 'api/command' in url:
         return MockResponse([
             {
                 "name": "RescanMovie",
@@ -94,7 +94,7 @@ def mocked_requests_get(*args, **kwargs):
                 "id": 24
             }
         ], 200)
-    elif 'api/movie' in url:
+    if 'api/movie' in url:
         return MockResponse([
             {
                 "title": "Assassin's Creed",
@@ -149,7 +149,7 @@ def mocked_requests_get(*args, **kwargs):
                 "id": 1
             }
         ], 200)
-    elif 'api/diskspace' in url:
+    if 'api/diskspace' in url:
         return MockResponse([
             {
                 "path": "/data",
@@ -158,7 +158,7 @@ def mocked_requests_get(*args, **kwargs):
                 "totalSpace": 499738734592
             }
         ], 200)
-    elif 'api/system/status' in url:
+    if 'api/system/status' in url:
         return MockResponse({
             "version": "0.2.0.210",
             "buildTime": "2017-01-22T23:12:49Z",
@@ -182,10 +182,9 @@ def mocked_requests_get(*args, **kwargs):
                                "(Stable 4.6.1.3/abb06f1 "
                                "Mon Oct  3 07:57:59 UTC 2016)")
         }, 200)
-    else:
-        return MockResponse({
-            "error": "Unauthorized"
-        }, 401)
+    return MockResponse({
+        "error": "Unauthorized"
+    }, 401)
 
 
 class TestRadarrSetup(unittest.TestCase):
diff --git a/tests/components/sensor/test_sonarr.py b/tests/components/sensor/test_sonarr.py
index 9e2050e850c..275bb4a1e8b 100644
--- a/tests/components/sensor/test_sonarr.py
+++ b/tests/components/sensor/test_sonarr.py
@@ -139,7 +139,7 @@ def mocked_requests_get(*args, **kwargs):
                 "id": 14402
             }
         ], 200)
-    elif 'api/command' in url:
+    if 'api/command' in url:
         return MockResponse([
             {
                 "name": "RescanSeries",
@@ -150,7 +150,7 @@ def mocked_requests_get(*args, **kwargs):
                 "id": 24
             }
         ], 200)
-    elif 'api/wanted/missing' in url or 'totalRecords' in url:
+    if 'api/wanted/missing' in url or 'totalRecords' in url:
         return MockResponse(
             {
                 "page": 1,
@@ -325,7 +325,7 @@ def mocked_requests_get(*args, **kwargs):
                     }
                 ]
             }, 200)
-    elif 'api/queue' in url:
+    if 'api/queue' in url:
         return MockResponse([
             {
                 "series": {
@@ -449,7 +449,7 @@ def mocked_requests_get(*args, **kwargs):
                 "id": 1503378561
             }
         ], 200)
-    elif 'api/series' in url:
+    if 'api/series' in url:
         return MockResponse([
             {
                 "title": "Marvel's Daredevil",
@@ -540,7 +540,7 @@ def mocked_requests_get(*args, **kwargs):
                 "id": 7
             }
         ], 200)
-    elif 'api/diskspace' in url:
+    if 'api/diskspace' in url:
         return MockResponse([
             {
                 "path": "/data",
@@ -549,7 +549,7 @@ def mocked_requests_get(*args, **kwargs):
                 "totalSpace": 499738734592
             }
         ], 200)
-    elif 'api/system/status' in url:
+    if 'api/system/status' in url:
         return MockResponse({
             "version": "2.0.0.1121",
             "buildTime": "2014-02-08T20:49:36.5560392Z",
@@ -568,10 +568,9 @@ def mocked_requests_get(*args, **kwargs):
             "startOfWeek": 0,
             "urlBase": ""
         }, 200)
-    else:
-        return MockResponse({
-            "error": "Unauthorized"
-        }, 401)
+    return MockResponse({
+        "error": "Unauthorized"
+    }, 401)
 
 
 class TestSonarrSetup(unittest.TestCase):
diff --git a/tests/components/switch/test_flux.py b/tests/components/switch/test_flux.py
index 61e665f265c..155ed85dac2 100644
--- a/tests/components/switch/test_flux.py
+++ b/tests/components/switch/test_flux.py
@@ -92,8 +92,7 @@ class TestSwitchFlux(unittest.TestCase):
         def event_date(hass, event, now=None):
             if event == 'sunrise':
                 return sunrise_time
-            else:
-                return sunset_time
+            return sunset_time
 
         with patch('homeassistant.util.dt.now', return_value=test_time):
             with patch('homeassistant.helpers.sun.get_astral_event_date',
@@ -134,8 +133,7 @@ class TestSwitchFlux(unittest.TestCase):
         def event_date(hass, event, now=None):
             if event == 'sunrise':
                 return sunrise_time
-            else:
-                return sunset_time
+            return sunset_time
 
         with patch('homeassistant.util.dt.now', return_value=test_time):
             with patch('homeassistant.helpers.sun.get_astral_event_date',
@@ -181,8 +179,7 @@ class TestSwitchFlux(unittest.TestCase):
         def event_date(hass, event, now=None):
             if event == 'sunrise':
                 return sunrise_time
-            else:
-                return sunset_time
+            return sunset_time
 
         with patch('homeassistant.util.dt.now', return_value=test_time):
             with patch('homeassistant.helpers.sun.get_astral_event_date',
@@ -228,8 +225,7 @@ class TestSwitchFlux(unittest.TestCase):
         def event_date(hass, event, now=None):
             if event == 'sunrise':
                 return sunrise_time
-            else:
-                return sunset_time
+            return sunset_time
 
         with patch('homeassistant.util.dt.now', return_value=test_time):
             with patch('homeassistant.helpers.sun.get_astral_event_date',
@@ -276,8 +272,7 @@ class TestSwitchFlux(unittest.TestCase):
         def event_date(hass, event, now=None):
             if event == 'sunrise':
                 return sunrise_time
-            else:
-                return sunset_time
+            return sunset_time
 
         with patch('homeassistant.util.dt.now', return_value=test_time):
             with patch('homeassistant.helpers.sun.get_astral_event_date',
@@ -323,8 +318,7 @@ class TestSwitchFlux(unittest.TestCase):
         def event_date(hass, event, now=None):
             if event == 'sunrise':
                 return sunrise_time
-            else:
-                return sunset_time
+            return sunset_time
 
         with patch('homeassistant.util.dt.now', return_value=test_time):
             with patch('homeassistant.helpers.sun.get_astral_event_date',
@@ -374,8 +368,7 @@ class TestSwitchFlux(unittest.TestCase):
         def event_date(hass, event, now=None):
             if event == 'sunrise':
                 return sunrise_time
-            else:
-                return sunset_time
+            return sunset_time
 
         with patch('homeassistant.util.dt.now', return_value=test_time):
             with patch('homeassistant.helpers.sun.get_astral_event_date',
@@ -426,8 +419,7 @@ class TestSwitchFlux(unittest.TestCase):
         def event_date(hass, event, now=None):
             if event == 'sunrise':
                 return sunrise_time
-            else:
-                return sunset_time
+            return sunset_time
 
         with patch('homeassistant.util.dt.now', return_value=test_time):
             with patch('homeassistant.helpers.sun.get_astral_event_date',
@@ -477,8 +469,7 @@ class TestSwitchFlux(unittest.TestCase):
         def event_date(hass, event, now=None):
             if event == 'sunrise':
                 return sunrise_time
-            else:
-                return sunset_time
+            return sunset_time
 
         with patch('homeassistant.util.dt.now', return_value=test_time):
             with patch('homeassistant.helpers.sun.get_astral_event_date',
@@ -528,8 +519,7 @@ class TestSwitchFlux(unittest.TestCase):
         def event_date(hass, event, now=None):
             if event == 'sunrise':
                 return sunrise_time
-            else:
-                return sunset_time
+            return sunset_time
 
         with patch('homeassistant.util.dt.now', return_value=test_time):
             with patch('homeassistant.helpers.sun.get_astral_event_date',
@@ -579,8 +569,7 @@ class TestSwitchFlux(unittest.TestCase):
         def event_date(hass, event, now=None):
             if event == 'sunrise':
                 return sunrise_time
-            else:
-                return sunset_time
+            return sunset_time
 
         with patch('homeassistant.util.dt.now', return_value=test_time):
             with patch('homeassistant.helpers.sun.get_astral_event_date',
@@ -627,8 +616,7 @@ class TestSwitchFlux(unittest.TestCase):
         def event_date(hass, event, now=None):
             if event == 'sunrise':
                 return sunrise_time
-            else:
-                return sunset_time
+            return sunset_time
 
         with patch('homeassistant.util.dt.now', return_value=test_time):
             with patch('homeassistant.helpers.sun.get_astral_event_date',
@@ -677,8 +665,7 @@ class TestSwitchFlux(unittest.TestCase):
         def event_date(hass, event, now=None):
             if event == 'sunrise':
                 return sunrise_time
-            else:
-                return sunset_time
+            return sunset_time
 
         with patch('homeassistant.util.dt.now', return_value=test_time):
             with patch('homeassistant.helpers.sun.get_astral_event_date',
@@ -739,9 +726,8 @@ class TestSwitchFlux(unittest.TestCase):
             if event == 'sunrise':
                 print('sunrise {}'.format(sunrise_time))
                 return sunrise_time
-            else:
-                print('sunset {}'.format(sunset_time))
-                return sunset_time
+            print('sunset {}'.format(sunset_time))
+            return sunset_time
 
         with patch('homeassistant.util.dt.now', return_value=test_time):
             with patch('homeassistant.helpers.sun.get_astral_event_date',
@@ -793,8 +779,7 @@ class TestSwitchFlux(unittest.TestCase):
         def event_date(hass, event, now=None):
             if event == 'sunrise':
                 return sunrise_time
-            else:
-                return sunset_time
+            return sunset_time
 
         with patch('homeassistant.util.dt.now', return_value=test_time):
             with patch('homeassistant.helpers.sun.get_astral_event_date',
@@ -838,8 +823,7 @@ class TestSwitchFlux(unittest.TestCase):
         def event_date(hass, event, now=None):
             if event == 'sunrise':
                 return sunrise_time
-            else:
-                return sunset_time
+            return sunset_time
 
         with patch('homeassistant.util.dt.now', return_value=test_time):
             with patch('homeassistant.helpers.sun.get_astral_event_date',
diff --git a/tests/components/test_graphite.py b/tests/components/test_graphite.py
index 280704fdc31..892fe5b5f4d 100644
--- a/tests/components/test_graphite.py
+++ b/tests/components/test_graphite.py
@@ -224,13 +224,12 @@ class TestGraphite(unittest.TestCase):
         def fake_get():
             if len(runs) >= 2:
                 return self.gf._quit_object
-            elif runs:
+            if runs:
                 runs.append(1)
                 return mock.MagicMock(event_type='somethingelse',
                                       data={'new_event': None})
-            else:
-                runs.append(1)
-                return event
+            runs.append(1)
+            return event
 
         with mock.patch.object(self.gf, '_queue') as mock_queue:
             with mock.patch.object(self.gf, '_report_attributes') as mock_r:
-- 
GitLab