diff --git a/homeassistant/components/faa_delays/binary_sensor.py b/homeassistant/components/faa_delays/binary_sensor.py index bc09a604cd68bdddcfd4e8fb0d9811ad8791e022..54b22812c84bc85451190b26fc0541deb1eee113 100644 --- a/homeassistant/components/faa_delays/binary_sensor.py +++ b/homeassistant/components/faa_delays/binary_sensor.py @@ -42,7 +42,7 @@ class FAABinarySensor(CoordinatorEntity, BinarySensorEntity): self.coordinator = coordinator self._entry_id = entry_id self._attrs: dict[str, Any] = {} - _id = coordinator.data.iata + _id = coordinator.data.code self._attr_name = f"{_id} {description.name}" self._attr_unique_id = f"{_id}_{description.key}" @@ -83,7 +83,6 @@ class FAABinarySensor(CoordinatorEntity, BinarySensorEntity): self._attrs["trend"] = self.coordinator.data.arrive_delay.trend self._attrs["reason"] = self.coordinator.data.arrive_delay.reason elif sensor_type == "CLOSURE": - self._attrs["begin"] = self.coordinator.data.closure.begin + self._attrs["begin"] = self.coordinator.data.closure.start self._attrs["end"] = self.coordinator.data.closure.end - self._attrs["reason"] = self.coordinator.data.closure.reason return self._attrs diff --git a/homeassistant/components/faa_delays/config_flow.py b/homeassistant/components/faa_delays/config_flow.py index 023fe4d6a5b7f2aeb554b20ea0f6a032b4520ed5..b2f7f69dd49f326ca37c2dc3ba8e5b1aa946f843 100644 --- a/homeassistant/components/faa_delays/config_flow.py +++ b/homeassistant/components/faa_delays/config_flow.py @@ -35,10 +35,6 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): try: await data.update() - except faadelays.InvalidAirport: - _LOGGER.error("Airport code %s is invalid", user_input[CONF_ID]) - errors[CONF_ID] = "invalid_airport" - except ClientConnectionError: _LOGGER.error("Error connecting to FAA API") errors["base"] = "cannot_connect" @@ -49,11 +45,10 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): if not errors: _LOGGER.debug( - "Creating entry with id: %s, name: %s", + "Creating entry with id: %s", user_input[CONF_ID], - data.name, ) - return self.async_create_entry(title=data.name, data=user_input) + return self.async_create_entry(title=data.code, data=user_input) return self.async_show_form( step_id="user", data_schema=DATA_SCHEMA, errors=errors diff --git a/homeassistant/components/faa_delays/manifest.json b/homeassistant/components/faa_delays/manifest.json index 8fb07d1e1878b84050b7233d7d67697eb589e8fc..07c2cfea771cba751eb6289187a59a0a547cbd0e 100644 --- a/homeassistant/components/faa_delays/manifest.json +++ b/homeassistant/components/faa_delays/manifest.json @@ -6,5 +6,5 @@ "documentation": "https://www.home-assistant.io/integrations/faa_delays", "iot_class": "cloud_polling", "loggers": ["faadelays"], - "requirements": ["faadelays==0.0.7"] + "requirements": ["faadelays==2023.9.1"] } diff --git a/requirements_all.txt b/requirements_all.txt index e038c435acaf8617e5ce8842328074c21b323b39..13ad421df9616d26a90627f269c7573de5f866a3 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -777,7 +777,7 @@ eufylife-ble-client==0.1.7 evohome-async==0.3.15 # homeassistant.components.faa_delays -faadelays==0.0.7 +faadelays==2023.9.1 # homeassistant.components.dlib_face_detect # homeassistant.components.dlib_face_identify diff --git a/requirements_test_all.txt b/requirements_test_all.txt index bf22ba34a65d21bb1c71bf8ad118881f1e615ed6..6f1e3adc781e3106987ebaea535282d498514330 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -621,7 +621,7 @@ esphome-dashboard-api==1.2.3 eufylife-ble-client==0.1.7 # homeassistant.components.faa_delays -faadelays==0.0.7 +faadelays==2023.9.1 # homeassistant.components.feedreader feedparser==6.0.10 diff --git a/tests/components/faa_delays/test_config_flow.py b/tests/components/faa_delays/test_config_flow.py index 9eb166d5f69708bc47d93a0fd33d4a3560f74810..5fb1b9cfcd2eb6f94a3080e7964f64fcf2087d08 100644 --- a/tests/components/faa_delays/test_config_flow.py +++ b/tests/components/faa_delays/test_config_flow.py @@ -15,7 +15,7 @@ from tests.common import MockConfigEntry async def mock_valid_airport(self, *args, **kwargs): """Return a valid airport.""" - self.name = "Test airport" + self.code = "test" async def test_form(hass: HomeAssistant) -> None: @@ -40,7 +40,7 @@ async def test_form(hass: HomeAssistant) -> None: await hass.async_block_till_done() assert result2["type"] == "create_entry" - assert result2["title"] == "Test airport" + assert result2["title"] == "test" assert result2["data"] == { "id": "test", } @@ -61,27 +61,6 @@ async def test_duplicate_error(hass: HomeAssistant) -> None: assert result["reason"] == "already_configured" -async def test_form_invalid_airport(hass: HomeAssistant) -> None: - """Test we handle invalid airport.""" - result = await hass.config_entries.flow.async_init( - DOMAIN, context={"source": config_entries.SOURCE_USER} - ) - - with patch( - "faadelays.Airport.update", - side_effect=faadelays.InvalidAirport, - ): - result2 = await hass.config_entries.flow.async_configure( - result["flow_id"], - { - "id": "test", - }, - ) - - assert result2["type"] == "form" - assert result2["errors"] == {CONF_ID: "invalid_airport"} - - async def test_form_cannot_connect(hass: HomeAssistant) -> None: """Test we handle a connection error.""" result = await hass.config_entries.flow.async_init(