Skip to content

Commit

Permalink
1.2.1 (#3)
Browse files Browse the repository at this point in the history
* Add relationship constants

Required for device support in Home Assistant, but constants will also be useful for any application in which determining the relationship of the device is relevant.

* Bump version to 1.2.1

* Update CHANGELOG
  • Loading branch information
marthoc authored Feb 18, 2021
1 parent 6df3da2 commit 16f88b0
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions libhomeseer/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
11 changes: 10 additions & 1 deletion libhomeseer/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

setuptools.setup(
name="libhomeseer",
version="1.2.0",
version="1.2.1",
author="Mark Coombes",
author_email="[email protected]",
description="Python3 async library for interacting with HomeSeer HS3 and HS4 via JSON and ASCII",
Expand Down

0 comments on commit 16f88b0

Please sign in to comment.