mirror of
https://github.com/home-assistant/core.git
synced 2026-09-25 17:04:04 -04:00
Normalize Overkiz RTS tilt command arguments (#174297)
This commit is contained in:
@@ -34,6 +34,9 @@ from .entity import OverkizDescriptiveEntity
|
||||
_POSITION_MY = 108 # "My position" preset
|
||||
_POSITION_UNKNOWN = 124 # "Unknown position" preset
|
||||
|
||||
# Default tilt step size (in degrees) used for RTS tilt commands
|
||||
_TILT_STEP_SIZE = 5
|
||||
|
||||
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class OverkizCoverDescription(CoverEntityDescription):
|
||||
@@ -113,11 +116,11 @@ COVER_DESCRIPTIONS: list[OverkizCoverDescription] = [
|
||||
open_command=OverkizCommand.OPEN,
|
||||
close_command=OverkizCommand.CLOSE,
|
||||
stop_command=OverkizCommand.STOP,
|
||||
# Tilt commands move the tilt with a few degrees
|
||||
# position (1-127), execution duration (0-15, optional)
|
||||
open_tilt_command=OverkizCommand.TILT_POSITIVE,
|
||||
open_tilt_command_args=(1, 0),
|
||||
open_tilt_command_args=(_TILT_STEP_SIZE, 0),
|
||||
close_tilt_command=OverkizCommand.TILT_NEGATIVE,
|
||||
close_tilt_command_args=(1, 0),
|
||||
close_tilt_command_args=(_TILT_STEP_SIZE, 0),
|
||||
stop_tilt_command=OverkizCommand.STOP,
|
||||
),
|
||||
# Needs override to support very specific tilt commands
|
||||
@@ -129,10 +132,11 @@ COVER_DESCRIPTIONS: list[OverkizCoverDescription] = [
|
||||
open_command=OverkizCommand.OPEN,
|
||||
close_command=OverkizCommand.CLOSE,
|
||||
stop_command=OverkizCommand.STOP,
|
||||
# position (1-127), execution duration (0-15, optional)
|
||||
open_tilt_command=OverkizCommand.TILT_POSITIVE,
|
||||
open_tilt_command_args=(15, 1), # position (1-127), speed (1-15)
|
||||
open_tilt_command_args=(_TILT_STEP_SIZE, 0),
|
||||
close_tilt_command=OverkizCommand.TILT_NEGATIVE,
|
||||
close_tilt_command_args=(15, 1), # position (1-127), speed (1-15)
|
||||
close_tilt_command_args=(_TILT_STEP_SIZE, 0),
|
||||
stop_tilt_command=OverkizCommand.STOP,
|
||||
),
|
||||
# Needs override to support very specific tilt commands
|
||||
@@ -144,10 +148,11 @@ COVER_DESCRIPTIONS: list[OverkizCoverDescription] = [
|
||||
open_command=OverkizCommand.OPEN,
|
||||
close_command=OverkizCommand.CLOSE,
|
||||
stop_command=OverkizCommand.STOP,
|
||||
# position (1-127), execution duration (0-15, optional)
|
||||
open_tilt_command=OverkizCommand.TILT_POSITIVE,
|
||||
open_tilt_command_args=(15, 1), # position (1-127), speed (1-15)
|
||||
open_tilt_command_args=(_TILT_STEP_SIZE, 0),
|
||||
close_tilt_command=OverkizCommand.TILT_NEGATIVE,
|
||||
close_tilt_command_args=(15, 1), # position (1-127), speed (1-15)
|
||||
close_tilt_command_args=(_TILT_STEP_SIZE, 0),
|
||||
stop_tilt_command=OverkizCommand.STOP,
|
||||
),
|
||||
# Needs override to support very specific tilt commands (rts:SheerBlindRTSComponent)
|
||||
@@ -158,10 +163,11 @@ COVER_DESCRIPTIONS: list[OverkizCoverDescription] = [
|
||||
open_command=OverkizCommand.OPEN,
|
||||
close_command=OverkizCommand.CLOSE,
|
||||
stop_command=OverkizCommand.STOP,
|
||||
# position (1-127), execution duration (0-15, optional)
|
||||
open_tilt_command=OverkizCommand.TILT_POSITIVE,
|
||||
open_tilt_command_args=(15, 1), # position (1-127), speed (1-15)
|
||||
open_tilt_command_args=(_TILT_STEP_SIZE, 0),
|
||||
close_tilt_command=OverkizCommand.TILT_NEGATIVE,
|
||||
close_tilt_command_args=(15, 1), # position (1-127), speed (1-15)
|
||||
close_tilt_command_args=(_TILT_STEP_SIZE, 0),
|
||||
stop_tilt_command=OverkizCommand.STOP,
|
||||
),
|
||||
# Needs override since BioclimaticPergola uses core:SlatsOpenClosedState
|
||||
|
||||
@@ -364,14 +364,14 @@ async def test_cover_entities_snapshot(
|
||||
TILT_ONLY_VENETIAN_BLIND,
|
||||
SERVICE_OPEN_COVER_TILT,
|
||||
"tiltPositive",
|
||||
[1, 0],
|
||||
[5, 0],
|
||||
CoverState.OPENING,
|
||||
),
|
||||
(
|
||||
TILT_ONLY_VENETIAN_BLIND,
|
||||
SERVICE_CLOSE_COVER_TILT,
|
||||
"tiltNegative",
|
||||
[1, 0],
|
||||
[5, 0],
|
||||
CoverState.CLOSING,
|
||||
),
|
||||
(
|
||||
@@ -387,14 +387,14 @@ async def test_cover_entities_snapshot(
|
||||
UP_DOWN_VENETIAN_BLIND,
|
||||
SERVICE_OPEN_COVER_TILT,
|
||||
"tiltPositive",
|
||||
[15, 1],
|
||||
[5, 0],
|
||||
CoverState.OPENING,
|
||||
),
|
||||
(
|
||||
UP_DOWN_VENETIAN_BLIND,
|
||||
SERVICE_CLOSE_COVER_TILT,
|
||||
"tiltNegative",
|
||||
[15, 1],
|
||||
[5, 0],
|
||||
CoverState.CLOSING,
|
||||
),
|
||||
(
|
||||
@@ -408,14 +408,14 @@ async def test_cover_entities_snapshot(
|
||||
UP_DOWN_SHEER_SCREEN,
|
||||
SERVICE_OPEN_COVER_TILT,
|
||||
"tiltPositive",
|
||||
[15, 1],
|
||||
[5, 0],
|
||||
CoverState.OPENING,
|
||||
),
|
||||
(
|
||||
UP_DOWN_SHEER_SCREEN,
|
||||
SERVICE_CLOSE_COVER_TILT,
|
||||
"tiltNegative",
|
||||
[15, 1],
|
||||
[5, 0],
|
||||
CoverState.CLOSING,
|
||||
),
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user