import struct


def parse_aurinkopenkki(hex_str, port=None):
    """
    Parse payload like "3a2c0000018906438046933f478a773cc82a00003501000000000000113b00002f000000" float values
    :param hex_str: EnergiaBurk hex payload
    :param port: LoRaWAN port
    :return: dict containing float values
    """
    b = bytes.fromhex(hex_str)
    val = struct.unpack('<BbxxfffIIIII', b)

    #struct t_AcudcDATA { 
    # uint8_t msg_type;
    # uint8_t msg_ver;
    # float volt;
    # float amp;
    # float watt;
    # uint32_t runTime;
    # uint32_t inEnergy;
    # uint32_t outEnergy;
    # uint32_t inAh;
    # uint32_t outAh;
    
    data = {
        'voltage': val[2],
        'current': val[3],
        'power': val[4],
        'runtime': val[5],
        'inEnergy': val[6],
        'outEnergy': val[7],
        'inmAh': val[8],
        'outmAh': val[9],
    }
    return data