openadr3-client-gac-compliance 1.2.1__tar.gz → 1.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: openadr3-client-gac-compliance
3
- Version: 1.2.1
3
+ Version: 1.4.0
4
4
  Summary:
5
5
  Author: Nick van der Burgt
6
6
  Author-email: nick.van.der.burgt@elaad.nl
@@ -8,7 +8,7 @@ Requires-Python: >=3.12, <4
8
8
  Classifier: Programming Language :: Python :: 3
9
9
  Classifier: Programming Language :: Python :: 3.12
10
10
  Classifier: Programming Language :: Python :: 3.13
11
- Requires-Dist: openadr3-client (>=0.0.1,<1.0.0)
11
+ Requires-Dist: openadr3-client (>=0.0.7,<1.0.0)
12
12
  Requires-Dist: pycountry (>=24.6.1,<25.0.0)
13
13
  Requires-Dist: pydantic (>=2.11.2,<3.0.0)
14
14
  Description-Content-Type: text/markdown
@@ -86,17 +86,15 @@ def _targets_compliant(self: Event) -> Tuple[Event, list[InitErrorDetails]]:
86
86
 
87
87
  GAC enforces the following constraints for targets:
88
88
 
89
- - The event must contain a POWER_SERVICE_LOCATIONS target.
90
- - The POWER_SERVICE_LOCATIONS target value must be a list of 'EAN18' values.
89
+ - The event must contain a POWER_SERVICE_LOCATION target.
90
+ - The POWER_SERVICE_LOCATION target value must be a list of 'EAN18' values.
91
91
  - The event must contain a VEN_NAME target.
92
92
  - The VEN_NAME target value must be a list of 'ven object name' values (between 1 and 128 characters).
93
93
  """
94
94
  validation_errors: list[InitErrorDetails] = []
95
95
  targets = self.targets or ()
96
96
 
97
- power_service_locations = [
98
- t for t in targets if t.type == "POWER_SERVICE_LOCATIONS"
99
- ]
97
+ power_service_locations = [t for t in targets if t.type == "POWER_SERVICE_LOCATION"]
100
98
  ven_names = [t for t in targets if t.type == "VEN_NAME"]
101
99
 
102
100
  if not power_service_locations:
@@ -104,7 +102,7 @@ def _targets_compliant(self: Event) -> Tuple[Event, list[InitErrorDetails]]:
104
102
  InitErrorDetails(
105
103
  type=PydanticCustomError(
106
104
  "value_error",
107
- "The event must contain a POWER_SERVICE_LOCATIONS target.",
105
+ "The event must contain a POWER_SERVICE_LOCATION target.",
108
106
  ),
109
107
  loc=("targets",),
110
108
  input=self.targets,
@@ -130,7 +128,7 @@ def _targets_compliant(self: Event) -> Tuple[Event, list[InitErrorDetails]]:
130
128
  InitErrorDetails(
131
129
  type=PydanticCustomError(
132
130
  "value_error",
133
- "The event must contain exactly one POWER_SERVICE_LOCATIONS target.",
131
+ "The event must contain exactly one POWER_SERVICE_LOCATION target.",
134
132
  ),
135
133
  loc=("targets",),
136
134
  input=self.targets,
@@ -165,7 +163,7 @@ def _targets_compliant(self: Event) -> Tuple[Event, list[InitErrorDetails]]:
165
163
  InitErrorDetails(
166
164
  type=PydanticCustomError(
167
165
  "value_error",
168
- "The POWER_SERVICE_LOCATIONS target value cannot be empty.",
166
+ "The POWER_SERVICE_LOCATION target value cannot be empty.",
169
167
  ),
170
168
  loc=("targets",),
171
169
  input=self.targets,
@@ -173,12 +171,14 @@ def _targets_compliant(self: Event) -> Tuple[Event, list[InitErrorDetails]]:
173
171
  )
174
172
  )
175
173
 
176
- if not all(re.fullmatch(r"\d{18}", v) for v in power_service_location.values):
174
+ if not all(
175
+ re.fullmatch(r"^EAN\d{15}$", v) for v in power_service_location.values
176
+ ):
177
177
  validation_errors.append(
178
178
  InitErrorDetails(
179
179
  type=PydanticCustomError(
180
180
  "value_error",
181
- "The POWER_SERVICE_LOCATIONS target value must be a list of 'EAN18' values.",
181
+ "The POWER_SERVICE_LOCATION target value must be a list of 'EAN18' values.",
182
182
  ),
183
183
  loc=("targets",),
184
184
  input=self.targets,
@@ -228,34 +228,34 @@ def _payload_descriptor_gac_compliant(
228
228
  """
