Skip to content
Merged
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
2 changes: 1 addition & 1 deletion homeassistant/components/homekit/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"mode": "[%key:common::config_flow::data::mode%]",
"entities": "Entities"
},
"description": "Choose the entities to be included. In accessory mode, only a single entity is included. In bridge include mode, all entities in the domain will be included unless specific entities are selected. In bridge exclude mode, all entities in the domain will be included except for the excluded entities. For best performance, a separate HomeKit accessory will be created for each tv media player and camera.",
"description": "Choose the entities to be included. In accessory mode, only a single entity is included. In bridge include mode, all entities in the domain will be included unless specific entities are selected. In bridge exclude mode, all entities in the domain will be included except for the excluded entities. For best performance, a separate HomeKit accessory will be created for each tv media player, activity based remote, lock, and camera.",
"title": "Select entities to be included"
},
"cameras": {
Expand Down
23 changes: 3 additions & 20 deletions homeassistant/components/homekit/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,13 @@
"port_name_in_use": "An accessory or bridge with the same name or port is already configured."
},
"step": {
"accessory_mode": {
"data": {
"entity_id": "Entity"
},
"description": "Choose the entity to be included. In accessory mode, only a single entity is included.",
"title": "Select entity to be included"
},
"bridge_mode": {
"data": {
"include_domains": "Domains to include"
},
"description": "Choose the domains to be included. All supported entities in the domain will be included.",
"title": "Select domains to be included"
},
"pairing": {
"description": "To complete pairing following the instructions in \u201cNotifications\u201d under \u201cHomeKit Pairing\u201d.",
"title": "Pair HomeKit"
},
"user": {
"data": {
"auto_start": "Autostart (disable if using Z-Wave or other delayed start system)",
"include_domains": "Domains to include",
"mode": "Mode"
"include_domains": "Domains to include"
},
"description": "Choose the domains to be included. All supported entities in the domain will be included. A separate HomeKit instance in accessory mode will be created for each tv media player and camera.",
"title": "Select domains to be included"
Expand All @@ -37,8 +21,7 @@
"step": {
"advanced": {
"data": {
"auto_start": "Autostart (disable if you are calling the homekit.start service manually)",
"safe_mode": "Safe Mode (enable only if pairing fails)"
"auto_start": "Autostart (disable if you are calling the homekit.start service manually)"
},
"description": "These settings only need to be adjusted if HomeKit is not functional.",
"title": "Advanced Configuration"
Expand All @@ -55,7 +38,7 @@
"entities": "Entities",
"mode": "Mode"
},
"description": "Choose the entities to be included. In accessory mode, only a single entity is included. In bridge include mode, all entities in the domain will be included unless specific entities are selected. In bridge exclude mode, all entities in the domain will be included except for the excluded entities. For best performance, a separate HomeKit accessory will be created for each tv media player and camera.",
"description": "Choose the entities to be included. In accessory mode, only a single entity is included. In bridge include mode, all entities in the domain will be included unless specific entities are selected. In bridge exclude mode, all entities in the domain will be included except for the excluded entities. For best performance, a separate HomeKit accessory will be created for each tv media player, activity based remote, lock, and camera.",
"title": "Select entities to be included"
},
"init": {
Expand Down
4 changes: 3 additions & 1 deletion homeassistant/components/homekit/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

from homeassistant.components import binary_sensor, media_player, sensor
from homeassistant.components.camera import DOMAIN as CAMERA_DOMAIN
from homeassistant.components.lock import DOMAIN as LOCK_DOMAIN
from homeassistant.components.media_player import (
DEVICE_CLASS_TV,
DOMAIN as MEDIA_PLAYER_DOMAIN,
Expand Down Expand Up @@ -502,7 +503,8 @@ def state_needs_accessory_mode(state):
return True

return (
state.domain == MEDIA_PLAYER_DOMAIN
state.domain == LOCK_DOMAIN
or state.domain == MEDIA_PLAYER_DOMAIN
and state.attributes.get(ATTR_DEVICE_CLASS) == DEVICE_CLASS_TV
or state.domain == REMOTE_DOMAIN
and state.attributes.get(ATTR_SUPPORTED_FEATURES) & SUPPORT_ACTIVITY
Expand Down
7 changes: 7 additions & 0 deletions tests/components/homekit/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
format_sw_version,
port_is_available,
show_setup_message,
state_needs_accessory_mode,
temperature_to_homekit,
temperature_to_states,
validate_entity_config as vec,
Expand Down Expand Up @@ -298,3 +299,9 @@ async def test_accessory_friendly_name():
assert accessory_friendly_name("hass title", accessory) == "hass title (same)"
accessory.display_name = "Hass title 123"
assert accessory_friendly_name("hass title", accessory) == "Hass title 123"


async def test_lock_state_needs_accessory_mode(hass):
"""Test that locks are setup as accessories."""
hass.states.async_set("lock.mine", "locked")
assert state_needs_accessory_mode(hass.states.get("lock.mine")) is True