Skip to content

Commit

Permalink
Fix missing client
Browse files Browse the repository at this point in the history
  • Loading branch information
tetienne committed Jul 30, 2020
1 parent 1c0e288 commit 919a5cd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
11 changes: 5 additions & 6 deletions custom_components/tahoma/__init__.py
Expand Up @@ -61,7 +61,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"coordinator": tahoma_coordinator,
}

hass.data[DOMAIN][entry.entry_id]["entities"][
entities = hass.data[DOMAIN][entry.entry_id]["entities"]
entities[
"scene"
] = await client.get_scenarios()

Expand All @@ -72,7 +73,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
)

if platform in SUPPORTED_PLATFORMS:
hass.data[DOMAIN][entry.entry_id]["entities"][platform].append(device)
entities[platform].append(device)

elif device.controllable_name not in [
"ogp:Bridge",
Expand All @@ -86,10 +87,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
device.widget,
)

entities_per_platform = hass.data[DOMAIN][entry.entry_id]["entities"]

for platform in entities_per_platform:
if len(entities_per_platform) > 0:
for platform in entities:
if len(entities) > 0:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, platform)
)
Expand Down
4 changes: 2 additions & 2 deletions custom_components/tahoma/scene.py
Expand Up @@ -15,10 +15,10 @@
async def async_setup_entry(hass, entry, async_add_entities):
"""Set up the TaHoma scenes from a config entry."""
data = hass.data[DOMAIN][entry.entry_id]
controller = data.get("controller")
coordinator = data.get("coordinator")

entities = [
TahomaScene(scene, controller) for scene in data.get("entities").get(SCENE)
TahomaScene(scene, coordinator.client) for scene in data.get("entities").get(SCENE)
]
async_add_entities(entities)

Expand Down

0 comments on commit 919a5cd

Please sign in to comment.