def update(self):
        """Get the Efergy monitor data from the web service."""
        try:
            if self.type == 'instant_readings':
                url_string = _RESOURCE + 'getInstant?token=' + self.app_token
                response = get(url_string)
                self._state = response.json()['reading'] / 1000
            elif self.type == 'budget':
                url_string = _RESOURCE + 'getBudget?token=' + self.app_token
                response = get(url_string)
                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)
                self._state = response.json()['sum']
            else:
                self._state = 'Unknown'
        except (RequestException, __HOLE__, KeyError):
            _LOGGER.warning('Could not update status for %s', self.name)
dataset/ETHPy150Open home-assistant/home-assistant/homeassistant/components/sensor/efergy.py/EfergySensor.update