'Switch on or off.'

def _switch(self, newstate):

    _LOGGER.info('Switching    to    state:    %s', newstate)
    try:
        req = requests.get('{}?set={}'.format(self._url, newstate), auth=self._auth, timeout=5)
        return req.json()['ok']
    except requests.RequestException:
        _LOGGER.error('Switching    failed')
