parent
54d005a3b8
commit
2b3f5319d6
|
@ -35,7 +35,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
await bring.login()
|
await bring.login()
|
||||||
await bring.loadLists()
|
await bring.load_lists()
|
||||||
except BringRequestException as e:
|
except BringRequestException as e:
|
||||||
raise ConfigEntryNotReady(
|
raise ConfigEntryNotReady(
|
||||||
f"Timeout while connecting for email '{email}'"
|
f"Timeout while connecting for email '{email}'"
|
||||||
|
|
|
@ -54,7 +54,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
await bring.login()
|
await bring.login()
|
||||||
await bring.loadLists()
|
await bring.load_lists()
|
||||||
except BringRequestException:
|
except BringRequestException:
|
||||||
errors["base"] = "cannot_connect"
|
errors["base"] = "cannot_connect"
|
||||||
except BringAuthException:
|
except BringAuthException:
|
||||||
|
|
|
@ -40,7 +40,7 @@ class BringDataUpdateCoordinator(DataUpdateCoordinator[dict[str, BringData]]):
|
||||||
|
|
||||||
async def _async_update_data(self) -> dict[str, BringData]:
|
async def _async_update_data(self) -> dict[str, BringData]:
|
||||||
try:
|
try:
|
||||||
lists_response = await self.bring.loadLists()
|
lists_response = await self.bring.load_lists()
|
||||||
except BringRequestException as e:
|
except BringRequestException as e:
|
||||||
raise UpdateFailed("Unable to connect and retrieve data from bring") from e
|
raise UpdateFailed("Unable to connect and retrieve data from bring") from e
|
||||||
except BringParseException as e:
|
except BringParseException as e:
|
||||||
|
@ -49,7 +49,7 @@ class BringDataUpdateCoordinator(DataUpdateCoordinator[dict[str, BringData]]):
|
||||||
list_dict = {}
|
list_dict = {}
|
||||||
for lst in lists_response["lists"]:
|
for lst in lists_response["lists"]:
|
||||||
try:
|
try:
|
||||||
items = await self.bring.getItems(lst["listUuid"])
|
items = await self.bring.get_list(lst["listUuid"])
|
||||||
except BringRequestException as e:
|
except BringRequestException as e:
|
||||||
raise UpdateFailed(
|
raise UpdateFailed(
|
||||||
"Unable to connect and retrieve data from bring"
|
"Unable to connect and retrieve data from bring"
|
||||||
|
|
|
@ -6,5 +6,5 @@
|
||||||
"documentation": "https://www.home-assistant.io/integrations/bring",
|
"documentation": "https://www.home-assistant.io/integrations/bring",
|
||||||
"integration_type": "service",
|
"integration_type": "service",
|
||||||
"iot_class": "cloud_polling",
|
"iot_class": "cloud_polling",
|
||||||
"requirements": ["bring-api==0.1.1"]
|
"requirements": ["bring-api==0.3.1"]
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ class BringTodoListEntity(
|
||||||
async def async_create_todo_item(self, item: TodoItem) -> None:
|
async def async_create_todo_item(self, item: TodoItem) -> None:
|
||||||
"""Add an item to the To-do list."""
|
"""Add an item to the To-do list."""
|
||||||
try:
|
try:
|
||||||
await self.coordinator.bring.saveItem(
|
await self.coordinator.bring.save_item(
|
||||||
self.bring_list["listUuid"], item.summary, item.description or ""
|
self.bring_list["listUuid"], item.summary, item.description or ""
|
||||||
)
|
)
|
||||||
except BringRequestException as e:
|
except BringRequestException as e:
|
||||||
|
@ -123,14 +123,14 @@ class BringTodoListEntity(
|
||||||
assert item.uid
|
assert item.uid
|
||||||
|
|
||||||
if item.status == TodoItemStatus.COMPLETED:
|
if item.status == TodoItemStatus.COMPLETED:
|
||||||
await self.coordinator.bring.removeItem(
|
await self.coordinator.bring.remove_item(
|
||||||
bring_list["listUuid"],
|
bring_list["listUuid"],
|
||||||
item.uid,
|
item.uid,
|
||||||
)
|
)
|
||||||
|
|
||||||
elif item.summary == item.uid:
|
elif item.summary == item.uid:
|
||||||
try:
|
try:
|
||||||
await self.coordinator.bring.updateItem(
|
await self.coordinator.bring.update_item(
|
||||||
bring_list["listUuid"],
|
bring_list["listUuid"],
|
||||||
item.uid,
|
item.uid,
|
||||||
item.description or "",
|
item.description or "",
|
||||||
|
@ -139,11 +139,11 @@ class BringTodoListEntity(
|
||||||
raise HomeAssistantError("Unable to update todo item for bring") from e
|
raise HomeAssistantError("Unable to update todo item for bring") from e
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
await self.coordinator.bring.removeItem(
|
await self.coordinator.bring.remove_item(
|
||||||
bring_list["listUuid"],
|
bring_list["listUuid"],
|
||||||
item.uid,
|
item.uid,
|
||||||
)
|
)
|
||||||
await self.coordinator.bring.saveItem(
|
await self.coordinator.bring.save_tem(
|
||||||
bring_list["listUuid"],
|
bring_list["listUuid"],
|
||||||
item.summary,
|
item.summary,
|
||||||
item.description or "",
|
item.description or "",
|
||||||
|
@ -157,7 +157,7 @@ class BringTodoListEntity(
|
||||||
"""Delete an item from the To-do list."""
|
"""Delete an item from the To-do list."""
|
||||||
for uid in uids:
|
for uid in uids:
|
||||||
try:
|
try:
|
||||||
await self.coordinator.bring.removeItem(
|
await self.coordinator.bring.remove_item(
|
||||||
self.bring_list["listUuid"], uid
|
self.bring_list["listUuid"], uid
|
||||||
)
|
)
|
||||||
except BringRequestException as e:
|
except BringRequestException as e:
|
||||||
|
|
|
@ -600,7 +600,7 @@ boschshcpy==0.2.75
|
||||||
boto3==1.33.13
|
boto3==1.33.13
|
||||||
|
|
||||||
# homeassistant.components.bring
|
# homeassistant.components.bring
|
||||||
bring-api==0.1.1
|
bring-api==0.3.1
|
||||||
|
|
||||||
# homeassistant.components.broadlink
|
# homeassistant.components.broadlink
|
||||||
broadlink==0.18.3
|
broadlink==0.18.3
|
||||||
|
|
|
@ -508,7 +508,7 @@ bond-async==0.2.1
|
||||||
boschshcpy==0.2.75
|
boschshcpy==0.2.75
|
||||||
|
|
||||||
# homeassistant.components.bring
|
# homeassistant.components.bring
|
||||||
bring-api==0.1.1
|
bring-api==0.3.1
|
||||||
|
|
||||||
# homeassistant.components.broadlink
|
# homeassistant.components.broadlink
|
||||||
broadlink==0.18.3
|
broadlink==0.18.3
|
||||||
|
|
|
@ -37,7 +37,7 @@ def mock_bring_client() -> Generator[AsyncMock, None, None]:
|
||||||
client = mock_client.return_value
|
client = mock_client.return_value
|
||||||
client.uuid = UUID
|
client.uuid = UUID
|
||||||
client.login.return_value = True
|
client.login.return_value = True
|
||||||
client.loadLists.return_value = {"lists": []}
|
client.load_lists.return_value = {"lists": []}
|
||||||
yield client
|
yield client
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue