Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HDLC frame could not be parsed when switching clients #95

Open
huebrick opened this issue Mar 21, 2024 · 2 comments
Open

HDLC frame could not be parsed when switching clients #95

huebrick opened this issue Mar 21, 2024 · 2 comments

Comments

@huebrick
Copy link

For my application I need to switch between a public and management client and something strange happens when I do.
Here is part of my code:

class task:
    def connectM():
        ser = serial.Serial(Port)
        ser.baudrate = Baud
        ser.write(b'\x7E\xA0\x0A\x00\x02\xFE\xFD\x41\x53\x3C\x94\x7E')
        ser.close()
        time.sleep(1)
        management.connect()
        management.associate()
    def disconnectM():
        management.release_association()
        management.disconnect()
    def connectC():
        client.connect()
        client.associate()
    def disconnectC():
        client.release_association()
        client.disconnect()
    def connectM2():
        management.connect()
        management.associate()

task.connectM()
print("\n\n\n DISCONNECTING MANAGEMENT\n\n\n")
task.disconnectM()
print("\n\n\n CONNECTING CLIENT\n\n\n")
task.connectC()
print("\n\n\n DISCONNECTING CLIENT\n\n\n")
task.disconnectC()
print("\n\n\n CONNECTING MANAGEMENT\n\n\n")
task.connectM2()

I am using ser.write(b'\x7E\xA0\x0A\x00\x02\xFE\xFD\x41\x53\x3C\x94\x7E') to release all the associations from the meter before the first connection because it can refuse a new association if the old one hasn't been released. I mentioned this in #74

The problem im encountering is that I connect as a management client no problem, and I also after that connect as a public client and get my data and finish everything I need as a public client and then when I want to again return to a management client then I encounter a problem. I have tried using just the management.connect() and management.associate() and that basically did nothing.

Here is the console output:

