Bump faadelays to 2023.8.0 (#100700)

* Update component to use new API version

* Revert new features, implement #95546, bump library

* Revert #95546 changes, remove NOTAM
pull/100787/head
Nathan Tilley 2023-09-23 15:06:49 -07:00 committed by GitHub
parent f8a8fe760d
commit 451c085587
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 36 deletions

View File

@ -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

View File

@ -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

View File

@ -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"]
}

View File

@ -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

View File

@ -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

View File

@ -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(