'Send set lock state command.'

def set_lock_state(self, code, state):

    lock_state = ('lock' if (state == STATE_LOCKED) else 'unlock')
    transaction_id = hub.session.set_lock_state(code, self._device_label, lock_state)['doorLockStateChangeTransactionId']
    _LOGGER.debug('Verisure    doorlock    %s', state)
    transaction = {}
    while ('result' not in transaction):
        sleep(0.5)
        transaction = hub.session.get_lock_state_transaction(transaction_id)
    if (transaction['result'] == 'OK'):
        self._state = state
        self._change_timestamp = time()
