Skip to content

Commit

Permalink
1.2.2 (#4)
Browse files Browse the repository at this point in the history
* Minor modifications to devices

* Bump version to 1.2.2
  • Loading branch information
marthoc authored Feb 18, 2021
1 parent 16f88b0 commit 0b39aed
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ 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.2] - 2021-02-18
### Added
- New parameter "interface_name" for HomeSeerStatusDevice; can return None if the string is empty.

### Changed
- The property "device_type_string" will now return None if the string is empty.

## [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).
Expand Down
18 changes: 15 additions & 3 deletions libhomeseer/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,11 @@ def status(self) -> str:
return self._raw_data["status"]

@property
def device_type_string(self) -> str:
"""Return the device type string of the device."""
return self._raw_data["device_type_string"]
def device_type_string(self) -> Optional[str]:
"""Return the device type string of the device, or None for no type string (e.g. virtual device)."""
if self._raw_data["device_type_string"]:
return self._raw_data["device_type_string"]
return None

@property
def last_change(self) -> str:
Expand Down Expand Up @@ -103,6 +105,16 @@ def associated_devices(self) -> list:
"""
return self._raw_data["associated_devices"]

@property
def interface_name(self) -> Optional[str]:
"""
Return the name of the interface providing the device, or None for no interface (e.g. virtual device).
Note: this parameter is present in the JSON API data but undocumented.
"""
if self._raw_data["interface_name"]:
return self._raw_data["interface_name"]
return None

def register_update_callback(
self, callback: Callable, suppress_on_connection: bool = False
) -> None:
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.1",
version="1.2.2",
author="Mark Coombes",
author_email="mark@markcoombes.ca",
description="Python3 async library for interacting with HomeSeer HS3 and HS4 via JSON and ASCII",
Expand Down

0 comments on commit 0b39aed

Please sign in to comment.