Skip to content

Commit

Permalink
Merge pull request #188 from ikalchev/v2.5.0
Browse files Browse the repository at this point in the history
Merge v2.5.0 into master
  • Loading branch information
ikalchev authored Apr 10, 2019
2 parents 5ac5b83 + 0d7aef6 commit 291f175
Show file tree
Hide file tree
Showing 8 changed files with 414 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ Sections
### Developers
-->

## [2.5.0] - 2019-04-10

### Added
- Added support for Television accessories.

## [2.4.2] - 2019-01-04

### Fixed
Expand Down
6 changes: 6 additions & 0 deletions pyhap/accessory.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ def add_preload_service(self, service, chars=None):
self.add_service(service)
return service

def set_primary_service(self, primary_service):
"""Set the primary service of the acc."""
for service in self.services:
service.is_primary_service = service.type_id == \
primary_service.type_id

def config_changed(self):
"""Notify the accessory about configuration changes.
Expand Down
9 changes: 7 additions & 2 deletions pyhap/const.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""This module contains constants used by other modules."""
MAJOR_VERSION = 2
MINOR_VERSION = 4
PATCH_VERSION = 2
MINOR_VERSION = 5
PATCH_VERSION = 0
__short_version__ = '{}.{}'.format(MAJOR_VERSION, MINOR_VERSION)
__version__ = '{}.{}'.format(__short_version__, PATCH_VERSION)
REQUIRED_PYTHON_VER = (3, 5)
Expand Down Expand Up @@ -45,13 +45,16 @@
CATEGORY_SPRINKLER = 28
CATEGORY_FAUCET = 29
CATEGORY_SHOWER_HEAD = 30
CATEGORY_TELEVISION = 31
CATEGORY_TARGET_CONTROLLER = 32 # Remote Controller


# ### HAP Permissions ###
HAP_PERMISSION_HIDDEN = 'hd'
HAP_PERMISSION_NOTIFY = 'ev'
HAP_PERMISSION_READ = 'pr'
HAP_PERMISSION_WRITE = 'pw'
HAP_PERMISSION_WRITE_RESPONSE = 'wr'


