diff --git a/development_utilities/generate_s2_message_type_to_class.py b/development_utilities/generate_s2_message_type_to_class.py index 9ddceaa..3d27fb6 100644 --- a/development_utilities/generate_s2_message_type_to_class.py +++ b/development_utilities/generate_s2_message_type_to_class.py @@ -16,9 +16,9 @@ for name, member in all_members: if ( inspect.isclass(member) - and hasattr(member, "__fields__") - and ("message_type" in member.__fields__) + and hasattr(member, "model_fields") + and ("message_type" in member.model_fields) ): - print(f" '{member.__fields__['message_type'].default}': {name},") + print(f" '{member.model_fields['message_type'].default}': {name},") print("}") diff --git a/src/s2python/s2_parser.py b/src/s2python/s2_parser.py index ca17306..ed2e957 100644 --- a/src/s2python/s2_parser.py +++ b/src/s2python/s2_parser.py @@ -24,8 +24,31 @@ FRBCTimerStatus, FRBCUsageForecast, ) -from s2python.pebc import PEBCPowerConstraints, PEBCEnergyConstraint, PEBCInstruction -from s2python.ppbc import PPBCScheduleInstruction +from s2python.pebc import ( + PEBCPowerConstraints, + PEBCEnergyConstraint, + PEBCInstruction, +) +from s2python.ppbc import ( + PPBCScheduleInstruction, + PPBCEndInterruptionInstruction, + PPBCPowerProfileDefinition, + PPBCPowerProfileStatus, + PPBCStartInterruptionInstruction +) +from s2python.ombc import ( + OMBCInstruction, + OMBCStatus, + OMBCSystemDescription, + OMBCTimerStatus +) +from s2python.ddbc import ( + DDBCActuatorStatus, + DDBCAverageDemandRateForecast, + DDBCInstruction, + DDBCSystemDescription, + DDBCTimerStatus, +) from s2python.message import S2Message from s2python.validate_values_mixin import S2MessageComponent @@ -40,28 +63,41 @@ # May be generated with development_utilities/generate_s2_message_type_to_class.py TYPE_TO_MESSAGE_CLASS: Dict[str, Type[S2Message]] = { - "FRBC.ActuatorStatus": FRBCActuatorStatus, - "FRBC.FillLevelTargetProfile": FRBCFillLevelTargetProfile, - "FRBC.Instruction": FRBCInstruction, - "FRBC.LeakageBehaviour": FRBCLeakageBehaviour, - "FRBC.StorageStatus": FRBCStorageStatus, - "FRBC.SystemDescription": FRBCSystemDescription, - "FRBC.TimerStatus": FRBCTimerStatus, - "FRBC.UsageForecast": FRBCUsageForecast, - "PPBC.ScheduleInstruction": PPBCScheduleInstruction, - "PEBC.PowerConstraints": PEBCPowerConstraints, - "PEBC.Instruction": PEBCInstruction, - "PEBC.EnergyConstraint": PEBCEnergyConstraint, - "Handshake": Handshake, - "HandshakeResponse": HandshakeResponse, - "InstructionStatusUpdate": InstructionStatusUpdate, - "PowerForecast": PowerForecast, - "PowerMeasurement": PowerMeasurement, - "ReceptionStatus": ReceptionStatus, - "ResourceManagerDetails": ResourceManagerDetails, - "RevokeObject": RevokeObject, - "SelectControlType": SelectControlType, - "SessionRequest": SessionRequest, + 'DDBC.ActuatorStatus': DDBCActuatorStatus, + 'DDBC.AverageDemandRateForecast': DDBCAverageDemandRateForecast, + 'DDBC.Instruction': DDBCInstruction, + 'DDBC.SystemDescription': DDBCSystemDescription, + 'DDBC.TimerStatus': DDBCTimerStatus, + 'FRBC.ActuatorStatus': FRBCActuatorStatus, + 'FRBC.FillLevelTargetProfile': FRBCFillLevelTargetProfile, + 'FRBC.Instruction': FRBCInstruction, + 'FRBC.LeakageBehaviour': FRBCLeakageBehaviour, + 'FRBC.StorageStatus': FRBCStorageStatus, + 'FRBC.SystemDescription': FRBCSystemDescription, + 'FRBC.TimerStatus': FRBCTimerStatus, + 'FRBC.UsageForecast': FRBCUsageForecast, + 'Handshake': Handshake, + 'HandshakeResponse': HandshakeResponse, + 'InstructionStatusUpdate': InstructionStatusUpdate, + 'OMBC.Instruction': OMBCInstruction, + 'OMBC.Status': OMBCStatus, + 'OMBC.SystemDescription': OMBCSystemDescription, + 'OMBC.TimerStatus': OMBCTimerStatus, + 'PEBC.EnergyConstraint': PEBCEnergyConstraint, + 'PEBC.Instruction': PEBCInstruction, + 'PEBC.PowerConstraints': PEBCPowerConstraints, + 'PPBC.EndInterruptionInstruction': PPBCEndInterruptionInstruction, + 'PPBC.PowerProfileDefinition': PPBCPowerProfileDefinition, + 'PPBC.PowerProfileStatus': PPBCPowerProfileStatus, + 'PPBC.ScheduleInstruction': PPBCScheduleInstruction, + 'PPBC.StartInterruptionInstruction': PPBCStartInterruptionInstruction, + 'PowerForecast': PowerForecast, + 'PowerMeasurement': PowerMeasurement, + 'ReceptionStatus': ReceptionStatus, + 'ResourceManagerDetails': ResourceManagerDetails, + 'RevokeObject': RevokeObject, + 'SelectControlType': SelectControlType, + 'SessionRequest': SessionRequest, }