Skip to content

Commit

Permalink
Disable scenarios (scenes) for local API in Overkiz (#105153)
Browse files Browse the repository at this point in the history
  • Loading branch information
iMicknl authored Dec 7, 2023
1 parent 3167767 commit e40f486
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
22 changes: 9 additions & 13 deletions homeassistant/components/overkiz/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
"""The Overkiz (by Somfy) integration."""
from __future__ import annotations

import asyncio
from collections import defaultdict
from dataclasses import dataclass
from typing import cast

from aiohttp import ClientError
from pyoverkiz.client import OverkizClient
Expand All @@ -16,7 +14,7 @@
NotSuchTokenException,
TooManyRequestsException,
)
from pyoverkiz.models import Device, OverkizServer, Scenario, Setup
from pyoverkiz.models import Device, OverkizServer, Scenario
from pyoverkiz.utils import generate_local_server

from homeassistant.config_entries import ConfigEntry
Expand Down Expand Up @@ -82,13 +80,14 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:

try:
await client.login()

setup, scenarios = await asyncio.gather(
*[
client.get_setup(),
client.get_scenarios(),
]
)
setup = await client.get_setup()

# Local API does expose scenarios, but they are not functional.
# Tracked in https://github.com/Somfy-Developer/Somfy-TaHoma-Developer-Mode/issues/21
if api_type == APIType.CLOUD:
scenarios = await client.get_scenarios()
else:
scenarios = []
except (BadCredentialsException, NotSuchTokenException) as exception:
raise ConfigEntryAuthFailed("Invalid authentication") from exception
except TooManyRequestsException as exception:
Expand All @@ -98,9 +97,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
except MaintenanceException as exception:
raise ConfigEntryNotReady("Server is down for maintenance") from exception

setup = cast(Setup, setup)
scenarios = cast(list[Scenario], scenarios)

coordinator = OverkizDataUpdateCoordinator(
hass,
LOGGER,
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/overkiz/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}
},
"local_or_cloud": {
"description": "Choose between local or cloud API. Local API supports TaHoma Connexoon, TaHoma v2, and TaHoma Switch. Climate devices are not supported in local API.",
"description": "Choose between local or cloud API. Local API supports TaHoma Connexoon, TaHoma v2, and TaHoma Switch. Climate devices and scenarios are not supported in local API.",
"data": {
"api_type": "API type"
}
Expand Down

0 comments on commit e40f486

Please sign in to comment.