Skip to content

Commit 291f175

Browse files
authored
Merge pull request #188 from ikalchev/v2.5.0
Merge v2.5.0 into master
2 parents 5ac5b83 + 0d7aef6 commit 291f175

8 files changed

Lines changed: 414 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ Sections
1616
### Developers
1717
-->
1818

19+
## [2.5.0] - 2019-04-10
20+
21+
### Added
22+
- Added support for Television accessories.
23+
1924
## [2.4.2] - 2019-01-04
2025

2126
### Fixed

pyhap/accessory.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@ def add_preload_service(self, service, chars=None):
115115
self.add_service(service)
116116
return service
117117

118+
def set_primary_service(self, primary_service):
119+
"""Set the primary service of the acc."""
120+
for service in self.services:
121+
service.is_primary_service = service.type_id == \
122+
primary_service.type_id
123+
118124
def config_changed(self):
119125
"""Notify the accessory about configuration changes.
120126

pyhap/const.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""This module contains constants used by other modules."""
22
MAJOR_VERSION = 2
3-
MINOR_VERSION = 4
4-
PATCH_VERSION = 2
3+
MINOR_VERSION = 5
4+
PATCH_VERSION = 0
55
__short_version__ = '{}.{}'.format(MAJOR_VERSION, MINOR_VERSION)
66
__version__ = '{}.{}'.format(__short_version__, PATCH_VERSION)
77
REQUIRED_PYTHON_VER = (3, 5)
@@ -45,13 +45,16 @@
4545
CATEGORY_SPRINKLER = 28
4646
CATEGORY_FAUCET = 29
4747
CATEGORY_SHOWER_HEAD = 30
48+
CATEGORY_TELEVISION = 31
49+
CATEGORY_TARGET_CONTROLLER = 32 # Remote Controller
4850

4951

5052
# ### HAP Permissions ###
5153
HAP_PERMISSION_HIDDEN = 'hd'
5254
HAP_PERMISSION_NOTIFY = 'ev'
5355
HAP_PERMISSION_READ = 'pr'
5456
HAP_PERMISSION_WRITE = 'pw'
57+
HAP_PERMISSION_WRITE_RESPONSE = 'wr'
5558

5659

5760
# ### HAP representation ###
@@ -63,7 +66,9 @@
6366
HAP_REPR_IID = 'iid'
6467
HAP_REPR_MAX_LEN = 'maxLen'
6568
HAP_REPR_PERM = 'perms'
69+
HAP_REPR_PRIMARY = 'primary'
6670
HAP_REPR_SERVICES = 'services'
71+
HAP_REPR_LINKED = 'linked'
6772
HAP_REPR_STATUS = 'status'
6873
HAP_REPR_TYPE = 'type'
6974
HAP_REPR_VALUE = 'value'

pyhap/resources/characteristics.json

