Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove cover support from inverse for now #358

Merged
merged 1 commit into from
Sep 21, 2023
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
36 changes: 3 additions & 33 deletions custom_components/spook/integrations/spook_inverse/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,33 +18,18 @@
entity_selector_without_own_entities,
)

from .const import (
CONF_HIDE_SOURCE,
CONF_INVERSE_POSTITION,
CONF_INVERSE_TILT,
DOMAIN,
PLATFORMS,
)
from .const import CONF_HIDE_SOURCE, DOMAIN, PLATFORMS

if TYPE_CHECKING:
from collections.abc import Callable, Coroutine, Mapping


EXTENDED_COVER_SCHEMA = {
vol.Required(
CONF_INVERSE_POSTITION,
default=True,
): selector.BooleanSelector(),
vol.Required(CONF_INVERSE_TILT, default=False): selector.BooleanSelector(),
}


async def options_schema(
domain: str | list[str],
handler: SchemaCommonFlowHandler,
) -> vol.Schema:
"""Generate options schema."""
schema = vol.Schema(
return vol.Schema(
{
vol.Required(CONF_ENTITY_ID): entity_selector_without_own_entities(
cast(SchemaOptionsFlowHandler, handler.parent_handler),
Expand All @@ -54,15 +39,10 @@ async def options_schema(
},
)

if domain == Platform.COVER:
schema = schema.extend(EXTENDED_COVER_SCHEMA)

return schema


def config_schema(domain: str | list[str]) -> vol.Schema:
"""Generate config schema."""
schema = vol.Schema(
return vol.Schema(
{
vol.Required(CONF_NAME): selector.TextSelector(),
vol.Required(CONF_ENTITY_ID): selector.EntitySelector(
Expand All @@ -72,11 +52,6 @@ def config_schema(domain: str | list[str]) -> vol.Schema:
},
)

if domain == Platform.COVER:
schema = schema.extend(EXTENDED_COVER_SCHEMA)

return schema


async def choose_options_step(options: dict[str, Any]) -> str:
"""Return next step_id for options flow according to inverse_type."""
Expand Down Expand Up @@ -107,10 +82,6 @@ async def _set_inverse_type(
config_schema(Platform.BINARY_SENSOR),
validate_user_input=set_inverse_type(Platform.BINARY_SENSOR),
),
Platform.COVER: SchemaFlowFormStep(
config_schema(Platform.COVER),
validate_user_input=set_inverse_type(Platform.COVER),
),
Platform.SWITCH: SchemaFlowFormStep(
config_schema(Platform.SWITCH),
validate_user_input=set_inverse_type(Platform.SWITCH),
Expand All @@ -123,7 +94,6 @@ async def _set_inverse_type(
Platform.BINARY_SENSOR: SchemaFlowFormStep(
partial(options_schema, Platform.BINARY_SENSOR),
),
Platform.COVER: SchemaFlowFormStep(partial(options_schema, Platform.COVER)),
Platform.SWITCH: SchemaFlowFormStep(partial(options_schema, Platform.SWITCH)),
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
DOMAIN = "spook_inverse"
PLATFORMS = [
Platform.BINARY_SENSOR,
Platform.COVER,
Platform.SWITCH,
]

Expand Down
245 changes: 0 additions & 245 deletions custom_components/spook/integrations/spook_inverse/cover.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,6 @@
},
"title": "Inverse 👻"
},
"cover": {
"data": {
"entity_id": "Source entity",
"hide_source": "Hide source entity",
"inverse_position": "Inverse position",
"inverse_tilt": "Inverse tilt postition",
"name": "Name"
},
"title": "Inverse 👻"
},
"switch": {
"data": {
"entity_id": "Source entity",
Expand All @@ -28,10 +18,9 @@
"title": "Inverse 👻"
},
"user": {
"description": "This helper allow you to inverse the behavior of an entity. For example, reverse the open/close or on/off of binary sensors, covers, and switches.",
"description": "This helper allow you to inverse the behavior of an entity. For example, reverse the open/close or on/off of binary sensors, and switches.",
"menu_options": {
"binary_sensor": "Inverse a binary sensor",
"cover": "Inverse a cover",
"switch": "Inverse a switch"
},
"title": "Inverse 👻"
Expand All @@ -48,16 +37,6 @@
},
"title": "Inverse 👻"
},
"cover": {
"data": {
"entity_id": "Source entity",
"hide_source": "Hide source entity",
"inverse_position": "Inverse position",
"inverse_tilt": "Inverse tilt postition",
"name": "Name"
},
"title": "Inverse 👻"
},
"switch": {
"data": {
"entity_id": "Source entity",
Expand Down
Loading