# ### HAP representation ###
Expand All @@ -63,7 +66,9 @@
HAP_REPR_IID = 'iid'
HAP_REPR_MAX_LEN = 'maxLen'
HAP_REPR_PERM = 'perms'
HAP_REPR_PRIMARY = 'primary'
HAP_REPR_SERVICES = 'services'
HAP_REPR_LINKED = 'linked'
HAP_REPR_STATUS = 'status'
HAP_REPR_TYPE = 'type'
HAP_REPR_VALUE = 'value'
232 changes: 232 additions & 0 deletions pyhap/resources/characteristics.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@
"Inactive": 0
}
},
"ActiveIdentifier": {
"Format": "uint32",
"Permissions": [
"pr",
"pw",
"ev"
],
"UUID": "000000E7-0000-1000-8000-0026BB765291"
},
"AdministratorOnlyAccess": {
"Format": "bool",
"Permissions": [
Expand Down Expand Up @@ -182,6 +191,19 @@
"NotCharging": 0
}
},
"ClosedCaptions": {
"Format": "uint8",
"Permissions": [
"pr",
"pw",
"ev"
],
"UUID": "000000DD-0000-1000-8000-0026BB765291",
"ValidValues": {
"Disabled": 0,
"Enabled": 1
}
},
"ColorTemperature": {
"Format": "uint32",
"Permissions": [
Expand All @@ -194,6 +216,15 @@
"minStep": 1,
"minValue": 140
},
"ConfiguredName": {
"Format": "string",
"Permissions": [
"pr",
"pw",
"ev"
],
"UUID": "000000E3-0000-1000-8000-0026BB765291"
},
"ContactSensorState": {
"Format": "uint8",
"Permissions": [
Expand Down Expand Up @@ -324,6 +355,20 @@
"Inactive": 0
}
},
"CurrentMediaState": {
"Format": "uint8",
"Permissions": [
"pr",
"ev"
],
"UUID": "000000E0-0000-1000-8000-0026BB765291",
"ValidValues": {
"Play": 0,
"Pause": 1,
"Stop": 2,
"Unknown": 3
}
},
"CurrentPosition": {
"Format": "uint8",
"Permissions": [
Expand Down Expand Up @@ -397,6 +442,18 @@
"minValue": -90,
"unit": "arcdegrees"
},
"CurrentVisibilityState":{
"Format": "uint8",
"Permissions": [
"pr",
"ev"
],
"UUID": "00000135-0000-1000-8000-0026BB765291",
"ValidValues": {
"Shown": 0,
"Hidden": 1
}
},
"DigitalZoom": {
"Format": "float",
"Permissions": [
Expand All @@ -406,6 +463,15 @@
],
"UUID": "0000011D-0000-1000-8000-0026BB765291"
},
"DisplayOrder": {
"Format": "tlv8",
"Permissions": [
"pr",
"pw",
"ev"
],
"UUID": "00000136-0000-1000-8000-0026BB765291"
},
"FilterChangeIndication": {
"Format": "uint8",
"Permissions": [
Expand Down Expand Up @@ -476,6 +542,15 @@
"minValue": 0,
"unit": "arcdegrees"
},
"Identifier": {
"Format": "uint32",
"Permissions": [
"pr"
],
"UUID": "000000E6-0000-1000-8000-0026BB765291",
"minStep": 1,
"minValue": 0
},
"Identify": {
"Format": "bool",
"Permissions": [
Expand Down Expand Up @@ -505,6 +580,43 @@
"minValue": 0,
"unit": "arcdegrees"
},
"InputSourceType":{
"Format": "uint8",
"Permissions": [
"pr",
"ev"
],
"UUID": "000000DB-0000-1000-8000-0026BB765291",
"ValidValues": {
"Other": 0,
"HomeScreen": 1,
"Tuner": 2,
"HDMI": 3,
"CompositeVideo": 4,
"SVideo": 5,
"ComponentVideo": 6,
"DVI": 7,
"AirPlay": 8,
"USB": 9,
"Application": 10
}
},
"InputDeviceType":{
"Format": "uint8",
"Permissions": [
"pr",
"ev"
],
"UUID": "000000DC-0000-1000-8000-0026BB765291",
"ValidValues": {
"Other": 0,
"TV": 1,
"Recording": 2,
"Tuner": 3,
"Playback": 4,
"AudioSystem": 5
}
},
"InUse": {
"Format": "uint8",
"Permissions": [
Expand Down Expand Up @@ -794,6 +906,27 @@
],
"UUID": "00000050-0000-1000-8000-0026BB765291"
},
"PictureMode":{
"Format": "uint8",
"Permissions": [
"pr",
"pw",
"ev"
],
"UUID": "000000E2-0000-1000-8000-0026BB765291",
"maxValue": 13,
"minValue": 0,
"ValidValues": {
"Other": 0,
"Standard": 1,
"Calibrated": 2,
"CalibratedDark": 3,
"Vivid": 4,
"Game": 5,
"Computer": 6,
"Custom": 7
}
},
"PositionState": {
"Format": "uint8",
"Permissions": [
Expand All @@ -807,6 +940,17 @@
"Stopped": 2
}
},
"PowerModeSelection":{
"Format": "uint8",
"Permissions": [
"pw"
],
"UUID": "000000DF-0000-1000-8000-0026BB765291",
"ValidValues": {
"Show": 0,
"Hide": 1
}
},
"ProgramMode": {
"Format": "uint8",
"Permissions": [
Expand Down Expand Up @@ -870,6 +1014,30 @@
"minStep": 1,
"minValue": 0
},
"RemoteKey":{
"Format": "uint8",
"Permissions": [
"pw"
],
"UUID": "000000E1-0000-1000-8000-0026BB765291",
"maxValue": 16,
"minValue": 0,
"ValidValues": {
"Rewind": 0,
"FastForward": 1,
"NextTrack": 2,
"PreviousTrack": 3,
"ArrowUp": 4,
"ArrowDown": 5,
"ArrowLeft": 6,
"ArrowRight": 7,
"Select": 8,
"Back": 9,
"Exit": 10,
"PlayPause": 11,
"Information": 15
}
},
"ResetFilterIndication": {
"Format": "uint8",
"Permissions": [
Expand Down Expand Up @@ -1028,6 +1196,18 @@
"Vertical": 1
}
},
"SleepDiscoveryMode": {
"Format": "uint8",
"Permissions": [
"pr",
"ev"
],
"UUID": "000000E8-0000-1000-8000-0026BB765291",
"ValidValues": {
"NotDiscoverable": 0,
"AlwaysDiscoverable": 1
}
},
"SmokeDetected": {
"Format": "uint8",
"Permissions": [
Expand Down Expand Up @@ -1258,6 +1438,20 @@
"HumidifierorDehumidifier": 0
}
},
"TargetMediaState": {
"Format": "uint8",
"Permissions": [
"pr",
"pw",
"ev"
],
"UUID": "00000137-0000-1000-8000-0026BB765291",
"ValidValues": {
"Play": 0,
"Pause": 1,
"Stop": 2
}
},
"TargetPosition": {
"Format": "uint8",
"Permissions": [
Expand Down Expand Up @@ -1336,6 +1530,19 @@
"minValue": -90,
"unit": "arcdegrees"
},
"TargetVisibilityState":{
"Format": "uint8",
"Permissions": [
"pr",
"pw",
"ev"
],
"UUID": "00000134-0000-1000-8000-0026BB765291",
"ValidValues": {
"Shown": 0,
"Hidden": 1
}
},
"TemperatureDisplayUnits": {
"Format": "uint8",
"Permissions": [
Expand Down Expand Up @@ -1396,6 +1603,31 @@
"minValue": 0,
"unit": "percentage"
},
"VolumeControlType": {
"Format": "uint8",
"Permissions": [
"pr",
"ev"
],
"UUID": "000000E9-0000-1000-8000-0026BB765291",
"ValidValues": {
"None": 0,
"Relative": 1,
"RelativeWithCurrent": 2,
"Absolute": 3
}
},
"VolumeSelector": {
"Format": "uint8",
"Permissions": [
"pw"
],
"UUID": "000000EA-0000-1000-8000-0026BB765291",
"ValidValues": {
"Increment": 0,
"Decrement": 1
}
},
"WaterLevel": {
"Format": "float",
"Permissions": [
Expand Down
Loading

0 comments on commit 291f175

Please sign in to comment.