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
27 changes: 19 additions & 8 deletions homeassistant/components/cover/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,12 @@ async def async_setup(hass, config):

await component.async_setup(config)

component.async_register_entity_service(SERVICE_OPEN_COVER, {}, "async_open_cover")
component.async_register_entity_service(
SERVICE_OPEN_COVER, {}, "async_open_cover", [SUPPORT_OPEN]
)

component.async_register_entity_service(
SERVICE_CLOSE_COVER, {}, "async_close_cover"
SERVICE_CLOSE_COVER, {}, "async_close_cover", [SUPPORT_CLOSE]
)

component.async_register_entity_service(
Expand All @@ -108,22 +110,27 @@ async def async_setup(hass, config):
)
},
"async_set_cover_position",
[SUPPORT_SET_POSITION],
)

component.async_register_entity_service(SERVICE_STOP_COVER, {}, "async_stop_cover")
component.async_register_entity_service(
SERVICE_STOP_COVER, {}, "async_stop_cover", [SUPPORT_STOP]
)

component.async_register_entity_service(SERVICE_TOGGLE, {}, "async_toggle")
component.async_register_entity_service(
SERVICE_TOGGLE, {}, "async_toggle", [SUPPORT_OPEN | SUPPORT_CLOSE]
)

component.async_register_entity_service(
SERVICE_OPEN_COVER_TILT, {}, "async_open_cover_tilt"
SERVICE_OPEN_COVER_TILT, {}, "async_open_cover_tilt", [SUPPORT_OPEN_TILT]
)

component.async_register_entity_service(
SERVICE_CLOSE_COVER_TILT, {}, "async_close_cover_tilt"
SERVICE_CLOSE_COVER_TILT, {}, "async_close_cover_tilt", [SUPPORT_CLOSE_TILT]
)

component.async_register_entity_service(
SERVICE_STOP_COVER_TILT, {}, "async_stop_cover_tilt"
SERVICE_STOP_COVER_TILT, {}, "async_stop_cover_tilt", [SUPPORT_STOP_TILT]
)

component.async_register_entity_service(
Expand All @@ -134,10 +141,14 @@ async def async_setup(hass, config):
)
},
"async_set_cover_tilt_position",
[SUPPORT_SET_TILT_POSITION],
)

component.async_register_entity_service(
SERVICE_TOGGLE_COVER_TILT, {}, "async_toggle_tilt"
SERVICE_TOGGLE_COVER_TILT,
{},
"async_toggle_tilt",
[SUPPORT_OPEN_TILT | SUPPORT_CLOSE_TILT],
)

return True
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/template/cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def supported_features(self):
if self._position_script is not None:
supported_features |= SUPPORT_SET_POSITION

if self.current_cover_tilt_position is not None:
if self._tilt_script is not None:
supported_features |= TILT_FEATURES

return supported_features
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/helpers/entity_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def async_register_entity_service(
name: str,
schema: Union[Dict[str, Any], vol.Schema],
func: str,
required_features: Optional[int] = None,
required_features: Optional[List[int]] = None,
) -> None:
"""Register an entity service."""
if isinstance(schema, dict):
Expand Down
4 changes: 2 additions & 2 deletions tests/components/template/test_cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
ENTITY_COVER = "cover.test_template_cover"


@pytest.fixture
def calls(hass):
@pytest.fixture(name="calls")
def calls_fixture(hass):
"""Track calls to a mock service."""
return async_mock_service(hass, "test", "automation")

Expand Down