Skip to content
This repository has been archived by the owner on Aug 24, 2022. It is now read-only.

Commit

Permalink
fixed a few missing await.
Browse files Browse the repository at this point in the history
  • Loading branch information
vlebourl committed Nov 17, 2020
1 parent 96edc01 commit b3b9952
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions custom_components/custom_shopping_list/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,7 @@ async def complete_item_service(call):

async def sync_bring_service(call):
"""Sync with Bring List"""
data = hass.data[DOMAIN]
data.sync_bring()
await hass.data[DOMAIN].sync_bring()

username = hass.data[DOMAIN][CONF_BRING_USERNAME]
password = hass.data[DOMAIN][CONF_BRING_PASSWORD]
Expand Down Expand Up @@ -347,7 +346,7 @@ async def async_update(self, item_id, info):
if " [" in name:
specification = name[name.index(" [") + 2 : len(name) - 1]
name = name[0 : name.index(" [")]
self.bring.remove_item(item)
await self.bring.remove_item(item)
item.name = name
item.specification = specification
item.id = name
Expand All @@ -368,7 +367,7 @@ async def async_clear_completed(self):
to_remove = []
for key, itm in self.map_items.items():
if itm.complete:
self.bring.remove_item(itm)
await self.bring.remove_item(itm)
self.remove(self.bring.recent_list, itm)
self.remove(self.items, itm.to_ha())
to_remove.append(key)
Expand All @@ -381,7 +380,9 @@ async def sync_bring(self):
await self.bring.update_lists(self.map_items)

for itm in self.bring.purchase_list + self.bring.recent_list:
self.map_items[itm.id] = itm
if itm != self.map_items[itm.id]:
_LOGGER.debug("Update item: %s", str(itm))
self.map_items[itm.id] = itm

self.items = [itm.to_ha() for k, itm in self.map_items.items()]

Expand Down

0 comments on commit b3b9952

Please sign in to comment.