2024-03-21 12:13:17 [debug    ] HDLC state transitioned        new_state=AWAITING_CONNECTION old_state=NOT_CONNECTED
2024-03-21 12:13:17 [debug    ] Sending data                   data=bytearray(b'~\xa0\n\x00\x02,)\x03\x93\x86\n~') transport=HdlcTransport(client_logical_address=1, server_logical_address=1, io=SerialIO(port_name='COM8', baud_rate=9600, timeout=1, serial_port=Serial<id=0x1a93fd48040, open=True>(port='COM8', baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=1, xonxoff=False, rtscts=False, dsrdtr=False)), server_physical_address=2836, client_physical_address=None, extended_addressing=True, timeout=1, hdlc_connection=HdlcConnection(client_address=HdlcAddress(logical_address=1, physical_address=2836, address_type='server', extended_addressing=True), server_address=HdlcAddress(logical_address=1, physical_address=None, address_type='client', extended_addressing=True), client_ssn=0, client_rsn=0, server_ssn=0, server_rsn=0, max_data_size=128, state=HdlcConnectionState(current_state=AWAITING_CONNECTION), buffer=bytearray(b''), buffer_search_position=1), _send_buffer=[], out_buffer=bytearray(b''), in_buffer=bytearray(b''))
2024-03-21 12:13:17 [debug    ] Received data                  data=b'~\xa0#\x03\x00\x02,)s(\x13\x81\x80\x14\x05\x02\x00\xf2\x06\x02\x00\xf2\x07\x04\x00\x00\x00\x01\x08\x04\x00\x00\x00\x01\x0c\xf7~' transport=HdlcTransport(client_logical_address=1, server_logical_address=1, io=SerialIO(port_name='COM8', baud_rate=9600, timeout=1, serial_port=Serial<id=0x1a93fd48040, open=True>(port='COM8', baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=1, xonxoff=False, rtscts=False, dsrdtr=False)), server_physical_address=2836, client_physical_address=None, extended_addressing=True, timeout=1, hdlc_connection=HdlcConnection(client_address=HdlcAddress(logical_address=1, physical_address=2836, address_type='server', extended_addressing=True), server_address=HdlcAddress(logical_address=1, physical_address=None, address_type='client', extended_addressing=True), client_ssn=0, client_rsn=0, server_ssn=0, server_rsn=0, max_data_size=128, state=HdlcConnectionState(current_state=AWAITING_CONNECTION), buffer=bytearray(b''), buffer_search_position=1), _send_buffer=[], out_buffer=bytearray(b''), in_buffer=bytearray(b''))
2024-03-21 12:13:17 [debug    ] Added data to buffer           data=b'~\xa0#\x03\x00\x02,)s(\x13\x81\x80\x14\x05\x02\x00\xf2\x06\x02\x00\xf2\x07\x04\x00\x00\x00\x01\x08\x04\x00\x00\x00\x01\x0c\xf7~'
2024-03-21 12:13:17 [debug    ] Received HDLC frame            frame=UnNumberedAcknowledgmentFrame(destination_address=HdlcAddress(logical_address=1, physical_address=None, address_type='client', extended_addressing=False), source_address=HdlcAddress(logical_address=1, physical_address=2836, address_type='server', extended_addressing=True), payload=bytearray(b'\x81\x80\x14\x05\x02\x00\xf2\x06\x02\x00\xf2\x07\x04\x00\x00\x00\x01\x08\x04\x00\x00\x00\x01'), segmented=False, final=True)
2024-03-21 12:13:17 [debug    ] HDLC state transitioned        new_state=IDLE old_state=AWAITING_CONNECTION
2024-03-21 12:13:17 [debug    ] DLMS state transitioned        new_state=AWAITING_ASSOCIATION_RESPONSE old_state=NO_ASSOCIATION
2024-03-21 12:13:17 [debug    ] Preparing to send DLMS Request request=ApplicationAssociationRequest(user_information=UserInformation(content=InitiateRequest(proposed_conformance=Conformance(general_protection=False, general_block_transfer=True, delta_value_encoding=False, attribute_0_supported_with_set=False, priority_management_supported=True, attribute_0_supported_with_get=False, block_transfer_with_get_or_read=True, block_transfer_with_set_or_write=False, block_transfer_with_action=False, multiple_references=True, data_notification=False, access=True, get=True, set=True, selective_access=True, event_notification=True, action=True), proposed_quality_of_service=None, client_max_receive_pdu_size=65535, proposed_dlms_version_number=6, response_allowed=True, dedicated_key=None)), system_title=b'uti\xc8.\x8c7\x84', public_cert=None, authentication=<AuthenticationMechanism.LLS: 1>, ciphered=False, authentication_value=b'12345678', calling_ae_invocation_identifier=None, called_ap_title=None, called_ae_qualifier=None, called_ap_invocation_identifier=None, called_ae_invocation_identifier=None, calling_ap_invocation_identifier=None, implementation_information=None)
2024-03-21 12:13:17 [info     ] Sending DLMS Request           request=ApplicationAssociationRequest(user_information=UserInformation(content=InitiateRequest(proposed_conformance=Conformance(general_protection=False, general_block_transfer=True, delta_value_encoding=False, attribute_0_supported_with_set=False, priority_management_supported=True, attribute_0_supported_with_get=False, block_transfer_with_get_or_read=True, block_transfer_with_set_or_write=False, block_transfer_with_action=False, multiple_references=True, data_notification=False, access=True, get=True, set=True, selective_access=True, event_notification=True, action=True), proposed_quality_of_service=None, client_max_receive_pdu_size=65535, proposed_dlms_version_number=6, response_allowed=True, dedicated_key=None)), system_title=b'uti\xc8.\x8c7\x84', public_cert=None, authentication=<AuthenticationMechanism.LLS: 1>, ciphered=False, authentication_value=b'12345678', calling_ae_invocation_identifier=None, called_ap_title=None, called_ae_qualifier=None, called_ap_invocation_identifier=None, called_ae_invocation_identifier=None, calling_ap_invocation_identifier=None, implementation_information=None)
2024-03-21 12:13:17 [info     ] Sending HDLC frame             frame=InformationFrame(destination_address=HdlcAddress(logical_address=1, physical_address=2836, address_type='server', extended_addressing=True), source_address=HdlcAddress(logical_address=1, physical_address=None, address_type='client', extended_addressing=True), payload=bytearray(b'\xe6\xe6\x00`B\xa1\t\x06\x07`\x85t\x05\x08\x01\x01\xa6\n\x04\x08uti\xc8.\x8c7\x84\x8a\x02\x07\x80\x8b\x07`\x85t\x05\x08\x02\x01\xac\n\x80\x0812345678\xbe\x10\x04\x0e\x01\x00\x00\x00\x06_\x1f\x04\x00 R_\xff\xff'), segmented=False, final=True, send_sequence_number=0, receive_sequence_number=0)
2024-03-21 12:13:17 [debug    ] HDLC state transitioned        new_state=AWAITING_RESPONSE old_state=IDLE
2024-03-21 12:13:17 [debug    ] Sending data                   data=b'~\xa0S\x00\x02,)\x03\x10\xe3\x8f\xe6\xe6\x00`B\xa1\t\x06\x07`\x85t\x05\x08\x01\x01\xa6\n\x04\x08uti\xc8.\x8c7\x84\x8a\x02\x07\x80\x8b\x07`\x85t\x05\x08\x02\x01\xac\n\x80\x0812345678\xbe\x10\x04\x0e\x01\x00\x00\x00\x06_\x1f\x04\x00 R_\xff\xff\xa7\x13~' transport=HdlcTransport(client_logical_address=1, server_logical_address=1, io=SerialIO(port_name='COM8', baud_rate=9600, timeout=1, serial_port=Serial<id=0x1a93fd48040, open=True>(port='COM8', baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=1, xonxoff=False, rtscts=False, dsrdtr=False)), server_physical_address=2836, client_physical_address=None, extended_addressing=True, timeout=1, hdlc_connection=HdlcConnection(client_address=HdlcAddress(logical_address=1, physical_address=2836, address_type='server', extended_addressing=True), server_address=HdlcAddress(logical_address=1, physical_address=None, address_type='client', extended_addressing=True), client_ssn=0, client_rsn=1, server_ssn=1, server_rsn=0, max_data_size=128, state=HdlcConnectionState(current_state=AWAITING_RESPONSE), buffer=bytearray(b''), buffer_search_position=1), _send_buffer=[], out_buffer=bytearray(b''), in_buffer=bytearray(b''))
2024-03-21 12:13:17 [debug    ] Received data                  data=b'~\xa0:\x03\x00\x02,)0G\x97\xe6\xe7\x00a)\xa1\t\x06\x07`\x85t\x05\x08\x01\x01\xa2\x03\x02\x01\x00\xa3\x05\xa1\x03\x02\x01\x00\xbe\x10\x04\x0e\x08\x00\x06_\x1f\x04\x00\x00R\x1d\x00\xef\x00\x07O\xa4~' transport=HdlcTransport(client_logical_address=1, server_logical_address=1, io=SerialIO(port_name='COM8', baud_rate=9600, timeout=1, serial_port=Serial<id=0x1a93fd48040, open=True>(port='COM8', baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=1, xonxoff=False, rtscts=False, dsrdtr=False)), server_physical_address=2836, client_physical_address=None, extended_addressing=True, timeout=1, hdlc_connection=HdlcConnection(client_address=HdlcAddress(logical_address=1, physical_address=2836, address_type='server', extended_addressing=True), server_address=HdlcAddress(logical_address=1, physical_address=None, address_type='client', extended_addressing=True), client_ssn=0, client_rsn=1, server_ssn=1, server_rsn=0, max_data_size=128, state=HdlcConnectionState(current_state=AWAITING_RESPONSE), buffer=bytearray(b''), buffer_search_position=1), _send_buffer=[], out_buffer=bytearray(b''), in_buffer=bytearray(b''))
2024-03-21 12:13:17 [debug    ] Added data to buffer           data=b'~\xa0:\x03\x00\x02,)0G\x97\xe6\xe7\x00a)\xa1\t\x06\x07`\x85t\x05\x08\x01\x01\xa2\x03\x02\x01\x00\xa3\x05\xa1\x03\x02\x01\x00\xbe\x10\x04\x0e\x08\x00\x06_\x1f\x04\x00\x00R\x1d\x00\xef\x00\x07O\xa4~'
2024-03-21 12:13:17 [debug    ] Received HDLC frame            frame=InformationFrame(destination_address=HdlcAddress(logical_address=1, physical_address=None, address_type='client', extended_addressing=False), source_address=HdlcAddress(logical_address=1, physical_address=2836, address_type='server', extended_addressing=True), payload=bytearray(b'\xe6\xe7\x00a)\xa1\t\x06\x07`\x85t\x05\x08\x01\x01\xa2\x03\x02\x01\x00\xa3\x05\xa1\x03\x02\x01\x00\xbe\x10\x04\x0e\x08\x00\x06_\x1f\x04\x00\x00R\x1d\x00\xef\x00\x07'), segmented=False, final=True, send_sequence_number=0, receive_sequence_number=1)
2024-03-21 12:13:17 [debug    ] HDLC state transitioned        new_state=IDLE old_state=AWAITING_RESPONSE
2024-03-21 12:13:17 [debug    ] Adding data to buffer          data=bytearray(b'a)\xa1\t\x06\x07`\x85t\x05\x08\x01\x01\xa2\x03\x02\x01\x00\xa3\x05\xa1\x03\x02\x01\x00\xbe\x10\x04\x0e\x08\x00\x06_\x1f\x04\x00\x00R\x1d\x00\xef\x00\x07')
2024-03-21 12:13:17 [info     ] Received DLMS Response         response=ApplicationAssociationResponse(result=<AssociationResult.ACCEPTED: 0>, result_source_diagnostics=<AcseServiceUserDiagnostics.NULL: 0>, ciphered=False, authentication=None, system_title=None, public_cert=None, authentication_value=None, user_information=UserInformation(content=InitiateResponse(negotiated_conformance=Conformance(general_protection=False, general_block_transfer=False, delta_value_encoding=False, attribute_0_supported_with_set=False, priority_management_supported=True, attribute_0_supported_with_get=False, block_transfer_with_get_or_read=True, block_transfer_with_set_or_write=False, block_transfer_with_action=False, multiple_references=True, data_notification=False, access=False, get=True, set=True, selective_access=True, event_notification=False, action=True), server_max_receive_pdu_size=239, negotiated_dlms_version_number=6, negotiated_quality_of_service=0)), implementation_information=None, responding_ap_invocation_id=None, responding_ae_invocation_id=None)
2024-03-21 12:13:17 [debug    ] DLMS state transitioned        new_state=READY old_state=AWAITING_ASSOCIATION_RESPONSE



 DISCONNECTING MANAGEMENT



