From 246338f93d1efdde1c0ac590a67535cd6a42fed5 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Wed, 5 Jan 2022 17:08:00 +0100 Subject: [PATCH] Use const imports [g-i] (#63468) --- homeassistant/components/group/cover.py | 16 +++++++------- homeassistant/components/group/light.py | 9 +++++--- .../components/group/media_player.py | 22 +++++++++---------- homeassistant/components/hive/water_heater.py | 4 +--- .../input_select/reproduce_state.py | 10 ++------- 5 files changed, 28 insertions(+), 33 deletions(-) diff --git a/homeassistant/components/group/cover.py b/homeassistant/components/group/cover.py index 8c4e260b8c12..1bf9e0d5cb3e 100644 --- a/homeassistant/components/group/cover.py +++ b/homeassistant/components/group/cover.py @@ -12,14 +12,6 @@ from homeassistant.components.cover import ( ATTR_TILT_POSITION, DOMAIN, PLATFORM_SCHEMA, - SERVICE_CLOSE_COVER, - SERVICE_CLOSE_COVER_TILT, - SERVICE_OPEN_COVER, - SERVICE_OPEN_COVER_TILT, - SERVICE_SET_COVER_POSITION, - SERVICE_SET_COVER_TILT_POSITION, - SERVICE_STOP_COVER, - SERVICE_STOP_COVER_TILT, SUPPORT_CLOSE, SUPPORT_CLOSE_TILT, SUPPORT_OPEN, @@ -37,6 +29,14 @@ from homeassistant.const import ( CONF_ENTITIES, CONF_NAME, CONF_UNIQUE_ID, + SERVICE_CLOSE_COVER, + SERVICE_CLOSE_COVER_TILT, + SERVICE_OPEN_COVER, + SERVICE_OPEN_COVER_TILT, + SERVICE_SET_COVER_POSITION, + SERVICE_SET_COVER_TILT_POSITION, + SERVICE_STOP_COVER, + SERVICE_STOP_COVER_TILT, STATE_CLOSED, STATE_CLOSING, STATE_OPEN, diff --git a/homeassistant/components/group/light.py b/homeassistant/components/group/light.py index 4a14bc5dcf3a..c40e426eb9eb 100644 --- a/homeassistant/components/group/light.py +++ b/homeassistant/components/group/light.py @@ -34,6 +34,7 @@ from homeassistant.components.light import ( SUPPORT_FLASH, SUPPORT_TRANSITION, SUPPORT_WHITE_VALUE, + LightEntity, ) from homeassistant.const import ( ATTR_ENTITY_ID, @@ -41,6 +42,8 @@ from homeassistant.const import ( CONF_ENTITIES, CONF_NAME, CONF_UNIQUE_ID, + SERVICE_TURN_OFF, + SERVICE_TURN_ON, STATE_ON, STATE_UNAVAILABLE, ) @@ -104,7 +107,7 @@ FORWARDED_ATTRIBUTES = frozenset( ) -class LightGroup(GroupEntity, light.LightEntity): +class LightGroup(GroupEntity, LightEntity): """Representation of a light group.""" _attr_available = False @@ -159,7 +162,7 @@ class LightGroup(GroupEntity, light.LightEntity): await self.hass.services.async_call( light.DOMAIN, - light.SERVICE_TURN_ON, + SERVICE_TURN_ON, data, blocking=True, context=self._context, @@ -174,7 +177,7 @@ class LightGroup(GroupEntity, light.LightEntity): await self.hass.services.async_call( light.DOMAIN, - light.SERVICE_TURN_OFF, + SERVICE_TURN_OFF, data, blocking=True, context=self._context, diff --git a/homeassistant/components/group/media_player.py b/homeassistant/components/group/media_player.py index 844e6e3799f8..0b30ebd7e514 100644 --- a/homeassistant/components/group/media_player.py +++ b/homeassistant/components/group/media_player.py @@ -16,18 +16,7 @@ from homeassistant.components.media_player import ( DOMAIN, PLATFORM_SCHEMA, SERVICE_CLEAR_PLAYLIST, - SERVICE_MEDIA_NEXT_TRACK, - SERVICE_MEDIA_PAUSE, - SERVICE_MEDIA_PLAY, - SERVICE_MEDIA_PREVIOUS_TRACK, - SERVICE_MEDIA_SEEK, - SERVICE_MEDIA_STOP, SERVICE_PLAY_MEDIA, - SERVICE_SHUFFLE_SET, - SERVICE_TURN_OFF, - SERVICE_TURN_ON, - SERVICE_VOLUME_MUTE, - SERVICE_VOLUME_SET, SUPPORT_CLEAR_PLAYLIST, SUPPORT_NEXT_TRACK, SUPPORT_PAUSE, @@ -50,6 +39,17 @@ from homeassistant.const import ( CONF_ENTITIES, CONF_NAME, CONF_UNIQUE_ID, + SERVICE_MEDIA_NEXT_TRACK, + SERVICE_MEDIA_PAUSE, + SERVICE_MEDIA_PLAY, + SERVICE_MEDIA_PREVIOUS_TRACK, + SERVICE_MEDIA_SEEK, + SERVICE_MEDIA_STOP, + SERVICE_SHUFFLE_SET, + SERVICE_TURN_OFF, + SERVICE_TURN_ON, + SERVICE_VOLUME_MUTE, + SERVICE_VOLUME_SET, STATE_OFF, STATE_ON, STATE_UNAVAILABLE, diff --git a/homeassistant/components/hive/water_heater.py b/homeassistant/components/hive/water_heater.py index ee491ca44331..deb36e0b0f26 100644 --- a/homeassistant/components/hive/water_heater.py +++ b/homeassistant/components/hive/water_heater.py @@ -5,13 +5,11 @@ import voluptuous as vol from homeassistant.components.water_heater import ( STATE_ECO, - STATE_OFF, - STATE_ON, SUPPORT_OPERATION_MODE, WaterHeaterEntity, ) from homeassistant.config_entries import ConfigEntry -from homeassistant.const import TEMP_CELSIUS +from homeassistant.const import STATE_OFF, STATE_ON, TEMP_CELSIUS from homeassistant.core import HomeAssistant from homeassistant.helpers import config_validation as cv, entity_platform from homeassistant.helpers.entity import DeviceInfo diff --git a/homeassistant/components/input_select/reproduce_state.py b/homeassistant/components/input_select/reproduce_state.py index 493980337fe0..5a8bd4651c56 100644 --- a/homeassistant/components/input_select/reproduce_state.py +++ b/homeassistant/components/input_select/reproduce_state.py @@ -7,16 +7,10 @@ import logging from types import MappingProxyType from typing import Any -from homeassistant.const import ATTR_ENTITY_ID +from homeassistant.const import ATTR_ENTITY_ID, ATTR_OPTION from homeassistant.core import Context, HomeAssistant, State -from . import ( - ATTR_OPTION, - ATTR_OPTIONS, - DOMAIN, - SERVICE_SELECT_OPTION, - SERVICE_SET_OPTIONS, -) +from . import ATTR_OPTIONS, DOMAIN, SERVICE_SELECT_OPTION, SERVICE_SET_OPTIONS ATTR_GROUP = [ATTR_OPTION, ATTR_OPTIONS]