def knx2_to_float(knxdata):
    """Convert a KNX 2 byte float object to a float"""
    if len(knxdata) != 2:
        raise KNXException("Can only convert a 2 Byte object to float")

    data = knxdata[0] * 256 + knxdata[1]
    sign = data >> 15
    exponent = (data >> 11) & 0x0f
    mantisse = float(data & 0x7ff)
    if sign == 1:
        mantisse = -2048 + mantisse

    return mantisse * pow(2, exponent) / 100
def knx2_to_float ( knxdata ) : if len ( knxdata ) != 2 : raise KNXException ( "Can only convert a 2 Byte object to float" ) data = knxdata [ 0 ] * 256 + knxdata [ 1 ] sign = data >> 15 exponent = ( data >> 11 ) & 0x0f mantisse = float ( data & 0x7ff ) if sign == 1 : mantisse = - 2048 + mantisse return mantisse * pow ( 2 , exponent ) / 100
Convert a KNX 2 byte float object to a float