 char   MQTT_TOPIC_PREFIX[32];
 
 // MQTT topics
-char   ARILUX_MQTT_STATE_STATE_TOPIC[44];
-char   ARILUX_MQTT_STATE_COMMAND_TOPIC[44];
-char   ARILUX_MQTT_BRIGHTNESS_STATE_TOPIC[44];
-char   ARILUX_MQTT_BRIGHTNESS_COMMAND_TOPIC[44];
-char   ARILUX_MQTT_COLOR_STATE_TOPIC[44];
-char   ARILUX_MQTT_COLOR_COMMAND_TOPIC[44];
 char   ARILUX_MQTT_STATUS_TOPIC[44];
 #ifdef HOME_ASSISTANT_MQTT_DISCOVERY
   char   HOME_ASSISTANT_MQTT_DISCOVERY_TOPIC[56];

        flashSuccess(false);
      }

      subscribeToMQTTTopic(ARILUX_MQTT_STATE_COMMAND_TOPIC);
      subscribeToMQTTTopic(ARILUX_MQTT_BRIGHTNESS_COMMAND_TOPIC);
      subscribeToMQTTTopic(ARILUX_MQTT_COLOR_COMMAND_TOPIC);

#if defined(RGBW) || defined (RGBWW)
      subscribeToMQTTTopic(ARILUX_MQTT_WHITE_COMMAND_TOPIC);
#endif

#ifdef JSON
      subscribeToMQTTTopic(ARILUX_MQTT_JSON_COMMAND_TOPIC);
#endif

      lastmqttreconnect = millis();

      root["color"]["b"] = arilux.getBlueValue();
      root.printTo(outgoingJsonBuffer);
      publishToMQTT(ARILUX_MQTT_JSON_STATE_TOPIC, outgoingJsonBuffer);
  };
  #else
    switch (cmd) {
      case ARILUX_CMD_NOT_DEFINED:
        break;
      case ARILUX_CMD_STATE_CHANGED:
        publishStateChange();
        break;
      case ARILUX_CMD_BRIGHTNESS_CHANGED:
        publishBrightnessChange();
        break;
      case ARILUX_CMD_COLOR_CHANGED:
        publishColorChange();
        break;
      case ARILUX_CMD_WHITE_CHANGED:
        publishWhiteChange();
        break;
      default:
        break;
    }
  #endif
  cmd = ARILUX_CMD_NOT_DEFINED;
}

#ifndef JSON
  void publishStateChange(void) {
    publishToMQTT(ARILUX_MQTT_STATE_STATE_TOPIC, (arilux.getState() ? MQTT_STATE_ON_PAYLOAD : MQTT_STATE_OFF_PAYLOAD));
  }

  void publishBrightnessChange(void) {
    snprintf(msgBuffer, sizeof(msgBuffer), "%d", arilux.getBrightness());
    publishToMQTT(ARILUX_MQTT_BRIGHTNESS_STATE_TOPIC, msgBuffer);
  }

  void publishColorChange(void) {
    snprintf(msgBuffer, sizeof(msgBuffer), "%d,%d,%d", arilux.getRedValue(), arilux.getGreenValue(), arilux.getBlueValue());
    publishToMQTT(ARILUX_MQTT_COLOR_STATE_TOPIC, msgBuffer);
  }

  void publishWhiteChange(void) {
    snprintf(msgBuffer, sizeof(msgBuffer), "%d,%d", arilux.getWhite1Value(), arilux.getWhite2Value());
    publishToMQTT(ARILUX_MQTT_WHITE_STATE_TOPIC, msgBuffer);
  }
#endif

///////////////////////////////////////////////////////////////////////////
//  WiFi