2024-03-21 12:13:17 [debug    ] DLMS state transitioned        new_state=AWAITING_RELEASE_RESPONSE old_state=READY
2024-03-21 12:13:17 [debug    ] Preparing to send DLMS Request request=ReleaseRequest(reason=<ReleaseRequestReason.NORMAL: 0>, user_information=UserInformation(content=InitiateRequest(proposed_conformance=Conformance(general_protection=False, general_block_transfer=False, delta_value_encoding=False, attribute_0_supported_with_set=False, priority_management_supported=True, attribute_0_supported_with_get=False, block_transfer_with_get_or_read=True, block_transfer_with_set_or_write=False, block_transfer_with_action=False, multiple_references=True, data_notification=False, access=False, get=True, set=True, selective_access=True, event_notification=False, action=True), proposed_quality_of_service=None, client_max_receive_pdu_size=239, proposed_dlms_version_number=6, response_allowed=True, dedicated_key=None)))
2024-03-21 12:13:17 [info     ] Sending DLMS Request           request=ReleaseRequest(reason=<ReleaseRequestReason.NORMAL: 0>, user_information=UserInformation(content=InitiateRequest(proposed_conformance=Conformance(general_protection=False, general_block_transfer=False, delta_value_encoding=False, attribute_0_supported_with_set=False, priority_management_supported=True, attribute_0_supported_with_get=False, block_transfer_with_get_or_read=True, block_transfer_with_set_or_write=False, block_transfer_with_action=False, multiple_references=True, data_notification=False, access=False, get=True, set=True, selective_access=True, event_notification=False, action=True), proposed_quality_of_service=None, client_max_receive_pdu_size=239, proposed_dlms_version_number=6, response_allowed=True, dedicated_key=None)))
2024-03-21 12:13:17 [info     ] Sending HDLC frame             frame=InformationFrame(destination_address=HdlcAddress(logical_address=1, physical_address=2836, address_type='server', extended_addressing=True), source_address=HdlcAddress(logical_address=1, physical_address=None, address_type='client', extended_addressing=True), payload=bytearray(b'\xe6\xe6\x00b\x15\x80\x01\x00\xbe\x10\x04\x0e\x01\x00\x00\x00\x06_\x1f\x04\x00\x00R\x1d\x00\xef'), segmented=False, final=True, send_sequence_number=1, receive_sequence_number=1)
2024-03-21 12:13:17 [debug    ] HDLC state transitioned        new_state=AWAITING_RESPONSE old_state=IDLE
2024-03-21 12:13:17 [debug    ] Sending data                   data=b'~\xa0&\x00\x02,)\x032\x1cl\xe6\xe6\x00b\x15\x80\x01\x00\xbe\x10\x04\x0e\x01\x00\x00\x00\x06_\x1f\x04\x00\x00R\x1d\x00\xefV"~' transport=HdlcTransport(client_logical_address=1, server_logical_address=1, io=SerialIO(port_name='COM8', baud_rate=9600, timeout=1, serial_port=Serial<id=0x1a93fd48040, open=True>(port='COM8', baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=1, xonxoff=False, rtscts=False, dsrdtr=False)), server_physical_address=2836, client_physical_address=None, extended_addressing=True, timeout=1, hdlc_connection=HdlcConnection(client_address=HdlcAddress(logical_address=1, physical_address=2836, address_type='server', extended_addressing=True), server_address=HdlcAddress(logical_address=1, physical_address=None, address_type='client', extended_addressing=True), client_ssn=1, client_rsn=2, server_ssn=2, server_rsn=1, max_data_size=128, state=HdlcConnectionState(current_state=AWAITING_RESPONSE), buffer=bytearray(b''), buffer_search_position=1), _send_buffer=[], out_buffer=bytearray(b''), in_buffer=bytearray(b''))
2024-03-21 12:13:17 [debug    ] Received data                  data=b'~\xa0&\x03\x00\x02,)R\x00\xd3\xe6\xe7\x00c\x15\x80\x01\x00\xbe\x10\x04\x0e\x08\x00\x06_\x1f\x04\x00\x00R\x1d\x00\xef\x00\x07\xdf\x05~' transport=HdlcTransport(client_logical_address=1, server_logical_address=1, io=SerialIO(port_name='COM8', baud_rate=9600, timeout=1, serial_port=Serial<id=0x1a93fd48040, open=True>(port='COM8', baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=1, xonxoff=False, rtscts=False, dsrdtr=False)), server_physical_address=2836, client_physical_address=None, extended_addressing=True, timeout=1, hdlc_connection=HdlcConnection(client_address=HdlcAddress(logical_address=1, physical_address=2836, address_type='server', extended_addressing=True), server_address=HdlcAddress(logical_address=1, physical_address=None, address_type='client', extended_addressing=True), client_ssn=1, client_rsn=2, server_ssn=2, server_rsn=1, max_data_size=128, state=HdlcConnectionState(current_state=AWAITING_RESPONSE), buffer=bytearray(b''), buffer_search_position=1), _send_buffer=[], out_buffer=bytearray(b''), in_buffer=bytearray(b''))
2024-03-21 12:13:17 [debug    ] Added data to buffer           data=b'~\xa0&\x03\x00\x02,)R\x00\xd3\xe6\xe7\x00c\x15\x80\x01\x00\xbe\x10\x04\x0e\x08\x00\x06_\x1f\x04\x00\x00R\x1d\x00\xef\x00\x07\xdf\x05~'
2024-03-21 12:13:17 [debug    ] Received HDLC frame            frame=InformationFrame(destination_address=HdlcAddress(logical_address=1, physical_address=None, address_type='client', extended_addressing=False), source_address=HdlcAddress(logical_address=1, physical_address=2836, address_type='server', extended_addressing=True), payload=bytearray(b'\xe6\xe7\x00c\x15\x80\x01\x00\xbe\x10\x04\x0e\x08\x00\x06_\x1f\x04\x00\x00R\x1d\x00\xef\x00\x07'), segmented=False, final=True, send_sequence_number=1, receive_sequence_number=2)
2024-03-21 12:13:17 [debug    ] HDLC state transitioned        new_state=IDLE old_state=AWAITING_RESPONSE
2024-03-21 12:13:17 [debug    ] Adding data to buffer          data=bytearray(b'c\x15\x80\x01\x00\xbe\x10\x04\x0e\x08\x00\x06_\x1f\x04\x00\x00R\x1d\x00\xef\x00\x07')
2024-03-21 12:13:17 [info     ] Received DLMS Response         response=ReleaseResponse(reason=<ReleaseResponseReason.NORMAL: 0>, user_information=UserInformation(content=InitiateResponse(negotiated_conformance=Conformance(general_protection=False, general_block_transfer=False, delta_value_encoding=False, attribute_0_supported_with_set=False, priority_management_supported=True, attribute_0_supported_with_get=False, block_transfer_with_get_or_read=True, block_transfer_with_set_or_write=False, block_transfer_with_action=False, multiple_references=True, data_notification=False, access=False, get=True, set=True, selective_access=True, event_notification=False, action=True), server_max_receive_pdu_size=239, negotiated_dlms_version_number=6, negotiated_quality_of_service=0)))
2024-03-21 12:13:17 [debug    ] DLMS state transitioned        new_state=NO_ASSOCIATION old_state=AWAITING_RELEASE_RESPONSE
2024-03-21 12:13:17 [debug    ] HDLC state transitioned        new_state=AWAITING_DISCONNECT old_state=IDLE
2024-03-21 12:13:17 [debug    ] Sending data                   data=bytearray(b'~\xa0\n\x00\x02,)\x03S\x8a\xcc~') transport=HdlcTransport(client_logical_address=1, server_logical_address=1, io=SerialIO(port_name='COM8', baud_rate=9600, timeout=1, serial_port=Serial<id=0x1a93fd48040, open=True>(port='COM8', baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=1, xonxoff=False, rtscts=False, dsrdtr=False)), server_physical_address=2836, client_physical_address=None, extended_addressing=True, timeout=1, hdlc_connection=HdlcConnection(client_address=HdlcAddress(logical_address=1, physical_address=2836, address_type='server', extended_addressing=True), server_address=HdlcAddress(logical_address=1, physical_address=None, address_type='client', extended_addressing=True), client_ssn=2, client_rsn=2, server_ssn=2, server_rsn=2, max_data_size=128, state=HdlcConnectionState(current_state=AWAITING_DISCONNECT), buffer=bytearray(b''), buffer_search_position=1), _send_buffer=[], out_buffer=bytearray(b''), in_buffer=bytearray(b''))
2024-03-21 12:13:18 [debug    ] Received data                  data=b'~\xa0\n\x03\x00\x02,)s\x921~' transport=HdlcTransport(client_logical_address=1, server_logical_address=1, io=SerialIO(port_name='COM8', baud_rate=9600, timeout=1, serial_port=Serial<id=0x1a93fd48040, open=True>(port='COM8', baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=1, xonxoff=False, rtscts=False, dsrdtr=False)), server_physical_address=2836, client_physical_address=None, extended_addressing=True, timeout=1, hdlc_connection=HdlcConnection(client_address=HdlcAddress(logical_address=1, physical_address=2836, address_type='server', extended_addressing=True), server_address=HdlcAddress(logical_address=1, physical_address=None, address_type='client', extended_addressing=True), client_ssn=2, client_rsn=2, server_ssn=2, server_rsn=2, max_data_size=128, state=HdlcConnectionState(current_state=AWAITING_DISCONNECT), buffer=bytearray(b''), buffer_search_position=1), _send_buffer=[], out_buffer=bytearray(b''), in_buffer=bytearray(b''))
2024-03-21 12:13:18 [debug    ] Added data to buffer           data=b'~\xa0\n\x03\x00\x02,)s\x921~'
2024-03-21 12:13:18 [debug    ] Received HDLC frame            frame=UnNumberedAcknowledgmentFrame(destination_address=HdlcAddress(logical_address=1, physical_address=None, address_type='client', extended_addressing=False), source_address=HdlcAddress(logical_address=1, physical_address=2836, address_type='server', extended_addressing=True), payload=bytearray(b''), segmented=False, final=True)
2024-03-21 12:13:18 [debug    ] HDLC state transitioned        new_state=NOT_CONNECTED old_state=AWAITING_DISCONNECT



 CONNECTING CLIENT



