diff --git a/CHANGELOG.md b/CHANGELOG.md index 67b54e7..417ffbc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,19 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.2.1] - 2021-02-18 +### Added +- New constants RELATIONSHIP_CHILD, RELATIONSHIP_ROOT, and RELATIONSHIP_STANDALONE added to .const (and returned from the relationship property of HomeSeerStatusDevice). + +## [1.2.0] - 2021-02-16 +### Changed +- The get_devices method in .devices has been refactored (along with the device classes) to provide "support" for all HomeSeer devices, regardless of device_type_string. The get_devices method no longer returns device objects based on device_type_string, but instead based on the Control Pairs detected for the device. This change makes libhomeseer completely agnostic as to the technology or plug-in that provides the device. All HomeSeer devices are now supported and libhomeseer will return at least a status-only object for every device. Devices with Control Pairs that fall into certain categories (initially On/Off, On/Off/Dim, and Lock/Unlock) will have an object returned with appropriate methods (e.g. on(), off(), dim(), lock(), unlock()) that match the device's detected Control Pairs. +- The release.sh script now builds a wheel for the library in addition to the source distribution. + +## [1.1.0] - 2021-02-15 +### Added +- New units Amperes, kW, Volts, and Watts to the get_uom_from_status helper function. + ## [1.0.0] - 2021-02-08 ### Added - First release of libhomeseer after deprecation of pyhs3. diff --git a/libhomeseer/const.py b/libhomeseer/const.py index 05fe94a..edc3e70 100644 --- a/libhomeseer/const.py +++ b/libhomeseer/const.py @@ -21,3 +21,7 @@ DEVICE_ZWAVE_SWITCH_BINARY = "Z-Wave Switch Binary" DEVICE_ZWAVE_SWITCH_MULTILEVEL = "Z-Wave Switch Multilevel" DEVICE_ZWAVE_TEMPERATURE = "Z-Wave Temperature" + +RELATIONSHIP_ROOT = 2 +RELATIONSHIP_STANDALONE = 3 +RELATIONSHIP_CHILD = 4 diff --git a/libhomeseer/devices.py b/libhomeseer/devices.py index 25ddc06..bbd7f1b 100644 --- a/libhomeseer/devices.py +++ b/libhomeseer/devices.py @@ -3,6 +3,8 @@ import logging from typing import Callable, Optional, Union +from .const import RELATIONSHIP_CHILD, RELATIONSHIP_ROOT, RELATIONSHIP_STANDALONE + CONTROL_USE_ON = 1 CONTROL_USE_OFF = 2 CONTROL_USE_DIM = 3 @@ -83,7 +85,14 @@ def relationship(self) -> int: 3 = Standalone (this is the only device that represents this physical device) 4 = Child (this device is part of a group of devices that represent the physical device) """ - return int(self._raw_data["relationship"]) + relationship = int(self._raw_data["relationship"]) + if relationship == RELATIONSHIP_ROOT: + return RELATIONSHIP_ROOT + elif relationship == RELATIONSHIP_CHILD: + return RELATIONSHIP_CHILD + elif relationship == RELATIONSHIP_STANDALONE: + return RELATIONSHIP_STANDALONE + return relationship @property def associated_devices(self) -> list: diff --git a/setup.py b/setup.py index 575b4b9..840c9f7 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ setuptools.setup( name="libhomeseer", - version="1.2.0", + version="1.2.1", author="Mark Coombes", author_email="mark@markcoombes.ca", description="Python3 async library for interacting with HomeSeer HS3 and HS4 via JSON and ASCII",