Fix movement weight test

This commit is contained in:
Nicolas Mowen 2024-02-28 15:10:12 -07:00
parent 5b15a75145
commit 8921255da3
2 changed files with 8 additions and 8 deletions

View File

@ -189,7 +189,7 @@ class PtzAutotrackConfig(FrigateBaseModel):
timeout: int = Field(
default=10, title="Seconds to delay before returning to preset."
)
movement_weights: Optional[Union[str, List[float]]] = Field(
movement_weights: Optional[Union[str, List[str]]] = Field(
default=[],
title="Internal value used for PTZ movements based on the speed of your camera's motor.",
)
@ -204,9 +204,9 @@ class PtzAutotrackConfig(FrigateBaseModel):
return None
if isinstance(v, str):
weights = list(map(float, v.split(",")))
weights = list(map(str, map(float, v.split(","))))
elif isinstance(v, list):
weights = [float(val) for val in v]
weights = [str(val) for val in v]
else:
raise ValueError("Invalid type for movement_weights")

View File

@ -1535,11 +1535,11 @@ class TestConfig(unittest.TestCase):
runtime_config = frigate_config.runtime_config()
assert runtime_config.cameras["back"].onvif.autotracking.movement_weights == [
0.0,
1.0,
1.23,
2.34,
0.5,
"0.0",
"1.0",
"1.23",
"2.34",
"0.5",
]
def test_fails_invalid_movement_weights(self):