Skip to content

Commit

Permalink
Move overkiz water heater definitions (#125756)
Browse files Browse the repository at this point in the history
  • Loading branch information
epenet authored Sep 11, 2024
1 parent af5c63f commit 315d59d
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 20 deletions.
57 changes: 57 additions & 0 deletions homeassistant/components/overkiz/water_heater/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
"""Support for Overkiz water heater devices."""

from __future__ import annotations

from pyoverkiz.enums.ui import UIWidget

from homeassistant.config_entries import ConfigEntry
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback

from .. import HomeAssistantOverkizData
from ..const import DOMAIN
from ..entity import OverkizEntity
from .atlantic_domestic_hot_water_production_mlb_component import (
AtlanticDomesticHotWaterProductionMBLComponent,
)
from .atlantic_pass_apc_dhw import AtlanticPassAPCDHW
from .domestic_hot_water_production import DomesticHotWaterProduction
from .hitachi_dhw import HitachiDHW


async def async_setup_entry(
hass: HomeAssistant,
entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) -> None:
"""Set up the Overkiz DHW from a config entry."""
data: HomeAssistantOverkizData = hass.data[DOMAIN][entry.entry_id]
entities: list[OverkizEntity] = []

for device in data.platforms[Platform.WATER_HEATER]:
if device.controllable_name in CONTROLLABLE_NAME_TO_WATER_HEATER_ENTITY:
entities.append(
CONTROLLABLE_NAME_TO_WATER_HEATER_ENTITY[device.controllable_name](
device.device_url, data.coordinator
)
)
elif device.widget in WIDGET_TO_WATER_HEATER_ENTITY:
entities.append(
WIDGET_TO_WATER_HEATER_ENTITY[device.widget](
device.device_url, data.coordinator
)
)

async_add_entities(entities)


WIDGET_TO_WATER_HEATER_ENTITY = {
UIWidget.ATLANTIC_PASS_APC_DHW: AtlanticPassAPCDHW,
UIWidget.DOMESTIC_HOT_WATER_PRODUCTION: DomesticHotWaterProduction,
UIWidget.HITACHI_DHW: HitachiDHW,
}

CONTROLLABLE_NAME_TO_WATER_HEATER_ENTITY = {
"modbuslink:AtlanticDomesticHotWaterProductionMBLComponent": AtlanticDomesticHotWaterProductionMBLComponent,
}
20 changes: 0 additions & 20 deletions homeassistant/components/overkiz/water_heater_entities/__init__.py

This file was deleted.

0 comments on commit 315d59d

Please sign in to comment.