Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new ServiceInfo location in rainforest_raven #135697

Merged
merged 1 commit into from
Jan 15, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions homeassistant/components/rainforest_raven/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
SelectSelectorConfig,
SelectSelectorMode,
)
from homeassistant.helpers.service_info.usb import UsbServiceInfo
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: usb is still imported
It is listed in dependencies in manifest.json


from .const import DEFAULT_NAME, DOMAIN

Expand All @@ -30,7 +31,7 @@ def _format_id(value: str | int) -> str:
return f"{value or 0:04X}"


def _generate_unique_id(info: ListPortInfo | usb.UsbServiceInfo) -> str:
def _generate_unique_id(info: ListPortInfo | UsbServiceInfo) -> str:
"""Generate unique id from usb attributes."""
return (
f"{_format_id(info.vid)}:{_format_id(info.pid)}_{info.serial_number}"
Expand Down Expand Up @@ -98,9 +99,7 @@ async def async_step_meters(
)
return self.async_show_form(step_id="meters", data_schema=schema, errors=errors)

async def async_step_usb(
self, discovery_info: usb.UsbServiceInfo
) -> ConfigFlowResult:
async def async_step_usb(self, discovery_info: UsbServiceInfo) -> ConfigFlowResult:
"""Handle USB Discovery."""
device = discovery_info.device
dev_path = await self.hass.async_add_executor_job(usb.get_serial_by_id, device)
Expand Down