Added basic Logger with 4 modes.

This commit is contained in:
2025-01-26 18:02:39 +02:00
parent 7dd6f81264
commit 516eeab751
8 changed files with 126 additions and 107 deletions

View File

@@ -26,25 +26,20 @@ void SuscribeMqtt() {
String topicRelayTimers = String("vesper/") + DEV_ID + "/control/settings/relayTimers";
uint16_t control_id = mqttClient.subscribe(topicPlayback.c_str(), 2);
Serial.print("Subscribing to Playback Control topic, QoS 2, packetId: ");
Serial.println(control_id);
LOG_INFO("Subscribing to Playback Control topic, QoS 2, packetId: %d", control_id);
uint16_t set_melody_id = mqttClient.subscribe(topicSetMelody.c_str(), 2);
Serial.print("Subscribing to Set-Melody topic, QoS 2, packetId: ");
Serial.println(set_melody_id);
LOG_INFO("Subscribing to Set-Melody topic, QoS 2, packetId: %d", set_melody_id);
// doesn't work yet:
// doesn't work yet:
uint16_t add_melody_id = mqttClient.subscribe(topicAddMelody.c_str(), 2);
Serial.print("Subscribing to Add-Melody topic, QoS 2, packetId: ");
Serial.println(add_melody_id);
LOG_INFO("Subscribing to Add-Melody topic, QoS 2, packetId: %d", add_melody_id);
uint16_t add_schedule_id = mqttClient.subscribe(topicAddSchedule.c_str(), 2);
Serial.print("Subscribing to Add-Schedule topic, QoS 2, packetId: ");
Serial.println(add_schedule_id);
LOG_INFO("Subscribing to Add-Schedule topic, QoS 2, packetId: %d", add_schedule_id);
uint16_t relay_timers_id = mqttClient.subscribe(topicRelayTimers.c_str(), 2);
Serial.print("Subscribing to Relay-Timers topic, QoS 2, packetId: ");
Serial.println(relay_timers_id);
LOG_INFO("Subscribing to Relay-Timers topic, QoS 2, packetId: %d", relay_timers_id);
}
@@ -72,7 +67,7 @@ void OnMqttReceived(char * topic, char * payload, AsyncMqttClientMessageProperti
else if (String(topic) == topicAddMelody) {
// Handle adding melody
Serial.println("Adding melody...");
LOG_INFO("Adding melody...");
// You can call a function here to handle adding the melody
}
@@ -86,7 +81,7 @@ void OnMqttReceived(char * topic, char * payload, AsyncMqttClientMessageProperti
else {
// Handle unknown topics
Serial.println("Unknown topic received.");
LOG_WARNING("Unknown topic received.");
}
}