@JavaScriptMethod
    public boolean toggleDemoMode() {
        CiLightGlobalConfiguration config = CiLightGlobalConfiguration.get();
        List<Endpoint> endpoints = config.getEndpoints();
        for (Endpoint endpoint : endpoints) {
            try {
                if (demoModeEnabled) {
                    sendDemoCommand(endpoint, DemoCommand.DISABLE_DEMO_MODE);
                } else {
                    sendDemoCommand(endpoint, DemoCommand.ENABLE_DEMO_MODE);
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        demoModeEnabled = !demoModeEnabled;
        return demoModeEnabled;
    }