2024-03-21 12:13:18 [debug    ] HDLC state transitioned        new_state=AWAITING_CONNECTION old_state=NOT_CONNECTED
2024-03-21 12:13:18 [debug    ] Sending data                   data=bytearray(b'~\xa0\n\x00\x02,)!\x93\x05\x1a~') transport=HdlcTransport(client_logical_address=16, server_logical_address=1, io=SerialIO(port_name='COM8', baud_rate=9600, timeout=1, serial_port=Serial<id=0x1a93f8478b0, open=True>(port='COM8', baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=1, xonxoff=False, rtscts=False, dsrdtr=False)), server_physical_address=2836, client_physical_address=None, extended_addressing=True, timeout=1, hdlc_connection=HdlcConnection(client_address=HdlcAddress(logical_address=1, physical_address=2836, address_type='server', extended_addressing=True), server_address=HdlcAddress(logical_address=16, physical_address=None, address_type='client', extended_addressing=True), client_ssn=0, client_rsn=0, server_ssn=0, server_rsn=0, max_data_size=128, state=HdlcConnectionState(current_state=AWAITING_CONNECTION), buffer=bytearray(b''), buffer_search_position=1), _send_buffer=[], out_buffer=bytearray(b''), in_buffer=bytearray(b''))
2024-03-21 12:13:18 [debug    ] Received data                  data=b'~\xa0#!\x00\x02,)s\x1e\x9e\x81\x80\x14\x05\x02\x00\xf2\x06\x02\x00\xf2\x07\x04\x00\x00\x00\x01\x08\x04\x00\x00\x00\x01\x0c\xf7~' transport=HdlcTransport(client_logical_address=16, server_logical_address=1, io=SerialIO(port_name='COM8', baud_rate=9600, timeout=1, serial_port=Serial<id=0x1a93f8478b0, open=True>(port='COM8', baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=1, xonxoff=False, rtscts=False, dsrdtr=False)), server_physical_address=2836, client_physical_address=None, extended_addressing=True, timeout=1, hdlc_connection=HdlcConnection(client_address=HdlcAddress(logical_address=1, physical_address=2836, address_type='server', extended_addressing=True), server_address=HdlcAddress(logical_address=16, physical_address=None, address_type='client', extended_addressing=True), client_ssn=0, client_rsn=0, server_ssn=0, server_rsn=0, max_data_size=128, state=HdlcConnectionState(current_state=AWAITING_CONNECTION), buffer=bytearray(b''), buffer_search_position=1), _send_buffer=[], out_buffer=bytearray(b''), in_buffer=bytearray(b''))
2024-03-21 12:13:18 [debug    ] Added data to buffer           data=b'~\xa0#!\x00\x02,)s\x1e\x9e\x81\x80\x14\x05\x02\x00\xf2\x06\x02\x00\xf2\x07\x04\x00\x00\x00\x01\x08\x04\x00\x00\x00\x01\x0c\xf7~'
2024-03-21 12:13:18 [debug    ] Received HDLC frame            frame=UnNumberedAcknowledgmentFrame(destination_address=HdlcAddress(logical_address=16, physical_address=None, address_type='client', extended_addressing=False), source_address=HdlcAddress(logical_address=1, physical_address=2836, address_type='server', extended_addressing=True), payload=bytearray(b'\x81\x80\x14\x05\x02\x00\xf2\x06\x02\x00\xf2\x07\x04\x00\x00\x00\x01\x08\x04\x00\x00\x00\x01'), segmented=False, final=True)
2024-03-21 12:13:18 [debug    ] HDLC state transitioned        new_state=IDLE old_state=AWAITING_CONNECTION
2024-03-21 12:13:18 [debug    ] DLMS state transitioned        new_state=AWAITING_ASSOCIATION_RESPONSE old_state=NO_ASSOCIATION
2024-03-21 12:13:18 [debug    ] Preparing to send DLMS Request request=ApplicationAssociationRequest(user_information=UserInformation(content=InitiateRequest(proposed_conformance=Conformance(general_protection=False, general_block_transfer=True, delta_value_encoding=False, attribute_0_supported_with_set=False, priority_management_supported=True, attribute_0_supported_with_get=False, block_transfer_with_get_or_read=True, block_transfer_with_set_or_write=False, block_transfer_with_action=False, multiple_references=True, data_notification=False, access=True, get=True, set=True, selective_access=True, event_notification=True, action=True), proposed_quality_of_service=None, client_max_receive_pdu_size=65535, proposed_dlms_version_number=6, response_allowed=True, dedicated_key=None)), system_title=b'utif\xab\\\xeby', public_cert=None, authentication=<AuthenticationMechanism.NONE: 0>, ciphered=False, authentication_value=None, calling_ae_invocation_identifier=None, called_ap_title=None, called_ae_qualifier=None, called_ap_invocation_identifier=None, called_ae_invocation_identifier=None, calling_ap_invocation_identifier=None, implementation_information=None)
2024-03-21 12:13:18 [info     ] Sending DLMS Request           request=ApplicationAssociationRequest(user_information=UserInformation(content=InitiateRequest(proposed_conformance=Conformance(general_protection=False, general_block_transfer=True, delta_value_encoding=False, attribute_0_supported_with_set=False, priority_management_supported=True, attribute_0_supported_with_get=False, block_transfer_with_get_or_read=True, block_transfer_with_set_or_write=False, block_transfer_with_action=False, multiple_references=True, data_notification=False, access=True, get=True, set=True, selective_access=True, event_notification=True, action=True), proposed_quality_of_service=None, client_max_receive_pdu_size=65535, proposed_dlms_version_number=6, response_allowed=True, dedicated_key=None)), system_title=b'utif\xab\\\xeby', public_cert=None, authentication=<AuthenticationMechanism.NONE: 0>, ciphered=False, authentication_value=None, calling_ae_invocation_identifier=None, called_ap_title=None, called_ae_qualifier=None, called_ap_invocation_identifier=None, called_ae_invocation_identifier=None, calling_ap_invocation_identifier=None, implementation_information=None)
2024-03-21 12:13:18 [info     ] Sending HDLC frame             frame=InformationFrame(destination_address=HdlcAddress(logical_address=1, physical_address=2836, address_type='server', extended_addressing=True), source_address=HdlcAddress(logical_address=16, physical_address=None, address_type='client', extended_addressing=True), payload=bytearray(b'\xe6\xe6\x00`)\xa1\t\x06\x07`\x85t\x05\x08\x01\x01\xa6\n\x04\x08utif\xab\\\xeby\xbe\x10\x04\x0e\x01\x00\x00\x00\x06_\x1f\x04\x00 R_\xff\xff'), segmented=False, final=True, send_sequence_number=0, receive_sequence_number=0)
2024-03-21 12:13:18 [debug    ] HDLC state transitioned        new_state=AWAITING_RESPONSE old_state=IDLE
2024-03-21 12:13:18 [debug    ] Sending data                   data=b'~\xa0:\x00\x02,)!\x10\xdcz\xe6\xe6\x00`)\xa1\t\x06\x07`\x85t\x05\x08\x01\x01\xa6\n\x04\x08utif\xab\\\xeby\xbe\x10\x04\x0e\x01\x00\x00\x00\x06_\x1f\x04\x00 R_\xff\xff2a~' transport=HdlcTransport(client_logical_address=16, server_logical_address=1, io=SerialIO(port_name='COM8', baud_rate=9600, timeout=1, serial_port=Serial<id=0x1a93f8478b0, open=True>(port='COM8', baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=1, xonxoff=False, rtscts=False, dsrdtr=False)), server_physical_address=2836, client_physical_address=None, extended_addressing=True, timeout=1, hdlc_connection=HdlcConnection(client_address=HdlcAddress(logical_address=1, physical_address=2836, address_type='server', extended_addressing=True), server_address=HdlcAddress(logical_address=16, physical_address=None, address_type='client', extended_addressing=True), client_ssn=0, client_rsn=1, server_ssn=1, server_rsn=0, max_data_size=128, state=HdlcConnectionState(current_state=AWAITING_RESPONSE), buffer=bytearray(b''), buffer_search_position=1), _send_buffer=[], out_buffer=bytearray(b''), in_buffer=bytearray(b''))
2024-03-21 12:13:18 [debug    ] Received data                  data=b'~\xa0:!\x00\x02,)0q\x1a\xe6\xe7\x00a)\xa1\t\x06\x07`\x85t\x05\x08\x01\x01\xa2\x03\x02\x01\x00\xa3\x05\xa1\x03\x02\x01\x00\xbe\x10\x04\x0e\x08\x00\x06_\x1f\x04\x00\x00R\x14\x00\xef\x00\x07+\xf5~' transport=HdlcTransport(client_logical_address=16, server_logical_address=1, io=SerialIO(port_name='COM8', baud_rate=9600, timeout=1, serial_port=Serial<id=0x1a93f8478b0, open=True>(port='COM8', baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=1, xonxoff=False, rtscts=False, dsrdtr=False)), server_physical_address=2836, client_physical_address=None, extended_addressing=True, timeout=1, hdlc_connection=HdlcConnection(client_address=HdlcAddress(logical_address=1, physical_address=2836, address_type='server', extended_addressing=True), server_address=HdlcAddress(logical_address=16, physical_address=None, address_type='client', extended_addressing=True), client_ssn=0, client_rsn=1, server_ssn=1, server_rsn=0, max_data_size=128, state=HdlcConnectionState(current_state=AWAITING_RESPONSE), buffer=bytearray(b''), buffer_search_position=1), _send_buffer=[], out_buffer=bytearray(b''), in_buffer=bytearray(b''))
2024-03-21 12:13:18 [debug    ] Added data to buffer           data=b'~\xa0:!\x00\x02,)0q\x1a\xe6\xe7\x00a)\xa1\t\x06\x07`\x85t\x05\x08\x01\x01\xa2\x03\x02\x01\x00\xa3\x05\xa1\x03\x02\x01\x00\xbe\x10\x04\x0e\x08\x00\x06_\x1f\x04\x00\x00R\x14\x00\xef\x00\x07+\xf5~'
2024-03-21 12:13:18 [debug    ] Received HDLC frame            frame=InformationFrame(destination_address=HdlcAddress(logical_address=16, physical_address=None, address_type='client', extended_addressing=False), source_address=HdlcAddress(logical_address=1, physical_address=2836, address_type='server', extended_addressing=True), payload=bytearray(b'\xe6\xe7\x00a)\xa1\t\x06\x07`\x85t\x05\x08\x01\x01\xa2\x03\x02\x01\x00\xa3\x05\xa1\x03\x02\x01\x00\xbe\x10\x04\x0e\x08\x00\x06_\x1f\x04\x00\x00R\x14\x00\xef\x00\x07'), segmented=False, final=True, send_sequence_number=0, receive_sequence_number=1)
2024-03-21 12:13:18 [debug    ] HDLC state transitioned        new_state=IDLE old_state=AWAITING_RESPONSE
2024-03-21 12:13:18 [debug    ] Adding data to buffer          data=bytearray(b'a)\xa1\t\x06\x07`\x85t\x05\x08\x01\x01\xa2\x03\x02\x01\x00\xa3\x05\xa1\x03\x02\x01\x00\xbe\x10\x04\x0e\x08\x00\x06_\x1f\x04\x00\x00R\x14\x00\xef\x00\x07')
2024-03-21 12:13:18 [info     ] Received DLMS Response         response=ApplicationAssociationResponse(result=<AssociationResult.ACCEPTED: 0>, result_source_diagnostics=<AcseServiceUserDiagnostics.NULL: 0>, ciphered=False, authentication=None, system_title=None, public_cert=None, authentication_value=None, user_information=UserInformation(content=InitiateResponse(negotiated_conformance=Conformance(general_protection=False, general_block_transfer=False, delta_value_encoding=False, attribute_0_supported_with_set=False, priority_management_supported=True, attribute_0_supported_with_get=False, block_transfer_with_get_or_read=True, block_transfer_with_set_or_write=False, block_transfer_with_action=False, multiple_references=True, data_notification=False, access=False, get=True, set=False, selective_access=True, event_notification=False, action=False), server_max_receive_pdu_size=239, negotiated_dlms_version_number=6, negotiated_quality_of_service=0)), implementation_information=None, responding_ap_invocation_id=None, responding_ae_invocation_id=None)
2024-03-21 12:13:18 [debug    ] DLMS state transitioned        new_state=READY old_state=AWAITING_ASSOCIATION_RESPONSE



 DISCONNECTING CLIENT



