Browse Source

Use reportDataSource instead of reportSubject to get the resourceID of the report

This is in line with the requirements in the OpenADR specification that reportSubject can only contain an endDeviceAsset type.

Related to #37.

Signed-off-by: Stan Janssen <stan.janssen@elaad.nl>
Stan Janssen 4 years ago
parent
commit
60cf5df654
1 changed files with 2 additions and 2 deletions
  1. 2 2
      openleadr/service/report_service.py

+ 2 - 2
openleadr/service/report_service.py

@@ -83,7 +83,7 @@ class ReportService(VTNService):
             for report in payload['reports']:
             for report in payload['reports']:
                 if report['report_name'] == 'METADATA_TELEMETRY_STATUS':
                 if report['report_name'] == 'METADATA_TELEMETRY_STATUS':
                     result = [self.on_register_report(ven_id=payload['ven_id'],
                     result = [self.on_register_report(ven_id=payload['ven_id'],
-                                                      resource_id=rd.get('report_subject', {}).get('resource_id'),
+                                                      resource_id=rd.get('report_data_source', {}).get('resource_id'),
                                                       measurement='Status',
                                                       measurement='Status',
                                                       unit=None,
                                                       unit=None,
                                                       scale=None,
                                                       scale=None,
@@ -92,7 +92,7 @@ class ReportService(VTNService):
                               for rd in report['report_descriptions']]
                               for rd in report['report_descriptions']]
                 elif report['report_name'] == 'METADATA_TELEMETRY_USAGE':
                 elif report['report_name'] == 'METADATA_TELEMETRY_USAGE':
                     result = [self.on_register_report(ven_id=payload['ven_id'],
                     result = [self.on_register_report(ven_id=payload['ven_id'],
-                                                      resource_id=rd.get('report_subject', {}).get('resource_id'),
+                                                      resource_id=rd.get('report_data_source', {}).get('resource_id'),
                                                       measurement=rd['measurement']['description'],
                                                       measurement=rd['measurement']['description'],
                                                       unit=rd['measurement']['unit'],
                                                       unit=rd['measurement']['unit'],
                                                       scale=rd['measurement']['scale'],
                                                       scale=rd['measurement']['scale'],