Skip to content

Commit

Permalink
fix: the get group device response may not contain entities
Browse files Browse the repository at this point in the history
  • Loading branch information
rxwen committed Nov 10, 2022
1 parent 28bf841 commit a7404e6
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions terncy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ async def async_refresh_devices(hass: HomeAssistant, tern):
devices = response["rsp"]["entities"]

group_response = await tern.get_entities("devicegroup", True)
groups = group_response["rsp"]["entities"]
groups = group_response["rsp"].get("entities")

pdata = tern.hass_platform_data

Expand All @@ -398,9 +398,10 @@ async def async_refresh_devices(hass: HomeAssistant, tern):

for dev in devices:
await update_or_create_entity(dev, tern)

for group in groups:
await update_or_create_entity(group, tern)

if groups:
for group in groups:
await update_or_create_entity(group, tern)


async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
Expand Down

0 comments on commit a7404e6

Please sign in to comment.