mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
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
This commit is contained in:
parent
f8a8fe760d
commit
451c085587
@ -42,7 +42,7 @@ class FAABinarySensor(CoordinatorEntity, BinarySensorEntity):
|
|||||||
self.coordinator = coordinator
|
self.coordinator = coordinator
|
||||||
self._entry_id = entry_id
|
self._entry_id = entry_id
|
||||||
self._attrs: dict[str, Any] = {}
|
self._attrs: dict[str, Any] = {}
|
||||||
_id = coordinator.data.iata
|
_id = coordinator.data.code
|
||||||
self._attr_name = f"{_id} {description.name}"
|
self._attr_name = f"{_id} {description.name}"
|
||||||
self._attr_unique_id = f"{_id}_{description.key}"
|
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["trend"] = self.coordinator.data.arrive_delay.trend
|
||||||
self._attrs["reason"] = self.coordinator.data.arrive_delay.reason
|
self._attrs["reason"] = self.coordinator.data.arrive_delay.reason
|
||||||
elif sensor_type == "CLOSURE":
|
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["end"] = self.coordinator.data.closure.end
|
||||||
self._attrs["reason"] = self.coordinator.data.closure.reason
|
|
||||||
return self._attrs
|
return self._attrs
|
||||||
|
@ -35,10 +35,6 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
try:
|
try:
|
||||||
await data.update()
|
await data.update()
|
||||||
|
|
||||||
except faadelays.InvalidAirport:
|
|
||||||
_LOGGER.error("Airport code %s is invalid", user_input[CONF_ID])
|
|
||||||
errors[CONF_ID] = "invalid_airport"
|
|
||||||
|
|
||||||
except ClientConnectionError:
|
except ClientConnectionError:
|
||||||
_LOGGER.error("Error connecting to FAA API")
|
_LOGGER.error("Error connecting to FAA API")
|
||||||
errors["base"] = "cannot_connect"
|
errors["base"] = "cannot_connect"
|
||||||
@ -49,11 +45,10 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
|
|
||||||
if not errors:
|
if not errors:
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"Creating entry with id: %s, name: %s",
|
"Creating entry with id: %s",
|
||||||
user_input[CONF_ID],
|
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(
|
return self.async_show_form(
|
||||||
step_id="user", data_schema=DATA_SCHEMA, errors=errors
|
step_id="user", data_schema=DATA_SCHEMA, errors=errors
|
||||||
|
@ -6,5 +6,5 @@
|
|||||||
"documentation": "https://www.home-assistant.io/integrations/faa_delays",
|
"documentation": "https://www.home-assistant.io/integrations/faa_delays",
|
||||||
"iot_class": "cloud_polling",
|
"iot_class": "cloud_polling",
|
||||||
"loggers": ["faadelays"],
|
"loggers": ["faadelays"],
|
||||||
"requirements": ["faadelays==0.0.7"]
|
"requirements": ["faadelays==2023.9.1"]
|
||||||
}
|
}
|
||||||
|
@ -777,7 +777,7 @@ eufylife-ble-client==0.1.7
|
|||||||
evohome-async==0.3.15
|
evohome-async==0.3.15
|
||||||
|
|
||||||
# homeassistant.components.faa_delays
|
# homeassistant.components.faa_delays
|
||||||
faadelays==0.0.7
|
faadelays==2023.9.1
|
||||||
|
|
||||||
# homeassistant.components.dlib_face_detect
|
# homeassistant.components.dlib_face_detect
|
||||||
# homeassistant.components.dlib_face_identify
|
# homeassistant.components.dlib_face_identify
|
||||||
|
@ -621,7 +621,7 @@ esphome-dashboard-api==1.2.3
|
|||||||
eufylife-ble-client==0.1.7
|
eufylife-ble-client==0.1.7
|
||||||
|
|
||||||
# homeassistant.components.faa_delays
|
# homeassistant.components.faa_delays
|
||||||
faadelays==0.0.7
|
faadelays==2023.9.1
|
||||||
|
|
||||||
# homeassistant.components.feedreader
|
# homeassistant.components.feedreader
|
||||||
feedparser==6.0.10
|
feedparser==6.0.10
|
||||||
|
@ -15,7 +15,7 @@ from tests.common import MockConfigEntry
|
|||||||
|
|
||||||
async def mock_valid_airport(self, *args, **kwargs):
|
async def mock_valid_airport(self, *args, **kwargs):
|
||||||
"""Return a valid airport."""
|
"""Return a valid airport."""
|
||||||
self.name = "Test airport"
|
self.code = "test"
|
||||||
|
|
||||||
|
|
||||||
async def test_form(hass: HomeAssistant) -> None:
|
async def test_form(hass: HomeAssistant) -> None:
|
||||||
@ -40,7 +40,7 @@ async def test_form(hass: HomeAssistant) -> None:
|
|||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
assert result2["type"] == "create_entry"
|
assert result2["type"] == "create_entry"
|
||||||
assert result2["title"] == "Test airport"
|
assert result2["title"] == "test"
|
||||||
assert result2["data"] == {
|
assert result2["data"] == {
|
||||||
"id": "test",
|
"id": "test",
|
||||||
}
|
}
|
||||||
@ -61,27 +61,6 @@ async def test_duplicate_error(hass: HomeAssistant) -> None:
|
|||||||
assert result["reason"] == "already_configured"
|
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:
|
async def test_form_cannot_connect(hass: HomeAssistant) -> None:
|
||||||
"""Test we handle a connection error."""
|
"""Test we handle a connection error."""
|
||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user