Sets response

def set_command_response_from_cache(self, response, device_id, command, command2):
        """Sets response"""
        if not device_id:
            return False

        key = self.create_key_from_command(command, command2)
        ttl = int(time()) + CACHE_TTL

        command_cache = self.get_cache_from_file(device_id)

        if device_id not in command_cache:
            command_cache[device_id] = {}

        command_cache[device_id][key] = {'ttl': ttl, 'response': response}

        self.write_cache_file(command_cache, device_id)