def __init__(self, resource, location, name, func):
        super().__init__(resource, location, name)
        self._func = func

        request = requests.get('{}/{}'.format(self._resource, self._func),
                               timeout=10)

        if request.status_code is not 200:
            _LOGGER.error("Can't find function. Is device offline?")
            return

        try:
            request.json()['return_value']
        except KeyError:
            _LOGGER.error("No return_value received. "
                          "Is the function name correct.")
        except ValueError:
            _LOGGER.error("Response invalid. Is the function name correct.")
Initialize the switch.
dataset/ETHPy150Open home-assistant/home-assistant/homeassistant/components/switch/arest.py/ArestSwitchFunction.__init__