def __init__(self, arest, resource, location, name, variable=None,
                 pin=None, unit_of_measurement=None, renderer=None):
        self.arest = arest
        self._resource = resource
        self._name = '{} {}'.format(location.title(), name.title()) \
                     or DEVICE_DEFAULT_NAME
        self._variable = variable
        self._pin = pin
        self._state = 'n/a'
        self._unit_of_measurement = unit_of_measurement
        self._renderer = renderer
        self.update()

        if self._pin is not None:
            request = requests.get('{}/mode/{}/i'.format
                                   (self._resource, self._pin), timeout=10)
            if request.status_code is not 200:
                _LOGGER.error("Can't set mode. Is device offline?")
Initialize the sensor.
dataset/ETHPy150Open home-assistant/home-assistant/homeassistant/components/sensor/arest.py/ArestSensor.__init__