'Parse battery level data sent by gateway.'

def parse_voltage(self, data):

    if ('voltage' not in data):
        return False
    max_volt = 3300
    min_volt = 2800
    voltage = data['voltage']
    voltage = min(voltage, max_volt)
    voltage = max(voltage, min_volt)
    percent = (((voltage - min_volt) / (max_volt - min_volt)) * 100)
    self._device_state_attributes[ATTR_BATTERY_LEVEL] = round(percent, 1)
    return True
