diff --git a/homeassistant/components/mqtt/__init__.py b/homeassistant/components/mqtt/__init__.py index 098099f0a03..58c99aa7c00 100644 --- a/homeassistant/components/mqtt/__init__.py +++ b/homeassistant/components/mqtt/__init__.py @@ -19,6 +19,7 @@ from homeassistant import config_entries from homeassistant.components import websocket_api from homeassistant.const import ( CONF_CLIENT_ID, + CONF_DISCOVERY, CONF_PASSWORD, CONF_PAYLOAD, CONF_PORT, @@ -28,7 +29,6 @@ from homeassistant.const import ( EVENT_HOMEASSISTANT_STARTED, EVENT_HOMEASSISTANT_STOP, ) -from homeassistant.const import CONF_UNIQUE_ID # noqa: F401 from homeassistant.core import CoreState, Event, HassJob, ServiceCall, callback from homeassistant.exceptions import HomeAssistantError, Unauthorized from homeassistant.helpers import config_validation as cv, event, template @@ -48,7 +48,6 @@ from .const import ( ATTR_TOPIC, CONF_BIRTH_MESSAGE, CONF_BROKER, - CONF_DISCOVERY, CONF_QOS, CONF_RETAIN, CONF_STATE_TOPIC, @@ -1053,7 +1052,6 @@ async def websocket_subscribe(hass, connection, msg): @callback def async_subscribe_connection_status(hass, connection_status_callback): """Subscribe to MQTT connection changes.""" - connection_status_callback_job = HassJob(connection_status_callback) async def connected(): diff --git a/homeassistant/components/mqtt/alarm_control_panel.py b/homeassistant/components/mqtt/alarm_control_panel.py index 38fec57607e..2f2ba06d6d7 100644 --- a/homeassistant/components/mqtt/alarm_control_panel.py +++ b/homeassistant/components/mqtt/alarm_control_panel.py @@ -110,7 +110,6 @@ async def async_setup_platform( async def async_setup_entry(hass, config_entry, async_add_entities): """Set up MQTT alarm control panel dynamically through MQTT discovery.""" - setup = functools.partial( _async_setup_entity, hass, async_add_entities, config_entry=config_entry ) diff --git a/homeassistant/components/mqtt/binary_sensor.py b/homeassistant/components/mqtt/binary_sensor.py index d965401cef4..b9fb297cd5c 100644 --- a/homeassistant/components/mqtt/binary_sensor.py +++ b/homeassistant/components/mqtt/binary_sensor.py @@ -78,7 +78,6 @@ async def async_setup_platform( async def async_setup_entry(hass, config_entry, async_add_entities): """Set up MQTT binary sensor dynamically through MQTT discovery.""" - setup = functools.partial( _async_setup_entity, hass, async_add_entities, config_entry=config_entry ) @@ -214,7 +213,6 @@ class MqttBinarySensor(MqttEntity, BinarySensorEntity): @callback def _value_is_expired(self, *_): """Triggered when value is expired.""" - self._expiration_trigger = None self._expired = True diff --git a/homeassistant/components/mqtt/camera.py b/homeassistant/components/mqtt/camera.py index 21fcb9276dd..684e41214fe 100644 --- a/homeassistant/components/mqtt/camera.py +++ b/homeassistant/components/mqtt/camera.py @@ -52,7 +52,6 @@ async def async_setup_platform( async def async_setup_entry(hass, config_entry, async_add_entities): """Set up MQTT camera dynamically through MQTT discovery.""" - setup = functools.partial( _async_setup_entity, async_add_entities, config_entry=config_entry ) diff --git a/homeassistant/components/mqtt/climate.py b/homeassistant/components/mqtt/climate.py index 15c7c916eeb..ede39103791 100644 --- a/homeassistant/components/mqtt/climate.py +++ b/homeassistant/components/mqtt/climate.py @@ -38,6 +38,8 @@ from homeassistant.const import ( ATTR_TEMPERATURE, CONF_DEVICE, CONF_NAME, + CONF_PAYLOAD_OFF, + CONF_PAYLOAD_ON, CONF_TEMPERATURE_UNIT, CONF_UNIQUE_ID, CONF_VALUE_TEMPLATE, @@ -98,8 +100,6 @@ CONF_MODE_COMMAND_TOPIC = "mode_command_topic" CONF_MODE_LIST = "modes" CONF_MODE_STATE_TEMPLATE = "mode_state_template" CONF_MODE_STATE_TOPIC = "mode_state_topic" -CONF_PAYLOAD_OFF = "payload_off" -CONF_PAYLOAD_ON = "payload_on" CONF_POWER_COMMAND_TOPIC = "power_command_topic" CONF_POWER_STATE_TEMPLATE = "power_state_template" CONF_POWER_STATE_TOPIC = "power_state_topic" @@ -274,7 +274,6 @@ async def async_setup_platform( async def async_setup_entry(hass, config_entry, async_add_entities): """Set up MQTT climate device dynamically through MQTT discovery.""" - setup = functools.partial( _async_setup_entity, hass, async_add_entities, config_entry=config_entry ) diff --git a/homeassistant/components/mqtt/config_flow.py b/homeassistant/components/mqtt/config_flow.py index 5c4016437a6..c71541b58b0 100644 --- a/homeassistant/components/mqtt/config_flow.py +++ b/homeassistant/components/mqtt/config_flow.py @@ -7,6 +7,7 @@ import voluptuous as vol from homeassistant import config_entries from homeassistant.const import ( + CONF_DISCOVERY, CONF_HOST, CONF_PASSWORD, CONF_PAYLOAD, @@ -22,7 +23,6 @@ from .const import ( ATTR_TOPIC, CONF_BIRTH_MESSAGE, CONF_BROKER, - CONF_DISCOVERY, CONF_WILL_MESSAGE, DATA_MQTT_CONFIG, DEFAULT_BIRTH, diff --git a/homeassistant/components/mqtt/const.py b/homeassistant/components/mqtt/const.py index 3e56ab6caf9..6c334eca311 100644 --- a/homeassistant/components/mqtt/const.py +++ b/homeassistant/components/mqtt/const.py @@ -11,7 +11,6 @@ ATTR_TOPIC = "topic" CONF_BROKER = "broker" CONF_BIRTH_MESSAGE = "birth_message" -CONF_DISCOVERY = "discovery" CONF_QOS = ATTR_QOS CONF_RETAIN = ATTR_RETAIN CONF_STATE_TOPIC = "state_topic" diff --git a/homeassistant/components/mqtt/cover.py b/homeassistant/components/mqtt/cover.py index 4b428027a4d..54ef6cfb539 100644 --- a/homeassistant/components/mqtt/cover.py +++ b/homeassistant/components/mqtt/cover.py @@ -207,7 +207,6 @@ async def async_setup_platform( async def async_setup_entry(hass, config_entry, async_add_entities): """Set up MQTT cover dynamically through MQTT discovery.""" - setup = functools.partial( _async_setup_entity, hass, async_add_entities, config_entry=config_entry ) diff --git a/homeassistant/components/mqtt/device_tracker/schema_discovery.py b/homeassistant/components/mqtt/device_tracker/schema_discovery.py index 8b51b9fac0e..296f66889b3 100644 --- a/homeassistant/components/mqtt/device_tracker/schema_discovery.py +++ b/homeassistant/components/mqtt/device_tracker/schema_discovery.py @@ -59,7 +59,6 @@ PLATFORM_SCHEMA_DISCOVERY = ( async def async_setup_entry_from_discovery(hass, config_entry, async_add_entities): """Set up MQTT device tracker dynamically through MQTT discovery.""" - setup = functools.partial( _async_setup_entity, hass, async_add_entities, config_entry=config_entry ) diff --git a/homeassistant/components/mqtt/fan.py b/homeassistant/components/mqtt/fan.py index f96180b0982..ef3ecffc0e0 100644 --- a/homeassistant/components/mqtt/fan.py +++ b/homeassistant/components/mqtt/fan.py @@ -122,7 +122,6 @@ async def async_setup_platform( async def async_setup_entry(hass, config_entry, async_add_entities): """Set up MQTT fan dynamically through MQTT discovery.""" - setup = functools.partial( _async_setup_entity, hass, async_add_entities, config_entry=config_entry ) diff --git a/homeassistant/components/mqtt/light/__init__.py b/homeassistant/components/mqtt/light/__init__.py index e780332d093..72c438df812 100644 --- a/homeassistant/components/mqtt/light/__init__.py +++ b/homeassistant/components/mqtt/light/__init__.py @@ -43,7 +43,6 @@ async def async_setup_platform( async def async_setup_entry(hass, config_entry, async_add_entities): """Set up MQTT light dynamically through MQTT discovery.""" - setup = functools.partial( _async_setup_entity, hass, async_add_entities, config_entry=config_entry ) diff --git a/homeassistant/components/mqtt/light/schema_json.py b/homeassistant/components/mqtt/light/schema_json.py index 489b424f4eb..8ec5c29db62 100644 --- a/homeassistant/components/mqtt/light/schema_json.py +++ b/homeassistant/components/mqtt/light/schema_json.py @@ -28,6 +28,7 @@ from homeassistant.const import ( CONF_COLOR_TEMP, CONF_DEVICE, CONF_EFFECT, + CONF_HS, CONF_NAME, CONF_OPTIMISTIC, CONF_RGB, @@ -75,7 +76,6 @@ CONF_EFFECT_LIST = "effect_list" CONF_FLASH_TIME_LONG = "flash_time_long" CONF_FLASH_TIME_SHORT = "flash_time_short" -CONF_HS = "hs" CONF_MAX_MIREDS = "max_mireds" CONF_MIN_MIREDS = "min_mireds" diff --git a/homeassistant/components/mqtt/light/schema_template.py b/homeassistant/components/mqtt/light/schema_template.py index e696e99552e..1f4421205e0 100644 --- a/homeassistant/components/mqtt/light/schema_template.py +++ b/homeassistant/components/mqtt/light/schema_template.py @@ -24,6 +24,7 @@ from homeassistant.const import ( CONF_DEVICE, CONF_NAME, CONF_OPTIMISTIC, + CONF_STATE_TEMPLATE, CONF_UNIQUE_ID, STATE_OFF, STATE_ON, @@ -62,7 +63,6 @@ CONF_GREEN_TEMPLATE = "green_template" CONF_MAX_MIREDS = "max_mireds" CONF_MIN_MIREDS = "min_mireds" CONF_RED_TEMPLATE = "red_template" -CONF_STATE_TEMPLATE = "state_template" CONF_WHITE_VALUE_TEMPLATE = "white_value_template" PLATFORM_SCHEMA_TEMPLATE = ( diff --git a/homeassistant/components/mqtt/lock.py b/homeassistant/components/mqtt/lock.py index b08f8f8bb43..408bc07b9d9 100644 --- a/homeassistant/components/mqtt/lock.py +++ b/homeassistant/components/mqtt/lock.py @@ -84,7 +84,6 @@ async def async_setup_platform( async def async_setup_entry(hass, config_entry, async_add_entities): """Set up MQTT lock dynamically through MQTT discovery.""" - setup = functools.partial( _async_setup_entity, hass, async_add_entities, config_entry=config_entry ) diff --git a/homeassistant/components/mqtt/number.py b/homeassistant/components/mqtt/number.py index 159f466f7ae..969eb254072 100644 --- a/homeassistant/components/mqtt/number.py +++ b/homeassistant/components/mqtt/number.py @@ -67,7 +67,6 @@ async def async_setup_platform( async def async_setup_entry(hass, config_entry, async_add_entities): """Set up MQTT number dynamically through MQTT discovery.""" - setup = functools.partial( _async_setup_entity, async_add_entities, config_entry=config_entry ) @@ -110,7 +109,6 @@ class MqttNumber(MqttEntity, NumberEntity, RestoreEntity): @log_messages(self.hass, self.entity_id) def message_received(msg): """Handle new MQTT messages.""" - try: if msg.payload.decode("utf-8").isnumeric(): self._current_number = int(msg.payload) @@ -149,7 +147,6 @@ class MqttNumber(MqttEntity, NumberEntity, RestoreEntity): async def async_set_value(self, value: float) -> None: """Update the current value.""" - current_number = value if value.is_integer(): diff --git a/homeassistant/components/mqtt/scene.py b/homeassistant/components/mqtt/scene.py index 908f4bafd30..061c7df3fdc 100644 --- a/homeassistant/components/mqtt/scene.py +++ b/homeassistant/components/mqtt/scene.py @@ -47,7 +47,6 @@ async def async_setup_platform( async def async_setup_entry(hass, config_entry, async_add_entities): """Set up MQTT scene dynamically through MQTT discovery.""" - setup = functools.partial( _async_setup_entity, async_add_entities, config_entry=config_entry ) diff --git a/homeassistant/components/mqtt/sensor.py b/homeassistant/components/mqtt/sensor.py index 3f79ab1bafe..78a05179210 100644 --- a/homeassistant/components/mqtt/sensor.py +++ b/homeassistant/components/mqtt/sensor.py @@ -72,7 +72,6 @@ async def async_setup_platform( async def async_setup_entry(hass, config_entry, async_add_entities): """Set up MQTT sensors dynamically through MQTT discovery.""" - setup = functools.partial( _async_setup_entity, hass, async_add_entities, config_entry=config_entry ) diff --git a/homeassistant/components/mqtt/switch.py b/homeassistant/components/mqtt/switch.py index d6d476b680d..73c7d55f6b0 100644 --- a/homeassistant/components/mqtt/switch.py +++ b/homeassistant/components/mqtt/switch.py @@ -80,7 +80,6 @@ async def async_setup_platform( async def async_setup_entry(hass, config_entry, async_add_entities): """Set up MQTT switch dynamically through MQTT discovery.""" - setup = functools.partial( _async_setup_entity, hass, async_add_entities, config_entry=config_entry ) diff --git a/homeassistant/components/mqtt/tag.py b/homeassistant/components/mqtt/tag.py index b691c5cf8ce..4960ff50fb5 100644 --- a/homeassistant/components/mqtt/tag.py +++ b/homeassistant/components/mqtt/tag.py @@ -45,7 +45,6 @@ PLATFORM_SCHEMA = mqtt.MQTT_BASE_PLATFORM_SCHEMA.extend( async def async_setup_entry(hass, config_entry): """Set up MQTT tag scan dynamically through MQTT discovery.""" - setup = functools.partial(async_setup_tag, hass, config_entry=config_entry) await async_setup_entry_helper(hass, "tag", setup, PLATFORM_SCHEMA) diff --git a/homeassistant/components/mqtt/vacuum/__init__.py b/homeassistant/components/mqtt/vacuum/__init__.py index e580e874993..4801c1ea994 100644 --- a/homeassistant/components/mqtt/vacuum/__init__.py +++ b/homeassistant/components/mqtt/vacuum/__init__.py @@ -35,7 +35,6 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= async def async_setup_entry(hass, config_entry, async_add_entities): """Set up MQTT vacuum dynamically through MQTT discovery.""" - setup = functools.partial( _async_setup_entity, async_add_entities, config_entry=config_entry ) diff --git a/homeassistant/components/mqtt/vacuum/schema_legacy.py b/homeassistant/components/mqtt/vacuum/schema_legacy.py index e7be64be6ae..577e6a70ccd 100644 --- a/homeassistant/components/mqtt/vacuum/schema_legacy.py +++ b/homeassistant/components/mqtt/vacuum/schema_legacy.py @@ -377,7 +377,6 @@ class MqttVacuum(MqttEntity, VacuumEntity): No need to check SUPPORT_BATTERY, this won't be called if battery_level is None. """ - return icon_for_battery_level( battery_level=self.battery_level, charging=self._charging )