|
3 | 3 |
|
4 | 4 | from typing import Any |
5 | 5 |
|
6 | | -import serial.tools.list_ports # pw-beta usb |
| 6 | +import serial.tools.list_ports |
7 | 7 | import voluptuous as vol |
8 | 8 |
|
9 | | -from homeassistant.components import usb # pw-beta usb |
| 9 | +from homeassistant.components import usb |
10 | 10 | from homeassistant.config_entries import ConfigFlow |
11 | 11 | from homeassistant.const import CONF_BASE |
12 | 12 | from homeassistant.core import callback |
13 | 13 | from homeassistant.data_entry_flow import FlowResult |
14 | | -from plugwise_usb import Stick # pw-beta usb |
| 14 | +from plugwise_usb import Stick |
| 15 | +from plugwise_usb.exceptions import ( |
| 16 | + NetworkDown, |
| 17 | + PortError, |
| 18 | + StickInitError, |
| 19 | + TimeoutException, |
| 20 | +) |
15 | 21 |
|
16 | | -# pw-beta Note; the below are explicit through isort |
17 | | -from plugwise_usb.exceptions import NetworkDown # pw-beta usb |
18 | | -from plugwise_usb.exceptions import PortError # pw-beta usb |
19 | | -from plugwise_usb.exceptions import StickInitError # pw-beta usb |
20 | | -from plugwise_usb.exceptions import TimeoutException # pw-beta usb |
21 | | - |
22 | | -# pw-beta Note; the below are explicit through isort |
23 | | -from .const import CONF_MANUAL_PATH # pw-beta usb |
24 | | -from .const import CONF_USB_PATH # pw-beta usb |
25 | | -from .const import DOMAIN |
| 22 | +from .const import CONF_MANUAL_PATH, CONF_USB_PATH, DOMAIN |
26 | 23 |
|
27 | 24 |
|
28 | 25 | @callback |
29 | | -def plugwise_stick_entries(hass): # pw-beta usb |
| 26 | +def plugwise_stick_entries(hass): |
30 | 27 | """Return existing connections for Plugwise USB-stick domain.""" |
31 | 28 | sticks = [] |
32 | 29 | for entry in hass.config_entries.async_entries(DOMAIN): |
33 | 30 | sticks.append(entry.data.get(CONF_USB_PATH)) |
34 | 31 | return sticks |
35 | 32 |
|
36 | 33 |
|
37 | | -async def validate_usb_connection( |
38 | | - self, device_path=None |
39 | | -) -> tuple[dict[str, str], Any]: # pw-beta usb |
| 34 | +async def validate_usb_connection(self, device_path=None) -> tuple[dict[str, str], Any]: |
40 | 35 | """Test if device_path is a real Plugwise USB-Stick.""" |
41 | 36 | errors = {} |
42 | 37 |
|
@@ -68,7 +63,7 @@ class PlugwiseUSBConfigFlow(ConfigFlow, domain=DOMAIN): |
68 | 63 |
|
69 | 64 | async def async_step_user( |
70 | 65 | self, user_input: dict[str, Any] | None = None |
71 | | - ) -> FlowResult: # pw-beta usb |
| 66 | + ) -> FlowResult: |
72 | 67 | """Step when user initializes a integration.""" |
73 | 68 | errors: dict[str, str] = {} |
74 | 69 | ports = await self.hass.async_add_executor_job(serial.tools.list_ports.comports) |
@@ -105,7 +100,7 @@ async def async_step_user( |
105 | 100 |
|
106 | 101 | async def async_step_manual_path( |
107 | 102 | self, user_input: dict[str, Any] | None = None |
108 | | - ) -> FlowResult: # pw-beta usb |
| 103 | + ) -> FlowResult: |
109 | 104 | """Step when manual path to device.""" |
110 | 105 | errors: dict[str, str] = {} |
111 | 106 | if user_input is not None: |
|
0 commit comments