2024-03-21 12:13:18 [debug    ] DLMS state transitioned        new_state=AWAITING_RELEASE_RESPONSE old_state=READY
2024-03-21 12:13:18 [debug    ] Preparing to send DLMS Request request=ReleaseRequest(reason=<ReleaseRequestReason.NORMAL: 0>, user_information=UserInformation(content=InitiateRequest(proposed_conformance=Conformance(general_protection=False, general_block_transfer=False, delta_value_encoding=False, attribute_0_supported_with_set=False, priority_management_supported=True, attribute_0_supported_with_get=False, block_transfer_with_get_or_read=True, block_transfer_with_set_or_write=False, block_transfer_with_action=False, multiple_references=True, data_notification=False, access=False, get=True, set=False, selective_access=True, event_notification=False, action=False), proposed_quality_of_service=None, client_max_receive_pdu_size=239, proposed_dlms_version_number=6, response_allowed=True, dedicated_key=None)))
2024-03-21 12:13:18 [info     ] Sending DLMS Request           request=ReleaseRequest(reason=<ReleaseRequestReason.NORMAL: 0>, user_information=UserInformation(content=InitiateRequest(proposed_conformance=Conformance(general_protection=False, general_block_transfer=False, delta_value_encoding=False, attribute_0_supported_with_set=False, priority_management_supported=True, attribute_0_supported_with_get=False, block_transfer_with_get_or_read=True, block_transfer_with_set_or_write=False, block_transfer_with_action=False, multiple_references=True, data_notification=False, access=False, get=True, set=False, selective_access=True, event_notification=False, action=False), proposed_quality_of_service=None, client_max_receive_pdu_size=239, proposed_dlms_version_number=6, response_allowed=True, dedicated_key=None)))
2024-03-21 12:13:18 [info     ] Sending HDLC frame             frame=InformationFrame(destination_address=HdlcAddress(logical_address=1, physical_address=2836, address_type='server', extended_addressing=True), source_address=HdlcAddress(logical_address=16, physical_address=None, address_type='client', extended_addressing=True), payload=bytearray(b'\xe6\xe6\x00b\x15\x80\x01\x00\xbe\x10\x04\x0e\x01\x00\x00\x00\x06_\x1f\x04\x00\x00R\x14\x00\xef'), segmented=False, final=True, send_sequence_number=1, receive_sequence_number=1)
2024-03-21 12:13:18 [debug    ] HDLC state transitioned        new_state=AWAITING_RESPONSE old_state=IDLE
2024-03-21 12:13:18 [debug    ] Sending data                   data=b'~\xa0&\x00\x02,)!2\x9f|\xe6\xe6\x00b\x15\x80\x01\x00\xbe\x10\x04\x0e\x01\x00\x00\x00\x06_\x1f\x04\x00\x00R\x14\x00\xefH\xbe~' transport=HdlcTransport(client_logical_address=16, server_logical_address=1, io=SerialIO(port_name='COM8', baud_rate=9600, timeout=1, serial_port=Serial<id=0x1a93f8478b0, open=True>(port='COM8', baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=1, xonxoff=False, rtscts=False, dsrdtr=False)), server_physical_address=2836, client_physical_address=None, extended_addressing=True, timeout=1, hdlc_connection=HdlcConnection(client_address=HdlcAddress(logical_address=1, physical_address=2836, address_type='server', extended_addressing=True), server_address=HdlcAddress(logical_address=16, physical_address=None, address_type='client', extended_addressing=True), client_ssn=1, client_rsn=2, server_ssn=2, server_rsn=1, max_data_size=128, state=HdlcConnectionState(current_state=AWAITING_RESPONSE), buffer=bytearray(b''), buffer_search_position=1), _send_buffer=[], out_buffer=bytearray(b''), in_buffer=bytearray(b''))
2024-03-21 12:13:18 [debug    ] Received data                  data=b'~\xa0&!\x00\x02,)R6^\xe6\xe7\x00c\x15\x80\x01\x00\xbe\x10\x04\x0e\x08\x00\x06_\x1f\x04\x00\x00R\x14\x00\xef\x00\x07\xbbT~' transport=HdlcTransport(client_logical_address=16, server_logical_address=1, io=SerialIO(port_name='COM8', baud_rate=9600, timeout=1, serial_port=Serial<id=0x1a93f8478b0, open=True>(port='COM8', baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=1, xonxoff=False, rtscts=False, dsrdtr=False)), server_physical_address=2836, client_physical_address=None, extended_addressing=True, timeout=1, hdlc_connection=HdlcConnection(client_address=HdlcAddress(logical_address=1, physical_address=2836, address_type='server', extended_addressing=True), server_address=HdlcAddress(logical_address=16, physical_address=None, address_type='client', extended_addressing=True), client_ssn=1, client_rsn=2, server_ssn=2, server_rsn=1, max_data_size=128, state=HdlcConnectionState(current_state=AWAITING_RESPONSE), buffer=bytearray(b''), buffer_search_position=1), _send_buffer=[], out_buffer=bytearray(b''), in_buffer=bytearray(b''))
2024-03-21 12:13:18 [debug    ] Added data to buffer           data=b'~\xa0&!\x00\x02,)R6^\xe6\xe7\x00c\x15\x80\x01\x00\xbe\x10\x04\x0e\x08\x00\x06_\x1f\x04\x00\x00R\x14\x00\xef\x00\x07\xbbT~'
2024-03-21 12:13:18 [debug    ] Received HDLC frame            frame=InformationFrame(destination_address=HdlcAddress(logical_address=16, physical_address=None, address_type='client', extended_addressing=False), source_address=HdlcAddress(logical_address=1, physical_address=2836, address_type='server', extended_addressing=True), payload=bytearray(b'\xe6\xe7\x00c\x15\x80\x01\x00\xbe\x10\x04\x0e\x08\x00\x06_\x1f\x04\x00\x00R\x14\x00\xef\x00\x07'), segmented=False, final=True, send_sequence_number=1, receive_sequence_number=2)
2024-03-21 12:13:18 [debug    ] HDLC state transitioned        new_state=IDLE old_state=AWAITING_RESPONSE
2024-03-21 12:13:18 [debug    ] Adding data to buffer          data=bytearray(b'c\x15\x80\x01\x00\xbe\x10\x04\x0e\x08\x00\x06_\x1f\x04\x00\x00R\x14\x00\xef\x00\x07')
2024-03-21 12:13:18 [info     ] Received DLMS Response         response=ReleaseResponse(reason=<ReleaseResponseReason.NORMAL: 0>, user_information=UserInformation(content=InitiateResponse(negotiated_conformance=Conformance(general_protection=False, general_block_transfer=False, delta_value_encoding=False, attribute_0_supported_with_set=False, priority_management_supported=True, attribute_0_supported_with_get=False, block_transfer_with_get_or_read=True, block_transfer_with_set_or_write=False, block_transfer_with_action=False, multiple_references=True, data_notification=False, access=False, get=True, set=False, selective_access=True, event_notification=False, action=False), server_max_receive_pdu_size=239, negotiated_dlms_version_number=6, negotiated_quality_of_service=0)))
2024-03-21 12:13:18 [debug    ] DLMS state transitioned        new_state=NO_ASSOCIATION old_state=AWAITING_RELEASE_RESPONSE
2024-03-21 12:13:18 [debug    ] HDLC state transitioned        new_state=AWAITING_DISCONNECT old_state=IDLE
2024-03-21 12:13:18 [debug    ] Sending data                   data=bytearray(b'~\xa0\n\x00\x02,)!S\t\xdc~') transport=HdlcTransport(client_logical_address=16, server_logical_address=1, io=SerialIO(port_name='COM8', baud_rate=9600, timeout=1, serial_port=Serial<id=0x1a93f8478b0, open=True>(port='COM8', baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=1, xonxoff=False, rtscts=False, dsrdtr=False)), server_physical_address=2836, client_physical_address=None, extended_addressing=True, timeout=1, hdlc_connection=HdlcConnection(client_address=HdlcAddress(logical_address=1, physical_address=2836, address_type='server', extended_addressing=True), server_address=HdlcAddress(logical_address=16, physical_address=None, address_type='client', extended_addressing=True), client_ssn=2, client_rsn=2, server_ssn=2, server_rsn=2, max_data_size=128, state=HdlcConnectionState(current_state=AWAITING_DISCONNECT), buffer=bytearray(b''), buffer_search_position=1), _send_buffer=[], out_buffer=bytearray(b''), in_buffer=bytearray(b''))
2024-03-21 12:13:18 [debug    ] Received data                  data=b'~\xa0\n!\x00\x02,)s\xa4\xbc~' transport=HdlcTransport(client_logical_address=16, server_logical_address=1, io=SerialIO(port_name='COM8', baud_rate=9600, timeout=1, serial_port=Serial<id=0x1a93f8478b0, open=True>(port='COM8', baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=1, xonxoff=False, rtscts=False, dsrdtr=False)), server_physical_address=2836, client_physical_address=None, extended_addressing=True, timeout=1, hdlc_connection=HdlcConnection(client_address=HdlcAddress(logical_address=1, physical_address=2836, address_type='server', extended_addressing=True), server_address=HdlcAddress(logical_address=16, physical_address=None, address_type='client', extended_addressing=True), client_ssn=2, client_rsn=2, server_ssn=2, server_rsn=2, max_data_size=128, state=HdlcConnectionState(current_state=AWAITING_DISCONNECT), buffer=bytearray(b''), buffer_search_position=1), _send_buffer=[], out_buffer=bytearray(b''), in_buffer=bytearray(b''))
2024-03-21 12:13:18 [debug    ] Added data to buffer           data=b'~\xa0\n!\x00\x02,)s\xa4\xbc~'
2024-03-21 12:13:18 [debug    ] Received HDLC frame            frame=UnNumberedAcknowledgmentFrame(destination_address=HdlcAddress(logical_address=16, physical_address=None, address_type='client', extended_addressing=False), source_address=HdlcAddress(logical_address=1, physical_address=2836, address_type='server', extended_addressing=True), payload=bytearray(b''), segmented=False, final=True)
2024-03-21 12:13:18 [debug    ] HDLC state transitioned        new_state=NOT_CONNECTED old_state=AWAITING_DISCONNECT



 CONNECTING MANAGEMENT