229
229
  validation_errors: list[InitErrorDetails] = []
230
230
 
231
- if self.payload_descriptor is None:
231
+ if self.payload_descriptors is None:
232
232
  validation_errors.append(
233
233
  InitErrorDetails(
234
234
  type=PydanticCustomError(
235
235
  "value_error",
236
236
  "The event must have a payload descriptor.",
237
237
  ),
238
- loc=("payload_descriptor",),
239
- input=self.payload_descriptor,
238
+ loc=("payload_descriptors",),
239
+ input=self.payload_descriptors,
240
240
  ctx={},
241
241
  )
242
242
  )
243
243
 
244
- if self.payload_descriptor is not None:
245
- if len(self.payload_descriptor) != 1:
244
+ if self.payload_descriptors is not None:
245
+ if len(self.payload_descriptors) != 1:
246
246
  validation_errors.append(
247
247
  InitErrorDetails(
248
248
  type=PydanticCustomError(
249
249
  "value_error",
250
250
  "The event must have exactly one payload descriptor.",
251
251
  ),
252
- loc=("payload_descriptor",),
253
- input=self.payload_descriptor,
252
+ loc=("payload_descriptors",),
253
+ input=self.payload_descriptors,
254
254
  ctx={},
255
255
  )
256
256
  )
257
257
 
258
- payload_descriptor = self.payload_descriptor[0]
258
+ payload_descriptor = self.payload_descriptors[0]
259
259
 
260
260
  if payload_descriptor.payload_type != EventPayloadType.IMPORT_CAPACITY_LIMIT:
261
261
  validation_errors.append(
@@ -264,8 +264,8 @@ def _payload_descriptor_gac_compliant(
264
264
  "value_error",
265
265
  "The payload descriptor must have a payload type of 'IMPORT_CAPACITY_LIMIT'.",
266
266
  ),
267
- loc=("payload_descriptor",),
268
- input=self.payload_descriptor,
267
+ loc=("payload_descriptors",),
268
+ input=self.payload_descriptors,
269
269
  ctx={},
270
270
  )
271
271
  )
@@ -277,8 +277,8 @@ def _payload_descriptor_gac_compliant(
277
277
  "value_error",
278
278
  "The payload descriptor must have a units of 'KW' (case sensitive).",
279
279
  ),
280
- loc=("payload_descriptor",),
281
- input=self.payload_descriptor,
280
+ loc=("payload_descriptors",),
281
+ input=self.payload_descriptors,
282
282
  ctx={},
283
283
  )
284
284
  )
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "openadr3-client-gac-compliance"
3
- version = "1.2.1"
3
+ version = "1.4.0"
4
4
  description = ""
5
5
  authors = [
6
6
  {name = "Nick van der Burgt", email = "nick.van.der.burgt@elaad.nl"}
@@ -9,7 +9,7 @@ readme = "README.md"
9
9
  requires-python = ">=3.12, <4"
10
10
  dependencies = [
11
11
  "pydantic (>=2.11.2,<3.0.0)",
12
- "openadr3-client (>=0.0.1,<1.0.0)",
12
+ "openadr3-client (>=0.0.7,<1.0.0)",
13
13
  "pycountry (>=24.6.1,<25.0.0)",
14
14
  ]
15
15