Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pyhap/resources/characteristics.json
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@
"Format": "string",
"Permissions": [
"pr",
"pw",
"ev"
],
"UUID": "000000E3-0000-1000-8000-0026BB765291"
Expand Down Expand Up @@ -737,6 +738,7 @@
"Format": "tlv8",
"Permissions": [
"pr",
"pw",
"ev"
],
"UUID": "00000136-0000-1000-8000-0026BB765291"
Expand Down Expand Up @@ -983,6 +985,7 @@
"Format": "uint8",
"Permissions": [
"pr",
"pw",
"ev"
],
"UUID": "000000D6-0000-1000-8000-0026BB765291",
Expand Down
37 changes: 35 additions & 2 deletions scripts/hap_manual_overrides.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
" - CurrentTemperature minValue -270 (spec minimum; the metadata says 0,",
" which makes HAP-python clamp negative readings to 0);",
" - LockLastKnownAction values 9/10 from the newer HAP spec.",
"Deliberately NOT mirrored from HAP-NodeJS: write perm on",
"ConfiguredName/IsConfigured/DisplayOrder (HAP-python never had it),",
" - write permission on ConfiguredName/IsConfigured/DisplayOrder (the",
" metadata has them read-only; HAP-NodeJS and the HAP-python releases",
" up to 5.2.0 have them writable, and write permissions are enforced).",
"Deliberately NOT mirrored from HAP-NodeJS:",
"read-only PairingFeatures (kept writable for compatibility), and",
"SiriInputType maxValue 0 (kept at the metadata value 1)."
],
Expand Down Expand Up @@ -317,6 +319,15 @@
],
"UUID": "0000021D-0000-1000-8000-0026BB765291"
},
"ConfiguredName": {
"Format": "string",
"Permissions": [
"pr",
"pw",
"ev"
],
"UUID": "000000E3-0000-1000-8000-0026BB765291"
},
"CurrentTemperature": {
"Format": "float",
"Permissions": [
Expand All @@ -338,6 +349,15 @@
],
"UUID": "00000138-0000-1000-8000-0026BB765291"
},
"DisplayOrder": {
"Format": "tlv8",
"Permissions": [
"pr",
"pw",
"ev"
],
"UUID": "00000136-0000-1000-8000-0026BB765291"
},
"EventSnapshotsActive": {
"Format": "uint8",
"Permissions": [
Expand Down Expand Up @@ -366,6 +386,19 @@
"Enable": 1
}
},
"IsConfigured": {
"Format": "uint8",
"Permissions": [
"pr",
"pw",
"ev"
],
"UUID": "000000D6-0000-1000-8000-0026BB765291",
"ValidValues": {
"Configured": 1,
"NotConfigured": 0
}
},
"LockLastKnownAction": {
"Format": "uint8",
"Permissions": [
Expand Down
23 changes: 23 additions & 0 deletions tests/test_accessory_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,29 @@ def test_write_with_write_permission(
assert char.value == 5


def test_write_configured_name(driver: AccessoryDriver) -> None:
"""A controller's write to the configured name of an input is applied."""
acc = Accessory(driver, "Television")
char = acc.add_preload_service("InputSource").get_characteristic("ConfiguredName")
driver.add_accessory(acc)

result = driver.set_characteristics(
{
HAP_REPR_CHARS: [
{
HAP_REPR_AID: acc.aid,
HAP_REPR_IID: acc.iid_manager.get_iid(char),
HAP_REPR_VALUE: "HDMI 2",
}
]
},
("1.2.3.4", 5),
)

assert result is None
assert char.value == "HDMI 2"


def test_write_with_subscribe_without_write_permission(
driver: AccessoryDriver,
) -> None:
Expand Down
13 changes: 13 additions & 0 deletions tests/test_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,19 @@ def test_loader_get_char_error() -> None:
loader.get_char("Char")


@pytest.mark.parametrize("name", ["ConfiguredName", "DisplayOrder", "IsConfigured"])
def test_loader_chars_a_controller_configures(name: str) -> None:
"""Test a controller may write them, though Apple's metadata says read-only.

The releases up to 5.2.0 had them writable.
"""
assert set(Loader().get_char(name).properties[PROP_PERMISSIONS]) == {
"pr",
"pw",
"ev",
}


def test_loader_service() -> None:
"""Test if method returns a Service object."""
loader = Loader()
Expand Down
Loading