#define SERIAL_SPEED 115200

#define SHOW_FPS 1
int fps;

// OTA
#define OTA_CLIENT   "alarmclock"
#define OTA_PASSWORD "XXX"

// DebugRemote
#define REMDEB_CLIENT "alarmclock"
RemoteDebug Debug;

// LED
#define LED_NUM 30
#define LED_PIN  5 // = D5
#define LED_CHIPSET     WS2812B
#define LED_COLOR_ORDER GRB
#define LED_MAXBRIGHTNESS_DEFAULT 80
#define LED_BRIGHTNESS_DEFAULT 6
#define LED_COLOR_DEFAULT CRGB::Red
// 1000 * 60 * 60 = 1h
#define LED_DURATION 3600000

// Corresponds à un max brightness configurable via HA
int maxBrightness;
// Utilisé pour définir le seuil actuel de brightness
int curbrightness;
int color;
CRGB leds[LED_NUM];
boolean ledState;
unsigned long startTime;

// WIFI
#define WIFI_SSID     "XXX"
#define WIFI_PASSWORD "XXX"

WiFiClient espClient;

// MQTT
#define MQTT_SERVER "XXX"
#define MQTT_PORT   1883
#define MQTT_USER   "XXX"
#define MQTT_PASS   "XXX"

#define MQTT_LED_COMMAND            "alarmclock/switch"
#define MQTT_LED_STATE              "alarmclock/status"
#define MQTT_LED_BRIGHTNESS_COMMAND "alarmclock/brightness/switch"
#define MQTT_LED_BRIGHTNESS_STATE   "alarmclock/brightness/status"
#define MQTT_LED_COLOR_COMMAND      "alarmclock/color/switch"
#define MQTT_LED_COLOR_STATE        "alarmclock/color/status"

char message_buff[100];
PubSubClient client(espClient);


void setupOTA();
void setupWifi();
void testConnectMQTT();
void callbackMQTT(char* topic, byte* payload, unsigned int length);
void mqttSendState();
void mqttSendBrightnessState();
void mqttSendColorState();
void ledBlackAll();
void ledError();
void ledDisplay();
