From 2a5fb6c613d727aba430b34e987388977f30d45b Mon Sep 17 00:00:00 2001 From: Laurent Date: Fri, 1 Nov 2024 21:13:05 +0000 Subject: [PATCH] buzzer: Envoi un message complet sur le bon topic --- buzzer/buzzer.ino | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/buzzer/buzzer.ino b/buzzer/buzzer.ino index 7f40dbf..5cc5fcc 100644 --- a/buzzer/buzzer.ino +++ b/buzzer/buzzer.ino @@ -5,7 +5,8 @@ const char* ssid = "Redmi Note 13 Pro 5G"; const char* password = "1234567890"; const char* mqtt_server = "192.168.127.208"; -const char* mqtt_topic = "bouton/etat"; +const char* mqtt_topic = "brainblast/buzzer/pressed/1"; +const char* mqtt_message = "{\"buzzer_id\": 1, \"color\": \"#FF7518\"}"; // Déclaration des broches #define BUTTON_PIN D8 @@ -61,7 +62,7 @@ void loop() { // Vérifier si le bouton est pressé if (digitalRead(BUTTON_PIN) == HIGH) { Serial.println("Bouton pressé, envoi du message..."); - client.publish(mqtt_topic, "Bouton presse"); + client.publish(mqtt_topic, mqtt_message); delay(200); // Anti-rebond pour éviter les publications multiples } -} \ No newline at end of file +} \ No newline at end of file