|
1 | 1 | """Support for Plugwise devices connected to a Plugwise USB-stick.""" |
| 2 | + |
2 | 3 | import logging |
3 | 4 | from typing import Any, TypedDict |
4 | 5 |
|
@@ -29,11 +30,15 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry): |
29 | 30 | """Establish connection with plugwise USB-stick.""" |
30 | 31 |
|
31 | 32 | @callback |
32 | | - def _async_migrate_entity_entry(entity_entry: er.RegistryEntry) -> dict[str, Any] | None: |
| 33 | + def _async_migrate_entity_entry( |
| 34 | + entity_entry: er.RegistryEntry, |
| 35 | + ) -> dict[str, Any] | None: |
33 | 36 | """Migrate Plugwise entity entry.""" |
34 | 37 | return async_migrate_entity_entry(config_entry, entity_entry) |
35 | 38 |
|
36 | | - await er.async_migrate_entries(hass, config_entry.entry_id, _async_migrate_entity_entry) |
| 39 | + await er.async_migrate_entries( |
| 40 | + hass, config_entry.entry_id, _async_migrate_entity_entry |
| 41 | + ) |
37 | 42 |
|
38 | 43 | api_stick = Stick(config_entry.data[CONF_USB_PATH]) |
39 | 44 | api_stick.cache_folder = hass.config.path( |
@@ -75,19 +80,15 @@ async def async_node_discovered(node_event: NodeEvent, mac: str) -> None: |
75 | 80 | await api_stick.discover_coordinator(load=False) |
76 | 81 | except StickError: |
77 | 82 | await api_stick.disconnect() |
78 | | - raise ConfigEntryNotReady( |
79 | | - "Failed to connect to Circle+" |
80 | | - ) from StickError |
| 83 | + raise ConfigEntryNotReady("Failed to connect to Circle+") from StickError |
81 | 84 |
|
82 | 85 | # Load platforms to allow them to register for node events |
83 | 86 | await hass.config_entries.async_forward_entry_setups( |
84 | 87 | config_entry, PLUGWISE_USB_PLATFORMS |
85 | 88 | ) |
86 | 89 |
|
87 | 90 | # Initiate background discovery task |
88 | | - hass.async_create_task( |
89 | | - api_stick.discover_nodes(load=True) |
90 | | - ) |
| 91 | + hass.async_create_task(api_stick.discover_nodes(load=True)) |
91 | 92 | return True |
92 | 93 |
|
93 | 94 |
|
|
0 commit comments