From 66fd7de34a1a3fee91de2dbf99d5fd2137d093e5 Mon Sep 17 00:00:00 2001 From: Robert Hillis Date: Thu, 23 Dec 2021 08:31:28 -0500 Subject: [PATCH] Remove deprecated yaml config from Syncthru (#62541) --- .../components/syncthru/config_flow.py | 4 -- homeassistant/components/syncthru/sensor.py | 41 ++----------------- 2 files changed, 3 insertions(+), 42 deletions(-) diff --git a/homeassistant/components/syncthru/config_flow.py b/homeassistant/components/syncthru/config_flow.py index ac7b317faf8..664de1f6d96 100644 --- a/homeassistant/components/syncthru/config_flow.py +++ b/homeassistant/components/syncthru/config_flow.py @@ -30,10 +30,6 @@ class SyncThruConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): return await self._async_show_form(step_id="user") return await self._async_check_and_create("user", user_input) - async def async_step_import(self, user_input=None): - """Handle import initiated flow.""" - return await self.async_step_user(user_input=user_input) - async def async_step_ssdp(self, discovery_info: ssdp.SsdpServiceInfo) -> FlowResult: """Handle SSDP initiated flow.""" await self.async_set_unique_id(discovery_info.upnp[ssdp.ATTR_UPNP_UDN]) diff --git a/homeassistant/components/syncthru/sensor.py b/homeassistant/components/syncthru/sensor.py index a3e24f9ffd8..0df0fd54de2 100644 --- a/homeassistant/components/syncthru/sensor.py +++ b/homeassistant/components/syncthru/sensor.py @@ -1,15 +1,10 @@ """Support for Samsung Printers with SyncThru web interface.""" from __future__ import annotations -import logging - from pysyncthru import SyncThru, SyncthruState -import voluptuous as vol -from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity -from homeassistant.config_entries import SOURCE_IMPORT -from homeassistant.const import CONF_NAME, CONF_RESOURCE, CONF_URL, PERCENTAGE -import homeassistant.helpers.config_validation as cv +from homeassistant.components.sensor import SensorEntity +from homeassistant.const import CONF_NAME, PERCENTAGE from homeassistant.helpers.entity import DeviceInfo from homeassistant.helpers.update_coordinator import ( CoordinatorEntity, @@ -17,9 +12,7 @@ from homeassistant.helpers.update_coordinator import ( ) from . import device_identifiers -from .const import DEFAULT_MODEL, DEFAULT_NAME_TEMPLATE, DOMAIN - -_LOGGER = logging.getLogger(__name__) +from .const import DOMAIN COLORS = ["black", "cyan", "magenta", "yellow"] DRUM_COLORS = COLORS @@ -42,34 +35,6 @@ SYNCTHRU_STATE_HUMAN = { SyncthruState.ERROR: "error", } -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( - { - vol.Required(CONF_RESOURCE): cv.url, - vol.Optional( - CONF_NAME, default=DEFAULT_NAME_TEMPLATE.format(DEFAULT_MODEL) - ): cv.string, - } -) - - -async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): - """Set up the SyncThru component.""" - _LOGGER.warning( - "Loading syncthru via platform config is deprecated and no longer " - "necessary as of 0.113; Please remove it from your configuration YAML" - ) - hass.async_create_task( - hass.config_entries.flow.async_init( - DOMAIN, - context={"source": SOURCE_IMPORT}, - data={ - CONF_URL: config.get(CONF_RESOURCE), - CONF_NAME: config.get(CONF_NAME), - }, - ) - ) - return True - async def async_setup_entry(hass, config_entry, async_add_entities): """Set up from config entry."""