work: добавил автоматический режим
This commit is contained in:
+20
-5
@@ -208,16 +208,32 @@ def _parse_action(
|
||||
|
||||
if action_type == ScheduleActionType.AUTO:
|
||||
|
||||
extra = set(data) - {"type"}
|
||||
extra = set(data) - {
|
||||
"type",
|
||||
"speed",
|
||||
}
|
||||
|
||||
if extra:
|
||||
raise ValueError(
|
||||
"AUTO action cannot contain "
|
||||
f"SET fields: {sorted(extra)}"
|
||||
"AUTO action supports only "
|
||||
f"'speed': {sorted(extra)}"
|
||||
)
|
||||
|
||||
if "speed" not in data:
|
||||
raise ValueError(
|
||||
"AUTO action must contain "
|
||||
"fallback speed"
|
||||
)
|
||||
|
||||
settings = _parse_settings(
|
||||
{
|
||||
"speed": data["speed"],
|
||||
}
|
||||
)
|
||||
|
||||
return ScheduleAction(
|
||||
type=ScheduleActionType.AUTO
|
||||
type=ScheduleActionType.AUTO,
|
||||
settings=settings,
|
||||
)
|
||||
|
||||
settings_data = {
|
||||
@@ -233,7 +249,6 @@ def _parse_action(
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
def _parse_template(
|
||||
name: str,
|
||||
data: Any,
|
||||
|
||||
Reference in New Issue
Block a user