|
19 | 19 | from homeassistant.exceptions import HomeAssistantError |
20 | 20 | from homeassistant.helpers.entity import EntityCategory |
21 | 21 | from homeassistant.helpers.entity_platform import AddEntitiesCallback |
22 | | -from homeassistant.util import slugify |
23 | 22 |
|
24 | 23 | from .const import CONF_SLEEP_PERIOD |
25 | | -from .coordinator import ShellyBlockCoordinator, ShellyRpcCoordinator, get_entry_data |
| 24 | +from .coordinator import ShellyBlockCoordinator, ShellyRpcCoordinator |
26 | 25 | from .entity import ( |
27 | 26 | RestEntityDescription, |
28 | 27 | RpcEntityDescription, |
|
31 | 30 | async_setup_entry_rest, |
32 | 31 | async_setup_entry_rpc, |
33 | 32 | ) |
34 | | -from .utils import ( |
35 | | - async_remove_shelly_entity, |
36 | | - get_block_device_name, |
37 | | - get_device_entry_gen, |
38 | | - get_rpc_device_name, |
39 | | -) |
| 33 | +from .utils import get_device_entry_gen |
40 | 34 |
|
41 | 35 | LOGGER = logging.getLogger(__name__) |
42 | 36 |
|
@@ -123,28 +117,10 @@ async def async_setup_entry( |
123 | 117 | ) -> None: |
124 | 118 | """Set up update entities for Shelly component.""" |
125 | 119 | if get_device_entry_gen(config_entry) == 2: |
126 | | - # Remove legacy update binary sensor & buttons, remove in 202320 |
127 | | - rpc_coordinator = get_entry_data(hass)[config_entry.entry_id].rpc |
128 | | - assert rpc_coordinator |
129 | | - mac = rpc_coordinator.mac |
130 | | - async_remove_shelly_entity(hass, "binary_sensor", f"{mac}-sys-fwupdate") |
131 | | - device_name = slugify(get_rpc_device_name(rpc_coordinator.device)) |
132 | | - async_remove_shelly_entity(hass, "button", f"{device_name}_ota_update") |
133 | | - async_remove_shelly_entity(hass, "button", f"{device_name}_ota_update_beta") |
134 | | - |
135 | 120 | return async_setup_entry_rpc( |
136 | 121 | hass, config_entry, async_add_entities, RPC_UPDATES, RpcUpdateEntity |
137 | 122 | ) |
138 | 123 |
|
139 | | - # Remove legacy update binary sensor & buttons, remove in 202320 |
140 | | - block_coordinator = get_entry_data(hass)[config_entry.entry_id].block |
141 | | - assert block_coordinator |
142 | | - mac = block_coordinator.mac |
143 | | - async_remove_shelly_entity(hass, "binary_sensor", f"{mac}-fwupdate") |
144 | | - device_name = slugify(get_block_device_name(block_coordinator.device)) |
145 | | - async_remove_shelly_entity(hass, "button", f"{device_name}_ota_update") |
146 | | - async_remove_shelly_entity(hass, "button", f"{device_name}_ota_update_beta") |
147 | | - |
148 | 124 | if not config_entry.data[CONF_SLEEP_PERIOD]: |
149 | 125 | async_setup_entry_rest( |
150 | 126 | hass, |
|
0 commit comments