Add support for doorbell buttons to homekit_controller (#50983)
parent
29205a9239
commit
e1b6385b4d
|
@ -16,6 +16,7 @@ from homeassistant.helpers.typing import ConfigType
|
|||
from .const import DOMAIN, KNOWN_DEVICES, TRIGGERS
|
||||
|
||||
TRIGGER_TYPES = {
|
||||
"doorbell",
|
||||
"button1",
|
||||
"button2",
|
||||
"button3",
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
"""
|
||||
Regression tests for Netamo Doorbell.
|
||||
|
||||
https://github.com/home-assistant/core/issues/44596
|
||||
"""
|
||||
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
|
||||
from tests.common import assert_lists_same, async_get_device_automations
|
||||
from tests.components.homekit_controller.common import (
|
||||
Helper,
|
||||
setup_accessories_from_file,
|
||||
setup_test_accessories,
|
||||
)
|
||||
|
||||
|
||||
async def test_netamo_doorbell_setup(hass):
|
||||
"""Test that a Netamo Doorbell can be correctly setup in HA."""
|
||||
accessories = await setup_accessories_from_file(hass, "netamo_doorbell.json")
|
||||
config_entry, pairing = await setup_test_accessories(hass, accessories)
|
||||
|
||||
entity_registry = er.async_get(hass)
|
||||
|
||||
# Check that the camera is correctly found and set up
|
||||
doorbell_id = "camera.netatmo_doorbell_g738658"
|
||||
doorbell = entity_registry.async_get(doorbell_id)
|
||||
assert doorbell.unique_id == "homekit-g738658-aid:1"
|
||||
|
||||
camera_helper = Helper(
|
||||
hass,
|
||||
"camera.netatmo_doorbell_g738658",
|
||||
pairing,
|
||||
accessories[0],
|
||||
config_entry,
|
||||
)
|
||||
camera_helper = await camera_helper.poll_and_get_state()
|
||||
assert camera_helper.attributes["friendly_name"] == "Netatmo-Doorbell-g738658"
|
||||
|
||||
device_registry = dr.async_get(hass)
|
||||
|
||||
device = device_registry.async_get(doorbell.device_id)
|
||||
assert device.manufacturer == "Netatmo"
|
||||
assert device.name == "Netatmo-Doorbell-g738658"
|
||||
assert device.model == "Netatmo Doorbell"
|
||||
assert device.sw_version == "80.0.0"
|
||||
assert device.via_device_id is None
|
||||
|
||||
# The fixture file has 1 button
|
||||
expected = []
|
||||
for subtype in ("single_press", "double_press", "long_press"):
|
||||
expected.append(
|
||||
{
|
||||
"device_id": doorbell.device_id,
|
||||
"domain": "homekit_controller",
|
||||
"platform": "device",
|
||||
"type": "doorbell",
|
||||
"subtype": subtype,
|
||||
}
|
||||
)
|
||||
|
||||
for type in ("no_motion", "motion"):
|
||||
expected.append(
|
||||
{
|
||||
"device_id": doorbell.device_id,
|
||||
"domain": "binary_sensor",
|
||||
"entity_id": "binary_sensor.netatmo_doorbell_g738658",
|
||||
"platform": "device",
|
||||
"type": type,
|
||||
}
|
||||
)
|
||||
|
||||
triggers = await async_get_device_automations(hass, "trigger", doorbell.device_id)
|
||||
assert_lists_same(triggers, expected)
|
|
@ -0,0 +1,341 @@
|
|||
[
|
||||
{
|
||||
"aid" : 1,
|
||||
"services" : [
|
||||
{
|
||||
"hidden" : true,
|
||||
"iid" : 53,
|
||||
"characteristics" : [
|
||||
{
|
||||
"format" : "bool",
|
||||
"iid" : 54,
|
||||
"perms" : [
|
||||
"pw"
|
||||
],
|
||||
"type" : "4D05AE82-5A22-5BD6-A730-B7F8B4F3218D"
|
||||
},
|
||||
{
|
||||
"value" : "g738658",
|
||||
"format" : "string",
|
||||
"type" : "00F44C18-042E-5C4E-9A4C-561D44DCD804",
|
||||
"perms" : [
|
||||
"pr"
|
||||
],
|
||||
"iid" : 55
|
||||
}
|
||||
],
|
||||
"primary" : false,
|
||||
"type" : "EA22EA53-6227-55EA-AC24-73ACF3EEA0E8"
|
||||
},
|
||||
{
|
||||
"type" : "0000003E-0000-1000-8000-0026BB765291",
|
||||
"primary" : false,
|
||||
"iid" : 1,
|
||||
"characteristics" : [
|
||||
{
|
||||
"format" : "string",
|
||||
"value" : "Netatmo-Doorbell-g738658",
|
||||
"iid" : 2,
|
||||
"perms" : [
|
||||
"pr"
|
||||
],
|
||||
"type" : "00000023-0000-1000-8000-0026BB765291"
|
||||
},
|
||||
{
|
||||
"iid" : 3,
|
||||
"type" : "00000020-0000-1000-8000-0026BB765291",
|
||||
"perms" : [
|
||||
"pr"
|
||||
],
|
||||
"value" : "Netatmo",
|
||||
"format" : "string"
|
||||
},
|
||||
{
|
||||
"format" : "string",
|
||||
"value" : "Netatmo Doorbell",
|
||||
"perms" : [
|
||||
"pr"
|
||||
],
|
||||
"type" : "00000021-0000-1000-8000-0026BB765291",
|
||||
"iid" : 4
|
||||
},
|
||||
{
|
||||
"format" : "string",
|
||||
"value" : "g738658",
|
||||
"perms" : [
|
||||
"pr"
|
||||
],
|
||||
"type" : "00000030-0000-1000-8000-0026BB765291",
|
||||
"iid" : 5
|
||||
},
|
||||
{
|
||||
"iid" : 6,
|
||||
"perms" : [
|
||||
"pr"
|
||||
],
|
||||
"type" : "00000052-0000-1000-8000-0026BB765291",
|
||||
"format" : "string",
|
||||
"value" : "80.0.0"
|
||||
},
|
||||
{
|
||||
"type" : "00000014-0000-1000-8000-0026BB765291",
|
||||
"perms" : [
|
||||
"pw"
|
||||
],
|
||||
"iid" : 7,
|
||||
"format" : "bool"
|
||||
},
|
||||
{
|
||||
"value" : "+nvrOo7/HvM=",
|
||||
"format" : "data",
|
||||
"iid" : 56,
|
||||
"type" : "220",
|
||||
"perms" : [
|
||||
"pr"
|
||||
]
|
||||
}
|
||||
],
|
||||
"hidden" : false
|
||||
},
|
||||
{
|
||||
"hidden" : false,
|
||||
"iid" : 29,
|
||||
"characteristics" : [
|
||||
{
|
||||
"format" : "string",
|
||||
"value" : "1.1.0",
|
||||
"perms" : [
|
||||
"pr"
|
||||
],
|
||||
"type" : "00000037-0000-1000-8000-0026BB765291",
|
||||
"iid" : 30
|
||||
}
|
||||
],
|
||||
"type" : "000000A2-0000-1000-8000-0026BB765291",
|
||||
"primary" : false
|
||||
},
|
||||
{
|
||||
"type" : "00000121-0000-1000-8000-0026BB765291",
|
||||
"primary" : true,
|
||||
"characteristics" : [
|
||||
{
|
||||
"value" : null,
|
||||
"format" : "uint8",
|
||||
"type" : "00000073-0000-1000-8000-0026BB765291",
|
||||
"perms" : [
|
||||
"pr",
|
||||
"ev"
|
||||
],
|
||||
"iid" : 50
|
||||
},
|
||||
{
|
||||
"value" : "Doorbell",
|
||||
"format" : "string",
|
||||
"type" : "00000023-0000-1000-8000-0026BB765291",
|
||||
"perms" : [
|
||||
"pr"
|
||||
],
|
||||
"iid" : 57
|
||||
}
|
||||
],
|
||||
"iid" : 49,
|
||||
"hidden" : false
|
||||
},
|
||||
{
|
||||
"hidden" : false,
|
||||
"iid" : 51,
|
||||
"characteristics" : [
|
||||
{
|
||||
"value" : false,
|
||||
"format" : "bool",
|
||||
"type" : "0000011A-0000-1000-8000-0026BB765291",
|
||||
"perms" : [
|
||||
"pr",
|
||||
"pw",
|
||||
"ev"
|
||||
],
|
||||
"iid" : 52
|
||||
}
|
||||
],
|
||||
"type" : "00000113-0000-1000-8000-0026BB765291",
|
||||
"primary" : false
|
||||
},
|
||||
{
|
||||
"hidden" : false,
|
||||
"characteristics" : [
|
||||
{
|
||||
"value" : false,
|
||||
"format" : "bool",
|
||||
"iid" : 9,
|
||||
"type" : "0000011A-0000-1000-8000-0026BB765291",
|
||||
"perms" : [
|
||||
"pr",
|
||||
"pw",
|
||||
"ev"
|
||||
]
|
||||
}
|
||||
],
|
||||
"iid" : 8,
|
||||
"type" : "00000112-0000-1000-8000-0026BB765291",
|
||||
"primary" : false
|
||||
},
|
||||
{
|
||||
"hidden" : false,
|
||||
"iid" : 10,
|
||||
"characteristics" : [
|
||||
{
|
||||
"iid" : 11,
|
||||
"type" : "00000022-0000-1000-8000-0026BB765291",
|
||||
"perms" : [
|
||||
"pr",
|
||||
"ev"
|
||||
],
|
||||
"value" : false,
|
||||
"format" : "bool"
|
||||
},
|
||||
{
|
||||
"perms" : [
|
||||
"pr"
|
||||
],
|
||||
"type" : "00000023-0000-1000-8000-0026BB765291",
|
||||
"iid" : 12,
|
||||
"format" : "string",
|
||||
"value" : "Motion Sensor"
|
||||
}
|
||||
],
|
||||
"type" : "00000085-0000-1000-8000-0026BB765291",
|
||||
"primary" : false
|
||||
},
|
||||
{
|
||||
"primary" : false,
|
||||
"type" : "00000110-0000-1000-8000-0026BB765291",
|
||||
"characteristics" : [
|
||||
{
|
||||
"format" : "tlv8",
|
||||
"value" : "AQEA",
|
||||
"perms" : [
|
||||
"pr",
|
||||
"ev"
|
||||
],
|
||||
"type" : "00000120-0000-1000-8000-0026BB765291",
|
||||
"iid" : 14
|
||||
},
|
||||
{
|
||||
"iid" : 15,
|
||||
"type" : "00000114-0000-1000-8000-0026BB765291",
|
||||
"perms" : [
|
||||
"pr"
|
||||
],
|
||||
"value" : "AVUBAQACFgEBAQAAAQECAgEAAAACAQIDAQAEAQADCwECgAcCAjgEAwEeAAADCwECAAUCAtACAwEeAAADCwECgAICAmgBAwEeAAADCwECQAECAvAAAwEe",
|
||||
"format" : "tlv8"
|
||||
},
|
||||
{
|
||||
"iid" : 16,
|
||||
"type" : "00000115-0000-1000-8000-0026BB765291",
|
||||
"perms" : [
|
||||
"pr"
|
||||
],
|
||||
"value" : "ARMBAQMCDgEBAQIBAQAAAgEAAwEBAgEA",
|
||||
"format" : "tlv8"
|
||||
},
|
||||
{
|
||||
"value" : "AgECAAACAQAAAAIBAQ==",
|
||||
"format" : "tlv8",
|
||||
"type" : "00000116-0000-1000-8000-0026BB765291",
|
||||
"perms" : [
|
||||
"pr"
|
||||
],
|
||||
"iid" : 17
|
||||
},
|
||||
{
|
||||
"iid" : 19,
|
||||
"type" : "00000117-0000-1000-8000-0026BB765291",
|
||||
"perms" : [
|
||||
"pr",
|
||||
"pw"
|
||||
],
|
||||
"value" : "AQA=",
|
||||
"format" : "tlv8"
|
||||
},
|
||||
{
|
||||
"iid" : 18,
|
||||
"perms" : [
|
||||
"pr",
|
||||
"pw"
|
||||
],
|
||||
"type" : "00000118-0000-1000-8000-0026BB765291",
|
||||
"format" : "tlv8",
|
||||
"value" : "ARDpyds+onxNHb4xI0H6deS3AgEAAxgBAQACCzEwLjEwLjYwLjExAwJRwwQCUsMENQEBAQIgyWEU3zQuPNAsFAm1DM3ZSdp0Vh7kGuVQ+vqtS5Qa09YDDr5ebeow7eweCsu3FYh/BTUBAQECIFPPdRRI86ozZNB/WU/e8Em4N1lSsJhttOWoJly3XNEMAw7Zm8TgFdAof+wvoCQTYgYE/r0D9wcEC1Pwjg=="
|
||||
}
|
||||
],
|
||||
"iid" : 13,
|
||||
"hidden" : false
|
||||
},
|
||||
{
|
||||
"iid" : 20,
|
||||
"characteristics" : [
|
||||
{
|
||||
"iid" : 21,
|
||||
"type" : "00000120-0000-1000-8000-0026BB765291",
|
||||
"perms" : [
|
||||
"pr",
|
||||
"ev"
|
||||
],
|
||||
"value" : "AQEA",
|
||||
"format" : "tlv8"
|
||||
},
|
||||
{
|
||||
"format" : "tlv8",
|
||||
"value" : "AVUBAQACFgEBAQAAAQECAgEAAAACAQIDAQAEAQADCwECgAcCAjgEAwEeAAADCwECAAUCAtACAwEeAAADCwECgAICAmgBAwEeAAADCwECQAECAvAAAwEe",
|
||||
"perms" : [
|
||||
"pr"
|
||||
],
|
||||
"type" : "00000114-0000-1000-8000-0026BB765291",
|
||||
"iid" : 22
|
||||
},
|
||||
{
|
||||
"format" : "tlv8",
|
||||
"value" : "ARMBAQMCDgEBAQIBAQAAAgEAAwEBAgEA",
|
||||
"iid" : 23,
|
||||
"perms" : [
|
||||
"pr"
|
||||
],
|
||||
"type" : "00000115-0000-1000-8000-0026BB765291"
|
||||
},
|
||||
{
|
||||
"format" : "tlv8",
|
||||
"value" : "AgECAAACAQAAAAIBAQ==",
|
||||
"perms" : [
|
||||
"pr"
|
||||
],
|
||||
"type" : "00000116-0000-1000-8000-0026BB765291",
|
||||
"iid" : 24
|
||||
},
|
||||
{
|
||||
"format" : "tlv8",
|
||||
"value" : "AQA=",
|
||||
"perms" : [
|
||||
"pr",
|
||||
"pw"
|
||||
],
|
||||
"type" : "00000117-0000-1000-8000-0026BB765291",
|
||||
"iid" : 26
|
||||
},
|
||||
{
|
||||
"iid" : 25,
|
||||
"type" : "00000118-0000-1000-8000-0026BB765291",
|
||||
"perms" : [
|
||||
"pr",
|
||||
"pw"
|
||||
],
|
||||
"value" : "ARDu4+F49fZMSatQjcfR8FGVAgEAAxgBAQACCzEwLjEwLjYwLjExAwJbwwQCXMMENQEBAQIg9nqVm+80ccYh/S3vKKfbcUGH7VgggHRwp1e1x63+kpkDDnAxnJxfEz8KDp6xKoPhBTUBAQECILLYad+aKdzVbhGz55ywh0RYX9DTyY7HdSRf8y8tUi1kAw4DRngrGhYBdnrjELUzGgYEf+ysuwcESU05wg==",
|
||||
"format" : "tlv8"
|
||||
}
|
||||
],
|
||||
"primary" : false,
|
||||
"type" : "00000110-0000-1000-8000-0026BB765291",
|
||||
"hidden" : false
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
Loading…
Reference in New Issue