Skip to content

Commit

Permalink
Disable comelit + weatherflow (pint)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdce8p committed Oct 29, 2024
1 parent 88b5449 commit 8b1782b
Show file tree
Hide file tree
Showing 21 changed files with 120 additions and 65 deletions.
10 changes: 9 additions & 1 deletion homeassistant/components/comelit/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
"""Comelit integration."""

from aiocomelit.const import BRIDGE
import sys

from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_HOST, CONF_PIN, CONF_PORT, CONF_TYPE, Platform
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError

from .const import DEFAULT_PORT, DOMAIN
from .coordinator import ComelitBaseCoordinator, ComelitSerialBridge, ComelitVedoSystem

if sys.version_info < (3, 13):
from aiocomelit.const import BRIDGE

BRIDGE_PLATFORMS = [
Platform.CLIMATE,
Platform.COVER,
Expand All @@ -26,6 +30,10 @@

async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up Comelit platform."""
if sys.version_info >= (3, 13):
raise HomeAssistantError(
"Comelit is not supported on Python 3.13. Please use Python 3.12."
)

coordinator: ComelitBaseCoordinator
if entry.data.get(CONF_TYPE, BRIDGE) == BRIDGE:
Expand Down
8 changes: 5 additions & 3 deletions homeassistant/components/comelit/alarm_control_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
from __future__ import annotations

import logging

from aiocomelit.api import ComelitVedoAreaObject
from aiocomelit.const import ALARM_AREAS, AlarmAreaState
import sys

from homeassistant.components.alarm_control_panel import (
AlarmControlPanelEntity,
Expand All @@ -21,6 +19,10 @@
from .const import DOMAIN
from .coordinator import ComelitVedoSystem

if sys.version_info < (3, 13):
from aiocomelit.api import ComelitVedoAreaObject
from aiocomelit.const import ALARM_AREAS, AlarmAreaState

_LOGGER = logging.getLogger(__name__)

AWAY = "away"
Expand Down
7 changes: 5 additions & 2 deletions homeassistant/components/comelit/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

from __future__ import annotations

from aiocomelit import ComelitVedoZoneObject
from aiocomelit.const import ALARM_ZONES
import sys

from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass,
Expand All @@ -17,6 +16,10 @@
from .const import DOMAIN
from .coordinator import ComelitVedoSystem

if sys.version_info < (3, 13):
from aiocomelit import ComelitVedoZoneObject
from aiocomelit.const import ALARM_ZONES


async def async_setup_entry(
hass: HomeAssistant,
Expand Down
8 changes: 5 additions & 3 deletions homeassistant/components/comelit/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
from __future__ import annotations

from enum import StrEnum
import sys
from typing import Any

from aiocomelit import ComelitSerialBridgeObject
from aiocomelit.const import CLIMATE

from homeassistant.components.climate import (
ClimateEntity,
ClimateEntityFeature,
Expand All @@ -24,6 +22,10 @@
from .const import DOMAIN
from .coordinator import ComelitSerialBridge

if sys.version_info < (3, 13):
from aiocomelit import ComelitSerialBridgeObject
from aiocomelit.const import CLIMATE


class ClimaComelitMode(StrEnum):
"""Serial Bridge clima modes."""
Expand Down
17 changes: 10 additions & 7 deletions homeassistant/components/comelit/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,9 @@
from __future__ import annotations

from collections.abc import Mapping
import sys
from typing import Any

from aiocomelit import (
ComeliteSerialBridgeApi,
ComelitVedoApi,
exceptions as aiocomelit_exceptions,
)
from aiocomelit.api import ComelitCommonApi
from aiocomelit.const import BRIDGE
import voluptuous as vol

from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
Expand All @@ -22,6 +16,15 @@

from .const import _LOGGER, DEFAULT_PORT, DEVICE_TYPE_LIST, DOMAIN

if sys.version_info < (3, 13):
from aiocomelit import (
ComeliteSerialBridgeApi,
ComelitVedoApi,
exceptions as aiocomelit_exceptions,
)
from aiocomelit.api import ComelitCommonApi
from aiocomelit.const import BRIDGE

DEFAULT_HOST = "192.168.1.252"
DEFAULT_PIN = 111111

Expand Down
4 changes: 3 additions & 1 deletion homeassistant/components/comelit/const.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
"""Comelit constants."""

import logging
import sys

from aiocomelit.const import BRIDGE, VEDO
if sys.version_info < (3, 13):
from aiocomelit.const import BRIDGE, VEDO

_LOGGER = logging.getLogger(__package__)

Expand Down
24 changes: 13 additions & 11 deletions homeassistant/components/comelit/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,9 @@

from abc import abstractmethod
from datetime import timedelta
import sys
from typing import Any

from aiocomelit import (
ComeliteSerialBridgeApi,
ComelitSerialBridgeObject,
ComelitVedoApi,
ComelitVedoAreaObject,
ComelitVedoZoneObject,
exceptions,
)
from aiocomelit.api import ComelitCommonApi
from aiocomelit.const import BRIDGE, VEDO

from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryAuthFailed
Expand All @@ -23,6 +13,18 @@

from .const import _LOGGER, DOMAIN

if sys.version_info < (3, 13):
from aiocomelit import (
ComeliteSerialBridgeApi,
ComelitSerialBridgeObject,
ComelitVedoApi,
ComelitVedoAreaObject,
ComelitVedoZoneObject,
exceptions,
)
from aiocomelit.api import ComelitCommonApi
from aiocomelit.const import BRIDGE, VEDO


class ComelitBaseCoordinator(DataUpdateCoordinator[dict[str, Any]]):
"""Base coordinator for Comelit Devices."""
Expand Down
8 changes: 5 additions & 3 deletions homeassistant/components/comelit/cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

from __future__ import annotations

import sys
from typing import Any

from aiocomelit import ComelitSerialBridgeObject
from aiocomelit.const import COVER, STATE_COVER, STATE_OFF, STATE_ON

from homeassistant.components.cover import CoverDeviceClass, CoverEntity, CoverState
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant, callback
Expand All @@ -17,6 +15,10 @@
from .const import DOMAIN
from .coordinator import ComelitSerialBridge

if sys.version_info < (3, 13):
from aiocomelit import ComelitSerialBridgeObject
from aiocomelit.const import COVER, STATE_COVER, STATE_OFF, STATE_ON


async def async_setup_entry(
hass: HomeAssistant,
Expand Down
8 changes: 5 additions & 3 deletions homeassistant/components/comelit/humidifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
from __future__ import annotations

from enum import StrEnum
import sys
from typing import Any

from aiocomelit import ComelitSerialBridgeObject
from aiocomelit.const import CLIMATE

from homeassistant.components.humidifier import (
MODE_AUTO,
MODE_NORMAL,
Expand All @@ -25,6 +23,10 @@
from .const import DOMAIN
from .coordinator import ComelitSerialBridge

if sys.version_info < (3, 13):
from aiocomelit import ComelitSerialBridgeObject
from aiocomelit.const import CLIMATE


class HumidifierComelitMode(StrEnum):
"""Serial Bridge humidifier modes."""
Expand Down
8 changes: 5 additions & 3 deletions homeassistant/components/comelit/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

from __future__ import annotations

import sys
from typing import Any

from aiocomelit import ComelitSerialBridgeObject
from aiocomelit.const import LIGHT, STATE_OFF, STATE_ON

from homeassistant.components.light import ColorMode, LightEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
Expand All @@ -16,6 +14,10 @@
from .const import DOMAIN
from .coordinator import ComelitSerialBridge

if sys.version_info < (3, 13):
from aiocomelit import ComelitSerialBridgeObject
from aiocomelit.const import LIGHT, STATE_OFF, STATE_ON


async def async_setup_entry(
hass: HomeAssistant,
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/comelit/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"iot_class": "local_polling",
"loggers": ["aiocomelit"],
"quality_scale": "silver",
"requirements": ["aiocomelit==0.9.1"]
"requirements": ["aiocomelit==0.9.1;python_version<'3.13'"]
}
8 changes: 5 additions & 3 deletions homeassistant/components/comelit/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

from __future__ import annotations

import sys
from typing import Final

from aiocomelit import ComelitSerialBridgeObject, ComelitVedoZoneObject
from aiocomelit.const import ALARM_ZONES, BRIDGE, OTHER, AlarmZoneState

from homeassistant.components.sensor import (
SensorDeviceClass,
SensorEntity,
Expand All @@ -22,6 +20,10 @@
from .const import DOMAIN
from .coordinator import ComelitSerialBridge, ComelitVedoSystem

if sys.version_info < (3, 13):
from aiocomelit import ComelitSerialBridgeObject, ComelitVedoZoneObject
from aiocomelit.const import ALARM_ZONES, BRIDGE, OTHER, AlarmZoneState

SENSOR_BRIDGE_TYPES: Final = (
SensorEntityDescription(
key="power",
Expand Down
8 changes: 5 additions & 3 deletions homeassistant/components/comelit/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

from __future__ import annotations

import sys
from typing import Any

from aiocomelit import ComelitSerialBridgeObject
from aiocomelit.const import IRRIGATION, OTHER, STATE_OFF, STATE_ON

from homeassistant.components.switch import SwitchDeviceClass, SwitchEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
Expand All @@ -16,6 +14,10 @@
from .const import DOMAIN
from .coordinator import ComelitSerialBridge

if sys.version_info < (3, 13):
from aiocomelit import ComelitSerialBridgeObject
from aiocomelit.const import IRRIGATION, OTHER, STATE_OFF, STATE_ON


async def async_setup_entry(
hass: HomeAssistant,
Expand Down
15 changes: 11 additions & 4 deletions homeassistant/components/weatherflow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,34 @@

from __future__ import annotations

from pyweatherflowudp.client import EVENT_DEVICE_DISCOVERED, WeatherFlowListener
from pyweatherflowudp.device import EVENT_LOAD_COMPLETE, WeatherFlowDevice
from pyweatherflowudp.errors import ListenerError
import sys

from homeassistant.config_entries import ConfigEntry
from homeassistant.const import EVENT_HOMEASSISTANT_STOP, Platform
from homeassistant.core import Event, HomeAssistant, callback
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.exceptions import ConfigEntryNotReady, HomeAssistantError
from homeassistant.helpers.device_registry import DeviceEntry
from homeassistant.helpers.dispatcher import async_dispatcher_send
from homeassistant.helpers.start import async_at_started

from .const import DOMAIN, LOGGER, format_dispatch_call

if sys.version_info < (3, 13):
from pyweatherflowudp.client import EVENT_DEVICE_DISCOVERED, WeatherFlowListener
from pyweatherflowudp.device import EVENT_LOAD_COMPLETE, WeatherFlowDevice
from pyweatherflowudp.errors import ListenerError

PLATFORMS = [
Platform.SENSOR,
]


async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up WeatherFlow from a config entry."""
if sys.version_info >= (3, 13):
raise HomeAssistantError(
"Weatherflow is not supported on Python 3.13. Please use Python 3.12."
)

client = WeatherFlowListener()

Expand Down
8 changes: 5 additions & 3 deletions homeassistant/components/weatherflow/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
import asyncio
from asyncio import Future
from asyncio.exceptions import CancelledError
import sys
from typing import Any

from pyweatherflowudp.client import EVENT_DEVICE_DISCOVERED, WeatherFlowListener
from pyweatherflowudp.errors import AddressInUseError, EndpointError, ListenerError

from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.core import callback

Expand All @@ -20,6 +18,10 @@
ERROR_MSG_NO_DEVICE_FOUND,
)

if sys.version_info < (3, 13):
from pyweatherflowudp.client import EVENT_DEVICE_DISCOVERED, WeatherFlowListener
from pyweatherflowudp.errors import AddressInUseError, EndpointError, ListenerError


async def _async_can_discover_devices() -> bool:
"""Return if there are devices that can be discovered."""
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/weatherflow/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"integration_type": "hub",
"iot_class": "local_push",
"loggers": ["pyweatherflowudp"],
"requirements": ["pyweatherflowudp==1.4.5"]
"requirements": ["pyweatherflowudp==1.4.5;python_version<'3.13'"]
}
Loading

0 comments on commit 8b1782b

Please sign in to comment.