'Get the Efergy monitor data from the web service.'

def update(self):

    try:
        if (self.type == 'instant_readings'):
            url_string = ((_RESOURCE + 'getInstant?token=') + self.app_token)
            response = get(url_string, timeout=10)
            self._state = response.json()['reading']
        elif (self.type == 'amount'):
            url_string = ((((((_RESOURCE + 'getEnergy?token=') + self.app_token) + '&offset=') + self.utc_offset) + '&period=') + self.period)
            response = get(url_string, timeout=10)
            self._state = response.json()['sum']
        elif (self.type == 'budget'):
            url_string = ((_RESOURCE + 'getBudget?token=') + self.app_token)
            response = get(url_string, timeout=10)
            self._state = response.json()['status']
        elif (self.type == 'cost'):
            url_string = ((((((_RESOURCE + 'getCost?token=') + self.app_token) + '&offset=') + self.utc_offset) + '&period=') + self.period)
            response = get(url_string, timeout=10)
            self._state = response.json()['sum']
        elif (self.type == 'current_values'):
            url_string = ((_RESOURCE + 'getCurrentValuesSummary?token=') + self.app_token)
            response = get(url_string, timeout=10)
            for sensor in response.json():
                if (self.sid == sensor['sid']):
                    measurement = next(iter(sensor['data'][0].values()))
                    self._state = measurement
        else:
            self._state = 'Unknown'
    except (RequestException, ValueError, KeyError):
        _LOGGER.warning('Could    not    update    status    for    %s', self.name)
