def update(self):
        try:
            self.api.update()
        except requests.exceptions.ConnectionError:
            # Error calling the api, already logged in api.update()
            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:
            # Convert download rate from bytes/s to mb/s
            self._state = value / 1024 / 1024
        else:
            self._state = value
Update state of sensor.
dataset/ETHPy150Open home-assistant/home-assistant/homeassistant/components/sensor/nzbget.py/NZBGetSensor.update