def oadrCreatedPartyRegistration(response_code, response_description, response_requestId, registrationID, venID, vtnID, profiles, poll_freq, specific_info, extensions): """ Generates the oadrCreatedPartiRegistration with the vtnInfo :param response_code: :param response_description: :param response_requestId: :param registrationID: :param venID: :param vtnID: :param profiles: :param poll_freq: :param specific_info: :param extensions: :return: the oadrCreatedPartyRegistration document """ party_registration_element = ELEMENTS['oadr'].oadrCreatedPartyRegistration() party_registration_element.append(eiResponse(response_code, response_description, response_requestId)) if registrationID: party_registration_element.append(ELEMENTS['ei'].registrationID(registrationID)) if venID: party_registration_element.append(ELEMENTS['ei'].venID(venID)) party_registration_element.append(ELEMENTS['ei'].vtnID(vtnID)) party_registration_element.append(oadrProfiles(profiles)) party_registration_element.append(ELEMENTS['oadr'].oadrRequestedOadrPollFreq(ELEMENTS['xcal'].duration(poll_freq))) if specific_info: party_registration_element.append(oadrServiceSpecificInfo(specific_info)) if extensions: party_registration_element.append(oadrExtensions(extensions)) return party_registration_element
def oadrDistributeEvent(response_code, response_description, response_requestId, requestID, vtnID, events): root = ElementMaker(namespace=NAMESPACES['oadr'], nsmap=NAMESPACES) distribute_event_element = root.oadrDistributeEvent() if response_code: distribute_event_element.append(eiResponse(response_code, response_description, response_requestId)) distribute_event_element.append(ELEMENTS['pyld'].requestID(requestID)) distribute_event_element.append(ELEMENTS['ei'].vtnID(vtnID)) for event in events: oadrEvents = oadrEvent(event) distribute_event_element.append(oadrEvents) return distribute_event_element
def oadrUpdatedReport(code, description, requestID, cancelReport, venID): oadr_updated_element = ELEMENTS['oadr'].oadrUpdatedReport( eiResponse(code, description, requestID), ELEMENTS['ei'].venID(venID) ) if cancelReport: oadr_updated_element.append( oadrCancelReport(cancelReport, requestID) ) return oadr_updated_element
def oadrRegisteredReport(code, description, requestID, report_types, venID): oadr_registered_element = ELEMENTS['oadr'].oadrRegisteredReport( eiResponse(code, description, requestID) ) for report in report_types: oadr_registered_element.append(oadrReportRequest(report['reportId'], report['specifierId'], report['data_points'])) oadr_registered_element.append( ELEMENTS['ei'].venID(venID) ) return oadr_registered_element
def oadrCreatedReport(code, description, requestID, pending_reports, venID): oadr_pending = ELEMENTS['oadr'].oadrPendingReports() for pending in pending_reports: oadr_pending.append( ELEMENTS['ei'].reportRequestID(pending) ) oadr_created_element = ELEMENTS['oadr'].oadrCreatedReport( eiResponse(code, description, requestID), oadr_pending, ELEMENTS['ei'].venID(venID) ) return oadr_created_element
def oadrCanceledPartyRegistration(response_code, response_description, response_requestId, registrationID, venID): """ Generates the oadrCancelledPartyRegistration :param response_code: :param response_description: :param response_requestId: :param registrationID: :param venID: :return: """ cancel_registration_element = ELEMENTS['oadr'].oadrCanceledPartyRegistration() cancel_registration_element.append(eiResponse(response_code, response_description, response_requestId)) cancel_registration_element.append(ELEMENTS['ei'].registrationID(registrationID)) cancel_registration_element.append(ELEMENTS['ei'].venID(venID)) return cancel_registration_element
def oadrCreatedOpt(code, description, requestID, optID): created_element = ELEMENTS['oadr'].oadrCreatedOpt( eiResponse(code, description, requestID), ELEMENTS['ei'].optID(optID)) return created_element