@staticmethod
def format_packet(cmd_str, param_str=''):
    """Format packet to be sent."""
    head_str = '55aa'
    id_str = '00'
    cmd_int = int(cmd_str, 16)
    param_int = 0
    for b in range(int(len(param_str) / 2)):
        param_int = param_int + int(param_str[2 * b:2 * b + 2], 16)
    length_int = len(bytes.fromhex(id_str + cmd_str + param_str))
    length_str = length_int.to_bytes(2, 'big').hex()
    checksum_int = cmd_int + param_int + length_int
    checksum_str = checksum_int.to_bytes(2, 'big').hex()[2:]
    formated_cmd = (
        f'{head_str}{length_str}{id_str}{cmd_str}{param_str}{checksum_str}')
    return bytes.fromhex(formated_cmd)