2024-03-21 12:13:18 [debug    ] HDLC state transitioned        new_state=AWAITING_CONNECTION old_state=NOT_CONNECTED
2024-03-21 12:13:18 [debug    ] Sending data                   data=bytearray(b'~\xa0\n\x00\x02,)\x03\x93\x86\n~') transport=HdlcTransport(client_logical_address=1, server_logical_address=1, io=SerialIO(port_name='COM8', baud_rate=9600, timeout=1, serial_port=Serial<id=0x1a93f97e950, open=True>(port='COM8', baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=1, xonxoff=False, rtscts=False, dsrdtr=False)), server_physical_address=2836, client_physical_address=None, extended_addressing=True, timeout=1, hdlc_connection=HdlcConnection(client_address=HdlcAddress(logical_address=1, physical_address=2836, address_type='server', extended_addressing=True), server_address=HdlcAddress(logical_address=1, physical_address=None, address_type='client', extended_addressing=True), client_ssn=2, client_rsn=2, server_ssn=2, server_rsn=2, max_data_size=128, state=HdlcConnectionState(current_state=AWAITING_CONNECTION), buffer=bytearray(b''), buffer_search_position=1), _send_buffer=[], out_buffer=bytearray(b''), in_buffer=bytearray(b''))
2024-03-21 12:13:18 [debug    ] Received data                  data=b'~\xa0#\x03\x00\x02,)s(\x13\x81\x80\x14\x05\x02\x00\xf2\x06\x02\x00\xf2\x07\x04\x00\x00\x00\x01\x08\x04\x00\x00\x00\x01\x0c\xf7~' transport=HdlcTransport(client_logical_address=1, server_logical_address=1, io=SerialIO(port_name='COM8', baud_rate=9600, timeout=1, serial_port=Serial<id=0x1a93f97e950, open=True>(port='COM8', baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=1, xonxoff=False, rtscts=False, dsrdtr=False)), server_physical_address=2836, client_physical_address=None, extended_addressing=True, timeout=1, hdlc_connection=HdlcConnection(client_address=HdlcAddress(logical_address=1, physical_address=2836, address_type='server', extended_addressing=True), server_address=HdlcAddress(logical_address=1, physical_address=None, address_type='client', extended_addressing=True), client_ssn=2, client_rsn=2, server_ssn=2, server_rsn=2, max_data_size=128, state=HdlcConnectionState(current_state=AWAITING_CONNECTION), buffer=bytearray(b''), buffer_search_position=1), _send_buffer=[], out_buffer=bytearray(b''), in_buffer=bytearray(b''))
2024-03-21 12:13:18 [debug    ] Added data to buffer           data=b'~\xa0#\x03\x00\x02,)s(\x13\x81\x80\x14\x05\x02\x00\xf2\x06\x02\x00\xf2\x07\x04\x00\x00\x00\x01\x08\x04\x00\x00\x00\x01\x0c\xf7~'
2024-03-21 12:13:18 [debug    ] Received HDLC frame            frame=UnNumberedAcknowledgmentFrame(destination_address=HdlcAddress(logical_address=1, physical_address=None, address_type='client', extended_addressing=False), source_address=HdlcAddress(logical_address=1, physical_address=2836, address_type='server', extended_addressing=True), payload=bytearray(b'\x81\x80\x14\x05\x02\x00\xf2\x06\x02\x00\xf2\x07\x04\x00\x00\x00\x01\x08\x04\x00\x00\x00\x01'), segmented=False, final=True)
2024-03-21 12:13:18 [debug    ] HDLC state transitioned        new_state=IDLE old_state=AWAITING_CONNECTION
2024-03-21 12:13:18 [debug    ] DLMS state transitioned        new_state=AWAITING_ASSOCIATION_RESPONSE old_state=NO_ASSOCIATION
2024-03-21 12:13:18 [debug    ] Preparing to send DLMS Request request=ApplicationAssociationRequest(user_information=UserInformation(content=InitiateRequest(proposed_conformance=Conformance(general_protection=False, general_block_transfer=False, delta_value_encoding=False, attribute_0_supported_with_set=False, priority_management_supported=True, attribute_0_supported_with_get=False, block_transfer_with_get_or_read=True, block_transfer_with_set_or_write=False, block_transfer_with_action=False, multiple_references=True, data_notification=False, access=False, get=True, set=True, selective_access=True, event_notification=False, action=True), proposed_quality_of_service=None, client_max_receive_pdu_size=239, proposed_dlms_version_number=6, response_allowed=True, dedicated_key=None)), system_title=b'uti\xc8.\x8c7\x84', public_cert=None, authentication=<AuthenticationMechanism.LLS: 1>, ciphered=False, authentication_value=b'12345678', calling_ae_invocation_identifier=None, called_ap_title=None, called_ae_qualifier=None, called_ap_invocation_identifier=None, called_ae_invocation_identifier=None, calling_ap_invocation_identifier=None, implementation_information=None)
2024-03-21 12:13:18 [info     ] Sending DLMS Request           request=ApplicationAssociationRequest(user_information=UserInformation(content=InitiateRequest(proposed_conformance=Conformance(general_protection=False, general_block_transfer=False, delta_value_encoding=False, attribute_0_supported_with_set=False, priority_management_supported=True, attribute_0_supported_with_get=False, block_transfer_with_get_or_read=True, block_transfer_with_set_or_write=False, block_transfer_with_action=False, multiple_references=True, data_notification=False, access=False, get=True, set=True, selective_access=True, event_notification=False, action=True), proposed_quality_of_service=None, client_max_receive_pdu_size=239, proposed_dlms_version_number=6, response_allowed=True, dedicated_key=None)), system_title=b'uti\xc8.\x8c7\x84', public_cert=None, authentication=<AuthenticationMechanism.LLS: 1>, ciphered=False, authentication_value=b'12345678', calling_ae_invocation_identifier=None, called_ap_title=None, called_ae_qualifier=None, called_ap_invocation_identifier=None, called_ae_invocation_identifier=None, calling_ap_invocation_identifier=None, implementation_information=None)
2024-03-21 12:13:18 [info     ] Sending HDLC frame             frame=InformationFrame(destination_address=HdlcAddress(logical_address=1, physical_address=2836, address_type='server', extended_addressing=True), source_address=HdlcAddress(logical_address=1, physical_address=None, address_type='client', extended_addressing=True), payload=bytearray(b'\xe6\xe6\x00`B\xa1\t\x06\x07`\x85t\x05\x08\x01\x01\xa6\n\x04\x08uti\xc8.\x8c7\x84\x8a\x02\x07\x80\x8b\x07`\x85t\x05\x08\x02\x01\xac\n\x80\x0812345678\xbe\x10\x04\x0e\x01\x00\x00\x00\x06_\x1f\x04\x00\x00R\x1d\x00\xef'), segmented=False, final=True, send_sequence_number=2, receive_sequence_number=2)
2024-03-21 12:13:18 [debug    ] HDLC state transitioned        new_state=AWAITING_RESPONSE old_state=IDLE
2024-03-21 12:13:18 [debug    ] Sending data                   data=b'~\xa0S\x00\x02,)\x03T\xc3\x8b\xe6\xe6\x00`B\xa1\t\x06\x07`\x85t\x05\x08\x01\x01\xa6\n\x04\x08uti\xc8.\x8c7\x84\x8a\x02\x07\x80\x8b\x07`\x85t\x05\x08\x02\x01\xac\n\x80\x0812345678\xbe\x10\x04\x0e\x01\x00\x00\x00\x06_\x1f\x04\x00\x00R\x1d\x00\xef\xb9/~' transport=HdlcTransport(client_logical_address=1, server_logical_address=1, io=SerialIO(port_name='COM8', baud_rate=9600, timeout=1, serial_port=Serial<id=0x1a93f97e950, open=True>(port='COM8', baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=1, xonxoff=False, rtscts=False, dsrdtr=False)), server_physical_address=2836, client_physical_address=None, extended_addressing=True, timeout=1, hdlc_connection=HdlcConnection(client_address=HdlcAddress(logical_address=1, physical_address=2836, address_type='server', extended_addressing=True), server_address=HdlcAddress(logical_address=1, physical_address=None, address_type='client', extended_addressing=True), client_ssn=2, client_rsn=3, server_ssn=3, server_rsn=2, max_data_size=128, state=HdlcConnectionState(current_state=AWAITING_RESPONSE), buffer=bytearray(b''), buffer_search_position=1), _send_buffer=[], out_buffer=bytearray(b''), in_buffer=bytearray(b''))
2024-03-21 12:13:18 [debug    ] Received data                  data=b'~\xa0\x0f\x03\x00\x02,)\x97\x1b`T\x00\x10t?~' transport=HdlcTransport(client_logical_address=1, server_logical_address=1, io=SerialIO(port_name='COM8', baud_rate=9600, timeout=1, serial_port=Serial<id=0x1a93f97e950, open=True>(port='COM8', baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=1, xonxoff=False, rtscts=False, dsrdtr=False)), server_physical_address=2836, client_physical_address=None, extended_addressing=True, timeout=1, hdlc_connection=HdlcConnection(client_address=HdlcAddress(logical_address=1, physical_address=2836, address_type='server', extended_addressing=True), server_address=HdlcAddress(logical_address=1, physical_address=None, address_type='client', extended_addressing=True), client_ssn=2, client_rsn=3, server_ssn=3, server_rsn=2, max_data_size=128, state=HdlcConnectionState(current_state=AWAITING_RESPONSE), buffer=bytearray(b''), buffer_search_position=1), _send_buffer=[], out_buffer=bytearray(b''), in_buffer=bytearray(b''))
2024-03-21 12:13:18 [debug    ] Added data to buffer           data=b'~\xa0\x0f\x03\x00\x02,)\x97\x1b`T\x00\x10t?~'
2024-03-21 12:13:18 [debug    ] HDLC frame could not be parsed. Need more data
2024-03-21 12:13:19 [debug    ] Received data                  data=b'' transport=HdlcTransport(client_logical_address=1, server_logical_address=1, io=SerialIO(port_name='COM8', baud_rate=9600, timeout=1, serial_port=Serial<id=0x1a93f97e950, open=True>(port='COM8', baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=1, xonxoff=False, rtscts=False, dsrdtr=False)), server_physical_address=2836, client_physical_address=None, extended_addressing=True, timeout=1, hdlc_connection=HdlcConnection(client_address=HdlcAddress(logical_address=1, physical_address=2836, address_type='server', extended_addressing=True), server_address=HdlcAddress(logical_address=1, physical_address=None, address_type='client', extended_addressing=True), client_ssn=2, client_rsn=3, server_ssn=3, server_rsn=2, max_data_size=128, state=HdlcConnectionState(current_state=AWAITING_RESPONSE), buffer=bytearray(b'~\xa0\x0f\x03\x00\x02,)\x97\x1b`T\x00\x10t?~'), buffer_search_position=17), _send_buffer=[], out_buffer=bytearray(b''), in_buffer=bytearray(b''))
2024-03-21 12:13:20 [debug    ] Received data                  data=b''
@Krolken
Copy link
Contributor

Krolken commented Mar 21, 2024

Hmm. I am not really sure what is happening.

b'~\xa0\x0f\x03\x00\x02,)\x97\x1bT\x00\x10t?~'` does not seem to be a valid response.

For UnNumberedAcknowledgmentFrame it gives HCS error
For UnnumberedInformationFrame it gives HCS error

So I am not sure what the meter is responding with.

My normal problems when switching between clients is that some meters modems hangs on disconnect. It is usually not a problem to not call .disconnect and reuse the same IO on all clients. So connect the serial port once and just send it to the different transports so that the serial port never closes.

@huebrick
Copy link
Author

I'm thinking its probably on the side of my code than on the side of the meter because this will happen even if I wait for a few seconds between every operation, and if I just stop the code and run it again it connects to the management client instantly.
Question is what has changed in the code between connecting first time as management and then switching to public that would mess up the communication when coming back to management.

Also I have tried keeping the same IO but then I get the same thing on the Public client. I could maybe rewrite the code to basically release the association and then redefine the management client with a different address(logical_address=16) and then associate again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants