@Throttle(MIN_TIME_BETWEEN_UPDATES)
    def update(self):
        try:
            if self._pin is None:
                response = requests.get(self._resource, timeout=10)
                self.data = response.json()['variables']
            else:
                try:
                    if str(self._pin[0]) == 'A':
                        response = requests.get('{}/analog/{}'.format(
                            self._resource, self._pin[1:]), timeout=10)
                        self.data = {'value': response.json()['return_value']}
                    else:
                        _LOGGER.error("Wrong pin naming. "
                                      "Please check your configuration file.")
                except TypeError:
                    response = requests.get('{}/digital/{}'.format(
                        self._resource, self._pin), timeout=10)
                    self.data = {'value': response.json()['return_value']}
        except requests.exceptions.ConnectionError:
            _LOGGER.error("No route to device %s. Is device offline?",
                          self._resource)
            self.data = {'error': 'error fetching'}
Get the latest data from aREST device.
dataset/ETHPy150Open home-assistant/home-assistant/homeassistant/components/sensor/arest.py/ArestData.update