Skip to content

Commit

Permalink
Merge pull request #21 from msp1974/dev
Browse files Browse the repository at this point in the history
v1.6.0
  • Loading branch information
msp1974 authored Nov 27, 2024
2 parents 537f8af + b7b1178 commit 207096d
Show file tree
Hide file tree
Showing 12 changed files with 824 additions and 110 deletions.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Drayton Wiser Hub API Async v1.5.19
# Drayton Wiser Hub API Async v1.6.0

This repository contains a simple API which queries the Drayton Wiser Heating sysystem used in the UK.

Expand Down Expand Up @@ -52,6 +52,16 @@ Documentation available in [info.md](https://github.com/msp1974/wiserHeatAPIv2/b

## Changelog

### v1.6.0
* Refactored how devices are enumerated
* BREAKING CHANGE - threshold sensor is now a device attribute and not its own device
* Added: support for 2 gang light switches
* Added: support for threshold and UI configuration as device attributes
* Added: support for PTC devices
* Added: UUID now exists for all devices (for future use)
* Added: New attributes and stored extra config for Hot Water to support HW Climate automation in HA integration
* Added: Control of interacts with room climate for binary sensors

### v1.5.19
* Fixed error when BoilerInterface does not provide DeviceId field
* Fixed not supporting non ascii characters in schedule names
Expand Down
2 changes: 1 addition & 1 deletion aioWiserHeatAPI/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
name = "aioWiserHeatAPI"
__all__ = ["wiserAPI", "wiserDiscovery"]

__VERSION__ = "1.5.19"
__VERSION__ = "1.6.0"

_LOGGER = logging.getLogger(__name__)
40 changes: 40 additions & 0 deletions aioWiserHeatAPI/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,43 @@
Handles binary_sensor devices
"""

import inspect

from aioWiserHeatAPI import _LOGGER

from .helpers.battery import _WiserBattery
from .helpers.device import _WiserDevice
from .helpers.threshold import _WiserThresholdSensor


class _WiserBinarySensor(_WiserDevice):
"""Class representing a Wiser Binary Sensor"""

def __init__(self, *args):
"""Initialise."""
super().__init__(*args)
self._threshold_sensors: list[_WiserThresholdSensor] = []

async def _send_command(self, cmd: dict):
"""
Send control command to the Threshold sensor
param cmd: json command structure
return: boolen - true = success, false = failed
"""
result = await self._wiser_rest_controller._send_command(
self._endpoint.format(self.device_type_id), cmd
)
if result:
self._device_type_data = result
if result:
_LOGGER.debug(
"Wiser light - {} command successful".format(
inspect.stack()[1].function
)
)
return True
return False

@property
def active(self) -> bool:
"""Get if is active"""
Expand All @@ -19,6 +49,11 @@ def interacts_with_room_climate(self) -> bool:
"""Get the if interacts with room climate"""
return self._device_type_data.get("InteractsWithRoomClimate")

async def set_interacts_with_room_climate(self, enabled: bool):
if await self._send_command({"InteractsWithRoomClimate": str(enabled).lower()}):
self._interacts_with_room_climate = enabled
return True

@property
def type(self) -> str:
"""Get the type of device"""
Expand All @@ -34,6 +69,11 @@ def battery(self) -> _WiserBattery:
"""Get the battery information for the smokealarm"""
return _WiserBattery(self._data)

@property
def threshold_sensors(self) -> list[_WiserThresholdSensor]:
"""Get threshold sensors."""
return self._threshold_sensors


class _WiserWindowDoorSensor(_WiserBinarySensor):
"""Class representing a Wiser WindowDoor Sensor"""
Expand Down
3 changes: 3 additions & 0 deletions aioWiserHeatAPI/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,14 @@
WISERUFHCONTROLLER = "UnderFloorHeating/{}"
WISERSHUTTER = "Shutter/{}"
WISERLIGHT = "Light/{}"
WISERPOWERTAGCONTROL = "PTC/{}"
WISERPOWERTAGENERGY = "PTE/{}"
WISERSMOKEALARM = "SmokeAlarmDevice/{}"
WISERBINARYSENSOR = "BinarySensor/{}"
WISERBOILERINTERFACE = "BoilerInterface/{}"
WISERBUTTONPANEL = "ButtonPanel/{}"
WISERTHRESHOLDSENSOR = "ThresholdSensor/{}"
WISERUICONFIGURATION = "UIConfiguration/{}"


# Enums
Expand Down
Loading

0 comments on commit 207096d

Please sign in to comment.