'Get the latest data from NetAtmo API and updates the states.'

def update(self):

    self.netatmo_data.update()
    data = self.netatmo_data.data.get(self.module_name)
    if (data is None):
        _LOGGER.warning('No    data    found    for    %s', self.module_name)
        self._state = STATE_UNKNOWN
        return
    if (self.type == 'temperature'):
        self._state = round(data['Temperature'], 1)
    elif (self.type == 'humidity'):
        self._state = data['Humidity']
    elif (self.type == 'rain'):
        self._state = data['Rain']
    elif (self.type == 'sum_rain_1'):
        self._state = data['sum_rain_1']
    elif (self.type == 'sum_rain_24'):
        self._state = data['sum_rain_24']
    elif (self.type == 'noise'):
        self._state = data['Noise']
    elif (self.type == 'co2'):
        self._state = data['CO2']
    elif (self.type == 'pressure'):
        self._state = round(data['Pressure'], 1)
    elif (self.type == 'battery_lvl'):
        self._state = data['battery_vp']
    elif ((self.type == 'battery_vp') and (self.module_id == '6')):
        if (data['battery_vp'] >= 5590):
            self._state = 'Full'
        elif (data['battery_vp'] >= 5180):
            self._state = 'High'
        elif (data['battery_vp'] >= 4770):
            self._state = 'Medium'
        elif (data['battery_vp'] >= 4360):
            self._state = 'Low'
        elif (data['battery_vp'] < 4360):
            self._state = 'Very    Low'
    elif ((self.type == 'battery_vp') and (self.module_id == '5')):
        if (data['battery_vp'] >= 5500):
            self._state = 'Full'
        elif (data['battery_vp'] >= 5000):
            self._state = 'High'
        elif (data['battery_vp'] >= 4500):
            self._state = 'Medium'
        elif (data['battery_vp'] >= 4000):
            self._state = 'Low'
        elif (data['battery_vp'] < 4000):
            self._state = 'Very    Low'
    elif ((self.type == 'battery_vp') and (self.module_id == '3')):
        if (data['battery_vp'] >= 5640):
            self._state = 'Full'
        elif (data['battery_vp'] >= 5280):
            self._state = 'High'
        elif (data['battery_vp'] >= 4920):
            self._state = 'Medium'
        elif (data['battery_vp'] >= 4560):
            self._state = 'Low'
        elif (data['battery_vp'] < 4560):
            self._state = 'Very    Low'
    elif ((self.type == 'battery_vp') and (self.module_id == '2')):
        if (data['battery_vp'] >= 5500):
            self._state = 'Full'
        elif (data['battery_vp'] >= 5000):
            self._state = 'High'
        elif (data['battery_vp'] >= 4500):
            self._state = 'Medium'
        elif (data['battery_vp'] >= 4000):
            self._state = 'Low'
        elif (data['battery_vp'] < 4000):
            self._state = 'Very    Low'
    elif (self.type == 'min_temp'):
        self._state = data['min_temp']
    elif (self.type == 'max_temp'):
        self._state = data['max_temp']
    elif (self.type == 'windangle_value'):
        self._state = data['WindAngle']
    elif (self.type == 'windangle'):
        if (data['WindAngle'] >= 330):
            self._state = ('N    (%d\xb0)' % data['WindAngle'])
        elif (data['WindAngle'] >= 300):
            self._state = ('NW    (%d\xb0)' % data['WindAngle'])
        elif (data['WindAngle'] >= 240):
            self._state = ('W    (%d\xb0)' % data['WindAngle'])
        elif (data['WindAngle'] >= 210):
            self._state = ('SW    (%d\xb0)' % data['WindAngle'])
        elif (data['WindAngle'] >= 150):
            self._state = ('S    (%d\xb0)' % data['WindAngle'])
        elif (data['WindAngle'] >= 120):
            self._state = ('SE    (%d\xb0)' % data['WindAngle'])
        elif (data['WindAngle'] >= 60):
            self._state = ('E    (%d\xb0)' % data['WindAngle'])
        elif (data['WindAngle'] >= 30):
            self._state = ('NE    (%d\xb0)' % data['WindAngle'])
        elif (data['WindAngle'] >= 0):
            self._state = ('N    (%d\xb0)' % data['WindAngle'])
    elif (self.type == 'windstrength'):
        self._state = data['WindStrength']
    elif (self.type == 'gustangle_value'):
        self._state = data['GustAngle']
    elif (self.type == 'gustangle'):
        if (data['GustAngle'] >= 330):
            self._state = ('N    (%d\xb0)' % data['GustAngle'])
        elif (data['GustAngle'] >= 300):
            self._state = ('NW    (%d\xb0)' % data['GustAngle'])
        elif (data['GustAngle'] >= 240):
            self._state = ('W    (%d\xb0)' % data['GustAngle'])
        elif (data['GustAngle'] >= 210):
            self._state = ('SW    (%d\xb0)' % data['GustAngle'])
        elif (data['GustAngle'] >= 150):
            self._state = ('S    (%d\xb0)' % data['GustAngle'])
        elif (data['GustAngle'] >= 120):
            self._state = ('SE    (%d\xb0)' % data['GustAngle'])
        elif (data['GustAngle'] >= 60):
            self._state = ('E    (%d\xb0)' % data['GustAngle'])
        elif (data['GustAngle'] >= 30):
            self._state = ('NE    (%d\xb0)' % data['GustAngle'])
        elif (data['GustAngle'] >= 0):
            self._state = ('N    (%d\xb0)' % data['GustAngle'])
    elif (self.type == 'guststrength'):
        self._state = data['GustStrength']
    elif (self.type == 'rf_status_lvl'):
        self._state = data['rf_status']
    elif (self.type == 'rf_status'):
        if (data['rf_status'] >= 90):
            self._state = 'Low'
        elif (data['rf_status'] >= 76):
            self._state = 'Medium'
        elif (data['rf_status'] >= 60):
            self._state = 'High'
        elif (data['rf_status'] <= 59):
            self._state = 'Full'
    elif (self.type == 'wifi_status_lvl'):
        self._state = data['wifi_status']
    elif (self.type == 'wifi_status'):
        if (data['wifi_status'] >= 86):
            self._state = 'Low'
        elif (data['wifi_status'] >= 71):
            self._state = 'Medium'
        elif (data['wifi_status'] >= 56):
            self._state = 'High'
        elif (data['wifi_status'] <= 55):
            self._state = 'Full'