Lines changed: 232 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@
2323
"Inactive": 0
2424
}
2525
},
26+
"ActiveIdentifier": {
27+
"Format": "uint32",
28+
"Permissions": [
29+
"pr",
30+
"pw",
31+
"ev"
32+
],
33+
"UUID": "000000E7-0000-1000-8000-0026BB765291"
34+
},
2635
"AdministratorOnlyAccess": {
2736
"Format": "bool",
2837
"Permissions": [
@@ -182,6 +191,19 @@
182191
"NotCharging": 0
183192
}
184193
},
194+
"ClosedCaptions": {
195+
"Format": "uint8",
196+
"Permissions": [
197+
"pr",
198+
"pw",
199+
"ev"
200+
],
201+
"UUID": "000000DD-0000-1000-8000-0026BB765291",
202+
"ValidValues": {
203+
"Disabled": 0,
204+
"Enabled": 1
205+
}
206+
},
185207
"ColorTemperature": {
186208
"Format": "uint32",
187209
"Permissions": [
@@ -194,6 +216,15 @@
194216
"minStep": 1,
195217
"minValue": 140
196218
},
219+
"ConfiguredName": {
220+
"Format": "string",
221+
"Permissions": [
222+
"pr",
223+
"pw",
224+
"ev"
225+
],
226+
"UUID": "000000E3-0000-1000-8000-0026BB765291"
227+
},
197228
"ContactSensorState": {
198229
"Format": "uint8",
199230
"Permissions": [
@@ -324,6 +355,20 @@
324355
"Inactive": 0
325356
}
326357
},
358+
"CurrentMediaState": {
359+
"Format": "uint8",
360+
"Permissions": [
361+
"pr",
362+
"ev"
363+
],
364+
"UUID": "000000E0-0000-1000-8000-0026BB765291",
365+
"ValidValues": {
366+
"Play": 0,
367+
"Pause": 1,
368+
"Stop": 2,
369+
"Unknown": 3
370+
}
371+
},
327372
"CurrentPosition": {
328373
"Format": "uint8",
329374
"Permissions": [
@@ -397,6 +442,18 @@
397442
"minValue": -90,
398443
"unit": "arcdegrees"
399444
},
445+
"CurrentVisibilityState":{
446+
"Format": "uint8",
447+
"Permissions": [
448+
"pr",
449+
"ev"
450+
],
451+
"UUID": "00000135-0000-1000-8000-0026BB765291",
452+
"ValidValues": {
453+
"Shown": 0,
454+
"Hidden": 1
455+
}
456+
},
400457
"DigitalZoom": {
401458
"Format": "float",
402459
"Permissions": [
@@ -406,6 +463,15 @@
406463
],
407464
"UUID": "0000011D-0000-1000-8000-0026BB765291"
408465
},
466+
"DisplayOrder": {
467+
"Format": "tlv8",
468+
"Permissions": [
469+
"pr",
470+
"pw",
471+
"ev"
472+
],
473+
"UUID": "00000136-0000-1000-8000-0026BB765291"
474+
},
409475
"FilterChangeIndication": {
410476
"Format": "uint8",
411477
"Permissions": [
@@ -476,6 +542,15 @@
476542
"minValue": 0,
477543
"unit": "arcdegrees"
478544
},
545+
"Identifier": {
546+
"Format": "uint32",
547+
"Permissions": [
548+
"pr"
549+
],
550+
"UUID": "000000E6-0000-1000-8000-0026BB765291",
551+
"minStep": 1,
552+
"minValue": 0
553+
},
479554
"Identify": {
480555
"Format": "bool",
481556
"Permissions": [
@@ -505,6 +580,43 @@
505580
"minValue": 0,
506581
"unit": "arcdegrees"
507582
},
583+
"InputSourceType":{
584+
"Format": "uint8",
585+
"Permissions": [
586+
"pr",
587+
"ev"
588+
],
589+
"UUID": "000000DB-0000-1000-8000-0026BB765291",
590+
"ValidValues": {
591+
"Other": 0,
592+
"HomeScreen": 1,
593+
"Tuner": 2,
594+
"HDMI": 3,
595+
"CompositeVideo": 4,
596+
"SVideo": 5,
597+
"ComponentVideo": 6,
598+
"DVI": 7,
599+
"AirPlay": 8,
600+
"USB": 9,
601+
"Application": 10
602+
}
603+
},
604+
"InputDeviceType":{
605+
"Format": "uint8",
606+
"Permissions": [
607+
"pr",
608+
"ev"
609+
],
610+
"UUID": "000000DC-0000-1000-8000-0026BB765291",
611+
"ValidValues": {
612+
"Other": 0,
613+
"TV": 1,
614+
"Recording": 2,
615+
"Tuner": 3,
616+
"Playback": 4,
617+
"AudioSystem": 5
618+
}
619+
},
508620
"InUse": {
509621
"Format": "uint8",
510622
"Permissions": [
@@ -794,6 +906,27 @@
794906
],
795907
"UUID": "00000050-0000-1000-8000-0026BB765291"
796908
},
909+
"PictureMode":{
910+
"Format": "uint8",
911+
"Permissions": [
912+
"pr",
913+
"pw",
914+
"ev"
915+
],
916+
"UUID": "000000E2-0000-1000-8000-0026BB765291",
917+
"maxValue": 13,
918+
"minValue": 0,
919+
"ValidValues": {
920+
"Other": 0,
921+
"Standard": 1,
922+
"Calibrated": 2,
923+
"CalibratedDark": 3,
924+
"Vivid": 4,
925+
"Game": 5,
926+
"Computer": 6,
927+
"Custom": 7
928+
}
929+
},
797930
"PositionState": {
798931
"Format": "uint8",
799932
"Permissions": [
@@ -807,6 +940,17 @@
807940
"Stopped": 2
808941
}
809942
},
943+
"PowerModeSelection":{
944+
"Format": "uint8",
945+
"Permissions": [
946+
"pw"
947+
],
948+
"UUID": "000000DF-0000-1000-8000-0026BB765291",
949+
"ValidValues": {
950+
"Show": 0,
951+
"Hide": 1
952+
}
953+
},
810954
"ProgramMode": {
811955
"Format": "uint8",
812956
"Permissions": [
@@ -870,6 +1014,30 @@
8701014
"minStep": 1,
8711015
"minValue": 0
8721016
},
1017+
"RemoteKey":{
1018+
"Format": "uint8",
1019+
"Permissions": [
1020+
"pw"
1021+
],
1022+
"UUID": "000000E1-0000-1000-8000-0026BB765291",
1023+
"maxValue": 16,
1024+
"minValue": 0,
1025+
"ValidValues": {
1026+
"Rewind": 0,
1027+
"FastForward": 1,
1028+
"NextTrack": 2,
1029+
"PreviousTrack": 3,
1030+
"ArrowUp": 4,
1031+
"ArrowDown": 5,
1032+
"ArrowLeft": 6,
1033+
"ArrowRight": 7,
1034+
"Select": 8,
1035+
"Back": 9,
1036+
"Exit": 10,
1037+
"PlayPause": 11,
1038+
"Information": 15
1039+
}
1040+
},
8731041
"ResetFilterIndication": {
8741042
"Format": "uint8",
8751043
"Permissions": [
@@ -1028,6 +1196,18 @@
10281196
"Vertical": 1
10291197
}
10301198
},
1199+
"SleepDiscoveryMode": {
1200+
"Format": "uint8",
1201+
"Permissions": [
1202+
"pr",
1203+
"ev"
1204+
],
1205+
"UUID": "000000E8-0000-1000-8000-0026BB765291",
1206+
"ValidValues": {
1207+
"NotDiscoverable": 0,
1208+
"AlwaysDiscoverable": 1
1209+
}
1210+
},
10311211
"SmokeDetected": {
10321212
"Format": "uint8",
10331213
"Permissions": [
@@ -1258,6 +1438,20 @@
12581438
"HumidifierorDehumidifier": 0
12591439
}
12601440
},
1441+
"TargetMediaState": {
1442+
"Format": "uint8",
1443+
"Permissions": [
1444+
"pr",
1445+
"pw",
1446+
"ev"
1447+
],
1448+
"UUID": "00000137-0000-1000-8000-0026BB765291",
1449+
"ValidValues": {
1450+
"Play": 0,
1451+
"Pause": 1,
1452+
"Stop": 2
1453+
}
1454+
},
12611455
"TargetPosition": {
12621456
"Format": "uint8",
12631457
"Permissions": [
@@ -1336,6 +1530,19 @@
13361530
"minValue": -90,
13371531
"unit": "arcdegrees"
13381532
},
1533+
"TargetVisibilityState":{
1534+
"Format": "uint8",
1535+
"Permissions": [
1536+
"pr",
1537+
"pw",
1538+
"ev"
1539+
],
1540+
"UUID": "00000134-0000-1000-8000-0026BB765291",
1541+
"ValidValues": {
1542+
"Shown": 0,
1543+
"Hidden": 1
1544+
}
1545+
},
13391546
"TemperatureDisplayUnits": {
13401547
"Format": "uint8",
13411548
"Permissions": [
@@ -1396,6 +1603,31 @@
13961603
"minValue": 0,
13971604
"unit": "percentage"
13981605
},
1606+
"VolumeControlType": {
1607+
"Format": "uint8",
1608+
"Permissions": [
1609+
"pr",
1610+
"ev"
1611+
],
1612+
"UUID": "000000E9-0000-1000-8000-0026BB765291",
1613+
"ValidValues": {
1614+
"None": 0,
1615+
"Relative": 1,
1616+
"RelativeWithCurrent": 2,
1617+
"Absolute": 3
1618+
}
1619+
},
1620+
"VolumeSelector": {
1621+
"Format": "uint8",
1622+
"Permissions": [
1623+
"pw"
1624+
],
1625+
"UUID": "000000EA-0000-1000-8000-0026BB765291",
1626+
"ValidValues": {
1627+
"Increment": 0,
1628+
"Decrement": 1
1629+
}
1630+
},
13991631
"WaterLevel": {
14001632
"Format": "float",
14011633
"Permissions": [

0 commit comments

Comments
 (0)