1515 "!=" : "Not Equal To" }
1616
1717
18- class CountConditionTestType (Enum ):
19- """Defines the way a count condition compares the actual value to the
20- alarm's test value.
21- """
22-
23- GREATER_THAN = ">"
24- LESS_THAN = "<"
25- EQUAL_TO = "="
26- NOT_EQUAL_TO = "!="
27-
28- @classmethod
29- def values (cls ):
30- return [v .value for v in cls ]
31-
32-
3318class IntersectionPointType (Enum ):
3419 """The point on a detection that must be inside a zone for the detection to
3520 count as being inside the zone. The most commonly used intersection point
@@ -54,7 +39,21 @@ class ZoneAlarmCountCondition(Codec):
5439 of objects in a zone to some number.
5540 """
5641
57- test : CountConditionTestType
42+ class TestType (Enum ):
43+ """Defines the way a count condition compares the actual value to the
44+ alarm's test value.
45+ """
46+
47+ GREATER_THAN = ">"
48+ LESS_THAN = "<"
49+ EQUAL_TO = "="
50+ NOT_EQUAL_TO = "!="
51+
52+ @classmethod
53+ def values (cls ):
54+ return [v .value for v in cls ]
55+
56+ test : TestType
5857 """The way that the check value will be compared to the actual count
5958 """
6059
@@ -109,7 +108,7 @@ def from_dict(d: dict):
109108 with_attribute = None
110109 if d ["with_attribute" ] is not None :
111110 with_attribute = Attribute .from_dict (d ["with_attribute" ])
112- test = CountConditionTestType (d ["test" ])
111+ test = ZoneAlarmCountCondition . TestType (d ["test" ])
113112
114113 return ZoneAlarmCountCondition (
115114 test = test ,
@@ -122,42 +121,40 @@ def from_dict(d: dict):
122121 id = d ["id" ])
123122
124123
125- class RateConditionTestType (Enum ):
126- """Defines the way a rate condition compares the actual rate value to the
127- alarm's test value.
124+ @dataclass
125+ class ZoneAlarmRateCondition (Codec ):
126+ """A condition that must be met for an alarm to go off. Compares the rate
127+ of change in the count of some object against a test value.
128128 """
129129
130- GREATER_THAN_OR_EQUAL_TO = ">="
131- LESS_THAN_OR_EQUAL_TO = "<="
130+ class TestType (Enum ):
131+ """Defines the way a rate condition compares the actual rate value to
132+ the alarm's test value.
133+ """
132134
133- @classmethod
134- def values (cls ):
135- return [v .value for v in cls ]
135+ GREATER_THAN_OR_EQUAL_TO = ">="
136+ LESS_THAN_OR_EQUAL_TO = "<="
136137
138+ @classmethod
139+ def values (cls ):
140+ return [v .value for v in cls ]
137141
138- class DirectionType (Enum ):
139- """Defines the direction of flow that a rate condition pertains to."""
140-
141- ENTERING = "entering"
142- EXITING = "exiting"
143- ENTERING_OR_EXITING = "entering_or_exiting"
144-
145- @classmethod
146- def values (cls ):
147- return [v .value for v in cls ]
142+ class DirectionType (Enum ):
143+ """Defines the direction of flow that a rate condition pertains to."""
148144
145+ ENTERING = "entering"
146+ EXITING = "exiting"
147+ ENTERING_OR_EXITING = "entering_or_exiting"
149148
150- @dataclass
151- class ZoneAlarmRateCondition (Codec ):
152- """A condition that must be met for an alarm to go off. Compares the rate
153- of change in the count of some object against a test value.
154- """
149+ @classmethod
150+ def values (cls ):
151+ return [v .value for v in cls ]
155152
156153 _direction_map = {DirectionType .ENTERING : "entered" ,
157154 DirectionType .EXITING : "exited" ,
158155 DirectionType .ENTERING_OR_EXITING : "entered or exited" }
159156
160- test : RateConditionTestType
157+ test : TestType
161158 """The way that the change value will be compared to the actual rate"""
162159
163160 duration : float
@@ -210,13 +207,13 @@ def from_dict(d: dict):
210207 with_attribute = None
211208 if d ["with_attribute" ] is not None :
212209 with_attribute = Attribute .from_dict (d ["with_attribute" ])
213- test = RateConditionTestType (d ["test" ])
210+ test = ZoneAlarmRateCondition . TestType (d ["test" ])
214211
215212 return ZoneAlarmRateCondition (
216213 test = test ,
217214 duration = d ["duration" ],
218215 change = d ["change" ],
219- direction = DirectionType (d ["direction" ]),
216+ direction = ZoneAlarmRateCondition . DirectionType (d ["direction" ]),
220217 with_class_name = d ["with_class_name" ],
221218 with_attribute = with_attribute ,
222219 intersection_point = intersection_point ,
0 commit comments