

def update(self):
    'Update state of sensor.'
    try:
        value.api.update()
    except requests.exceptions.ConnectionError:
        return
    if (self.api.status is None):
        _LOGGER.debug('update of %s requested, but no status is available', self._name)
        return
    value = self.api.status.get(self.type)
    if (value is None):
        _LOGGER.warning('unable to locate value for %s', self.type)
        return
    if (('DownloadRate' in self.type) and (value > 0)):
        self._state = ((value / 1024) / 1024)
    else:
        self._state = value

dataset/ETHPy150Open home-assistant/home-assistant/homeassistant/components/sensor/nzbget.py NZBGetSensor.update/VarMisuse@16/26 `self`->`value`