Skip to content
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
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "xcomfort"
version = "0.4.1"
version = "0.4.2"
description = "Integration with Eaton xComfort Bridge"
readme = "README.md"
license = {text = "MIT"}
Expand All @@ -18,15 +18,14 @@ classifiers = [
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
requires-python = ">=3.7"
requires-python = ">=3.8"
dependencies = [
"aiohttp",
"rx",
Expand Down
10 changes: 7 additions & 3 deletions xcomfort/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,18 +151,22 @@ class HeatingTypes(IntEnum):
class ComponentTypes(IntEnum):
"""Component types for xComfort devices."""

PUSH_BUTTON_1 = 1
PUSH_BUTTON_2 = 2
PUSH_BUTTON_1_CHANNEL = 1
PUSH_BUTTON_2_CHANNEL = 2
PUSH_BUTTON_4_CHANNEL = 3
MULTI_HEATING_ACTUATOR = 71
LIGHT_SWITCH_ACTUATOR = 74
DOOR_WINDOW_SENSOR = 76
DIMMING_ACTUATOR = 77
RC_TOUCH = 78
HEATING_ACTUATOR_1_CHANNEL = 81
BRIDGE = 83
WATER_GUARD = 84
WATER_SENSOR = 85
SHADING_ACTUATOR = 86
MULTI_SENSOR_PUSH_BUTTON_1 = 87
PUSH_BUTTON_MULTI_SENSOR_1_CHANNEL = 87
PUSH_BUTTON_MULTI_SENSOR_2_CHANNEL = 88
PUSH_BUTTON_MULTI_SENSOR_4_CHANNEL = 89


# Firmware build version mappings
Expand Down
16 changes: 12 additions & 4 deletions xcomfort/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import rx

from .constants import Messages, ShadeOperationState
from .constants import ComponentTypes, Messages, ShadeOperationState

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -351,7 +351,11 @@ def __init__(self, bridge, device_id, name, comp_id, payload):

# Subscribe to component state updates if this is a multisensor
comp = bridge._comps.get(comp_id) # noqa: SLF001
if comp is not None and comp.comp_type == 87:
if comp is not None and comp.comp_type in (
ComponentTypes.PUSH_BUTTON_MULTI_SENSOR_1_CHANNEL,
ComponentTypes.PUSH_BUTTON_MULTI_SENSOR_2_CHANNEL,
ComponentTypes.PUSH_BUTTON_MULTI_SENSOR_4_CHANNEL,
):
comp.state.subscribe(lambda _: self._on_component_update())
# Find and subscribe to companion sensor device
self._find_and_subscribe_sensor_device()
Expand All @@ -371,8 +375,12 @@ def name_with_controlled(self) -> str:
def has_sensors(self) -> bool:
"""Check if this rocker has sensor capabilities."""
comp = self.bridge._comps.get(self.comp_id) # noqa: SLF001
# Component type 87 is MULTI_SENSOR_PUSH_BUTTON_1
return comp is not None and comp.comp_type == 87
# Check if component is any multi sensor push button type
return comp is not None and comp.comp_type in (
ComponentTypes.PUSH_BUTTON_MULTI_SENSOR_1_CHANNEL,
ComponentTypes.PUSH_BUTTON_MULTI_SENSOR_2_CHANNEL,
ComponentTypes.PUSH_BUTTON_MULTI_SENSOR_4_CHANNEL,
)

def _find_and_subscribe_sensor_device(self) -> None:
"""Find companion sensor device and subscribe to its updates.
Expand Down
Loading