Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename tahoma domain to overkiz domain #49389

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -971,15 +971,15 @@ omit =
homeassistant/components/systemmonitor/sensor.py
homeassistant/components/tado/*
homeassistant/components/tado/device_tracker.py
homeassistant/components/tahoma/__init__.py
homeassistant/components/tahoma/binary_sensor.py
homeassistant/components/tahoma/coordinator.py
homeassistant/components/tahoma/cover.py
homeassistant/components/tahoma/light.py
homeassistant/components/tahoma/lock.py
homeassistant/components/tahoma/overkiz_executor.py
homeassistant/components/tahoma/scene.py
homeassistant/components/tahoma/tahoma_entity.py
homeassistant/components/overkiz/__init__.py
homeassistant/components/overkiz/binary_sensor.py
homeassistant/components/overkiz/coordinator.py
homeassistant/components/overkiz/cover.py
homeassistant/components/overkiz/light.py
homeassistant/components/overkiz/lock.py
homeassistant/components/overkiz/overkiz_executor.py
homeassistant/components/overkiz/scene.py
homeassistant/components/overkiz/overkiz_entity.py
homeassistant/components/tank_utility/sensor.py
homeassistant/components/tankerkoenig/*
homeassistant/components/tapsaff/binary_sensor.py
Expand Down
2 changes: 1 addition & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ homeassistant/components/openweathermap/* @fabaff @freekode @nzapponi
homeassistant/components/opnsense/* @mtreinish
homeassistant/components/orangepi_gpio/* @pascallj
homeassistant/components/oru/* @bvlaicu
homeassistant/components/overkiz/* @imicknl @vlebourl @tetienne
homeassistant/components/ovo_energy/* @timmo001
homeassistant/components/ozw/* @cgarwood @marcelveldt @MartinHjelmare
homeassistant/components/panel_custom/* @home-assistant/frontend
Expand Down Expand Up @@ -476,7 +477,6 @@ homeassistant/components/synology_srm/* @aerialls
homeassistant/components/syslog/* @fabaff
homeassistant/components/tado/* @michaelarnauts @bdraco @noltari
homeassistant/components/tag/* @balloob @dmulcahey
homeassistant/components/tahoma/* @imicknl @vlebourl @tetienne
homeassistant/components/tankerkoenig/* @guillempages
homeassistant/components/tapsaff/* @bazwilliams
homeassistant/components/tasmota/* @emontnemery
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""The Somfy TaHoma integration."""
"""The Overkiz integration."""
import asyncio
from collections import defaultdict
from datetime import timedelta
Expand All @@ -25,22 +25,22 @@
DEFAULT_HUB,
DEFAULT_UPDATE_INTERVAL,
DOMAIN,
IGNORED_TAHOMA_DEVICES,
IGNORED_OVERKIZ_DEVICES,
OVERKIZ_DEVICE_TO_PLATFORM,
SUPPORTED_ENDPOINTS,
TAHOMA_DEVICE_TO_PLATFORM,
)
from .coordinator import TahomaDataUpdateCoordinator
from .coordinator import OverkizDataUpdateCoordinator

_LOGGER = logging.getLogger(__name__)


async def async_setup(hass: HomeAssistant, config: dict):
"""Set up the Somfy TaHoma component."""
"""Set up the Overkiz component."""
return True


async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up Somfy TaHoma from a config entry."""
"""Set up Overkiz from a config entry."""
hass.data.setdefault(DOMAIN, {})

username = entry.data.get(CONF_USERNAME)
Expand Down Expand Up @@ -81,7 +81,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
seconds=entry.options.get(CONF_UPDATE_INTERVAL, DEFAULT_UPDATE_INTERVAL)
)

tahoma_coordinator = TahomaDataUpdateCoordinator(
overkiz_coordinator = OverkizDataUpdateCoordinator(
hass,
_LOGGER,
name="device events",
Expand All @@ -95,29 +95,29 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"Initialized DataUpdateCoordinator with %s interval", str(update_interval)
)

await tahoma_coordinator.async_refresh()
await overkiz_coordinator.async_refresh()

platforms = defaultdict(list)
platforms[SCENE] = scenarios

hass.data[DOMAIN][entry.entry_id] = {
"platforms": platforms,
"coordinator": tahoma_coordinator,
"coordinator": overkiz_coordinator,
"update_listener": entry.add_update_listener(update_listener),
}

for device in tahoma_coordinator.data.values():
platform = TAHOMA_DEVICE_TO_PLATFORM.get(
for device in overkiz_coordinator.data.values():
platform = OVERKIZ_DEVICE_TO_PLATFORM.get(
device.widget
) or TAHOMA_DEVICE_TO_PLATFORM.get(device.ui_class)
) or OVERKIZ_DEVICE_TO_PLATFORM.get(device.ui_class)
if platform:
platforms[platform].append(device)
elif (
device.widget not in IGNORED_TAHOMA_DEVICES
and device.ui_class not in IGNORED_TAHOMA_DEVICES
device.widget not in IGNORED_OVERKIZ_DEVICES
and device.ui_class not in IGNORED_OVERKIZ_DEVICES
):
_LOGGER.debug(
"Unsupported TaHoma device detected (%s - %s - %s)",
"Unsupported Overkiz device detected (%s - %s - %s)",
device.controllable_name,
device.ui_class,
device.widget,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Support for Somfy TaHoma binary sensors."""
"""Support for Overkiz binary sensors."""
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_GAS,
DEVICE_CLASS_MOISTURE,
Expand All @@ -11,7 +11,7 @@
)

from .const import DOMAIN
from .tahoma_entity import TahomaEntity
from .overkiz_entity import OverkizEntity

CORE_ASSEMBLY_STATE = "core:AssemblyState"
CORE_BUTTON_STATE = "core:ButtonState"
Expand All @@ -33,7 +33,7 @@
STATE_DETECTED = "detected"
STATE_PRESSED = "pressed"

TAHOMA_BINARY_SENSOR_DEVICE_CLASSES = {
OVERKIZ_BINARY_SENSOR_DEVICE_CLASSES = {
"AirFlowSensor": DEVICE_CLASS_GAS,
"CarButtonSensor": None,
"ContactSensor": DEVICE_CLASS_OPENING,
Expand All @@ -49,19 +49,19 @@


async def async_setup_entry(hass, entry, async_add_entities):
"""Set up the TaHoma sensors from a config entry."""
"""Set up the Overkiz sensors from a config entry."""
data = hass.data[DOMAIN][entry.entry_id]
coordinator = data["coordinator"]

entities = [
TahomaBinarySensor(device.deviceurl, coordinator)
OverkizBinarySensor(device.deviceurl, coordinator)
for device in data["platforms"][BINARY_SENSOR]
]
async_add_entities(entities)


class TahomaBinarySensor(TahomaEntity, BinarySensorEntity):
"""Representation of a TaHoma Binary Sensor."""
class OverkizBinarySensor(OverkizEntity, BinarySensorEntity):
"""Representation of a Overkiz Binary Sensor."""

@property
def is_on(self):
Expand Down Expand Up @@ -89,6 +89,6 @@ def is_on(self):
@property
def device_class(self):
"""Return the class of the device."""
return TAHOMA_BINARY_SENSOR_DEVICE_CLASSES.get(
return OVERKIZ_BINARY_SENSOR_DEVICE_CLASSES.get(
self.device.widget
) or TAHOMA_BINARY_SENSOR_DEVICE_CLASSES.get(self.device.ui_class)
) or OVERKIZ_BINARY_SENSOR_DEVICE_CLASSES.get(self.device.ui_class)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Config flow for Somfy TaHoma integration."""
"""Config flow for Overkiz integration."""
import logging

from aiohttp import ClientError
Expand Down Expand Up @@ -37,7 +37,7 @@


class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
"""Handle a config flow for Somfy TaHoma."""
"""Handle a config flow for Overkiz."""

VERSION = 1
CONNECTION_CLASS = config_entries.CONN_CLASS_CLOUD_POLL
Expand Down Expand Up @@ -88,14 +88,14 @@ async def async_step_user(self, user_input=None):


class OptionsFlowHandler(config_entries.OptionsFlow):
"""Handle a option flow for TaHoma."""
"""Handle a option flow for Overkiz."""

def __init__(self, config_entry):
"""Initialize options flow."""
self.config_entry = config_entry

async def async_step_init(self, user_input=None):
"""Manage the Somfy TaHoma options."""
"""Manage the Overkiz options."""
return await self.async_step_update_interval()

async def async_step_update_interval(self, user_input=None):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""Constants for the Somfy TaHoma integration."""
"""Constants for the Overkiz integration."""
from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR
from homeassistant.components.cover import DOMAIN as COVER
from homeassistant.components.light import DOMAIN as LIGHT
from homeassistant.components.lock import DOMAIN as LOCK

DOMAIN = "tahoma"
DOMAIN = "overkiz"

CONF_HUB = "hub"
DEFAULT_HUB = "Somfy (Europe)"
Expand All @@ -22,13 +22,13 @@
"Somfy (North America)": "https://ha401-1.overkiz.com/enduser-mobile-web/enduserAPI/",
}

IGNORED_TAHOMA_DEVICES = [
IGNORED_OVERKIZ_DEVICES = [
"ProtocolGateway",
"Pod",
]

# Used to map the Somfy widget and ui_class to the Home Assistant platform
TAHOMA_DEVICE_TO_PLATFORM = {
OVERKIZ_DEVICE_TO_PLATFORM = {
"AdjustableSlatsRollerShutter": COVER,
"AirFlowSensor": BINARY_SENSOR, # widgetName, uiClass is AirSensor (sensor)
"Awning": COVER,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
_LOGGER = logging.getLogger(__name__)


class TahomaDataUpdateCoordinator(DataUpdateCoordinator):
"""Class to manage fetching TaHoma data."""
class OverkizDataUpdateCoordinator(DataUpdateCoordinator):
"""Class to manage fetching Overkiz data."""

def __init__(
self,
Expand Down Expand Up @@ -63,7 +63,7 @@ def __init__(
self.areas = self._places_to_area(places)

async def _async_update_data(self) -> Dict[str, Device]:
"""Fetch TaHoma data via event listener."""
"""Fetch Overkiz data via event listener."""
try:
events = await self.client.fetch_events()
except BadCredentialsException as exception:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Support for TaHoma cover - shutters etc."""
"""Support for Overkiz cover - shutters etc."""
import logging

from homeassistant.components.cover import (
Expand All @@ -24,7 +24,7 @@
)

from .const import DOMAIN
from .tahoma_entity import TahomaEntity
from .overkiz_entity import OverkizEntity
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a future PR, it would be cleaner to call this entity.py since its already in the overkiz namespace.


_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -79,7 +79,7 @@

STATE_CLOSED = "closed"

TAHOMA_COVER_DEVICE_CLASSES = {
OVERKIZ_COVER_DEVICE_CLASSES = {
"Awning": DEVICE_CLASS_AWNING,
"Blind": DEVICE_CLASS_BLIND,
"Curtain": DEVICE_CLASS_CURTAIN,
Expand All @@ -97,20 +97,20 @@


async def async_setup_entry(hass, entry, async_add_entities):
"""Set up the TaHoma covers from a config entry."""
"""Set up the Overkiz covers from a config entry."""
data = hass.data[DOMAIN][entry.entry_id]
coordinator = data["coordinator"]

entities = [
TahomaCover(device.deviceurl, coordinator)
OverkizCover(device.deviceurl, coordinator)
for device in data["platforms"][COVER]
]

async_add_entities(entities)


class TahomaCover(TahomaEntity, CoverEntity):
"""Representation of a TaHoma Cover."""
class OverkizCover(OverkizEntity, CoverEntity):
"""Representation of a Overkiz Cover."""

@property
def current_cover_position(self):
Expand Down Expand Up @@ -192,8 +192,8 @@ def is_closed(self):
def device_class(self):
"""Return the class of the device."""
return (
TAHOMA_COVER_DEVICE_CLASSES.get(self.device.widget)
or TAHOMA_COVER_DEVICE_CLASSES.get(self.device.ui_class)
OVERKIZ_COVER_DEVICE_CLASSES.get(self.device.widget)
or OVERKIZ_COVER_DEVICE_CLASSES.get(self.device.ui_class)
or DEVICE_CLASS_BLIND
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Support for TaHoma lights."""
"""Support for Overkiz lights."""
import logging

from homeassistant.components.light import (
Expand All @@ -13,7 +13,7 @@
import homeassistant.util.color as color_util

from .const import COMMAND_OFF, COMMAND_ON, CORE_ON_OFF_STATE, DOMAIN
from .tahoma_entity import TahomaEntity
from .overkiz_entity import OverkizEntity

_LOGGER = logging.getLogger(__name__)

Expand All @@ -28,20 +28,20 @@


async def async_setup_entry(hass, entry, async_add_entities):
"""Set up the TaHoma lights from a config entry."""
"""Set up the Overkiz lights from a config entry."""
data = hass.data[DOMAIN][entry.entry_id]
coordinator = data["coordinator"]

entities = [
TahomaLight(device.deviceurl, coordinator)
OverkizLight(device.deviceurl, coordinator)
for device in data["platforms"][LIGHT]
]

async_add_entities(entities)


class TahomaLight(TahomaEntity, LightEntity):
"""Representation of a TaHoma Light."""
class OverkizLight(OverkizEntity, LightEntity):
"""Representation of a Overkiz Light."""

@property
def brightness(self) -> int:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"""Support for TaHoma locks."""
"""Support for Overkiz locks."""
import logging

from homeassistant.components.lock import DOMAIN as LOCK, LockEntity
from homeassistant.const import STATE_LOCKED

from .const import DOMAIN
from .tahoma_entity import TahomaEntity
from .overkiz_entity import OverkizEntity

_LOGGER = logging.getLogger(__name__)

Expand All @@ -16,19 +16,19 @@


async def async_setup_entry(hass, entry, async_add_entities):
"""Set up the TaHoma locks from a config entry."""
"""Set up the Overkiz locks from a config entry."""
data = hass.data[DOMAIN][entry.entry_id]
coordinator = data["coordinator"]

entities = [
TahomaLock(device.deviceurl, coordinator) for device in data["platforms"][LOCK]
OverkizLock(device.deviceurl, coordinator) for device in data["platforms"][LOCK]
]

async_add_entities(entities)


class TahomaLock(TahomaEntity, LockEntity):
"""Representation of a TaHoma Lock."""
class OverkizLock(OverkizEntity, LockEntity):
"""Representation of a Overkiz Lock."""

async def async_unlock(self, **_):
"""Unlock method."""
Expand Down
Loading