Generic function for sending commands to Alarm.com

        :param event: Event command to send to alarm.com

def _send(self, event):
        """Generic function for sending commands to Alarm.com

        :param event: Event command to send to alarm.com
        """
        _LOGGER.debug('Sending %s to Alarm.com', event)

        try:
            with async_timeout.timeout(10, loop=self._loop):
                response = yield from self._websession.post(
                    self.ALARMDOTCOM_URL + '{}/main.aspx'.format(
                        self._login_info['sessionkey']),
                    data={
                        self.VIEWSTATE: '',
                        self.VIEWSTATEENCRYPTED: '',
                        self.EVENTVALIDATION:
                            self.COMMAND_LIST[event]['eventvalidation'],
                        self.COMMAND_LIST[event]['command']: event},
                    headers={'User-Agent': 'Mozilla/5.0 '
                                           '(Windows NT 6.1; '
                                           'WOW64; rv:40.0) '
                                           'Gecko/20100101 '
                                           'Firefox/40.1'}
                )

                _LOGGER.debug(
                    'Response from Alarm.com %s', response.status)
                text = yield from response.text()
                tree = BeautifulSoup(text, 'html.parser')
                try:
                    message = tree.select(
                        '#{}'.format(self.MESSAGE_CONTROL))[0].get_text()
                    if 'command' in message:
                        _LOGGER.debug(message)
                        # Update alarm.com status after calling state change.
                        yield from self.async_update()
                except IndexError:
                    # May have been logged out
                    yield from self.async_login()
                    if event == 'Disarm':
                        yield from self.async_alarm_disarm()
                    elif event == 'Arm+Stay':
                        yield from self.async_alarm_arm_away()
                    elif event == 'Arm+Away':
                        yield from self.async_alarm_arm_away()

        except (asyncio.TimeoutError, aiohttp.ClientError):
            _LOGGER.error('Error while trying to disarm Alarm.com system')
        finally:
            if response is not None:
                yield from response.release()