diff --git a/homeassistant/components/modem_callerid/config_flow.py b/homeassistant/components/modem_callerid/config_flow.py index 70fd3969e02d21..aaa883c2e51b6a 100644 --- a/homeassistant/components/modem_callerid/config_flow.py +++ b/homeassistant/components/modem_callerid/config_flow.py @@ -32,10 +32,10 @@ def __init__(self) -> None: async def async_step_usb(self, discovery_info: usb.UsbServiceInfo) -> FlowResult: """Handle USB Discovery.""" - device = discovery_info["device"] + device = discovery_info[usb.ATTR_DEVICE] dev_path = await self.hass.async_add_executor_job(usb.get_serial_by_id, device) - unique_id = f"{discovery_info['vid']}:{discovery_info['pid']}_{discovery_info['serial_number']}_{discovery_info['manufacturer']}_{discovery_info['description']}" + unique_id = f"{discovery_info[usb.ATTR_VID]}:{discovery_info[usb.ATTR_PID]}_{discovery_info[usb.ATTR_SERIAL_NUMBER]}_{discovery_info[usb.ATTR_MANUFACTURER]}_{discovery_info[usb.ATTR_DESCRIPTION]}" if ( await self.validate_device_errors(dev_path=dev_path, unique_id=unique_id) is None diff --git a/tests/components/modem_callerid/test_config_flow.py b/tests/components/modem_callerid/test_config_flow.py index 4d76ae8a944f5f..0956a8fe1b7953 100644 --- a/tests/components/modem_callerid/test_config_flow.py +++ b/tests/components/modem_callerid/test_config_flow.py @@ -17,14 +17,14 @@ from . import _patch_config_flow_modem -DISCOVERY_INFO = { - "device": phone_modem.DEFAULT_PORT, - "pid": "1340", - "vid": "0572", - "serial_number": "1234", - "description": "modem", - "manufacturer": "Connexant", -} +DISCOVERY_INFO = usb.UsbServiceInfo( + device=phone_modem.DEFAULT_PORT, + pid="1340", + vid="0572", + serial_number="1234", + description="modem", + manufacturer="Connexant", +) def _patch_setup():