'Get the latest data from aREST API and update the state.'

def update(self):

    try:
        request = requests.get('{}/digital/{}'.format(self._resource, self._pin), timeout=10)
        self._state = (request.json()['return_value'] != 0)
        self._available = True
    except requests.exceptions.ConnectionError:
        _LOGGER.warning('No    route    to    device    %s', self._resource)
        self._available = False
