Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

split debug messages by direction and message type #215

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/mitsubishi2mqtt/mitsubishi2mqtt.ino
Original file line number Diff line number Diff line change
Expand Up @@ -1341,6 +1341,7 @@ void hpCheckRemoteTemp(){
void hpPacketDebug(byte* packet, unsigned int length, const char* packetDirection) {
if (_debugModePckts) {
String message;
String topic = ha_debug_pckts_topic + "/" + packetDirection + "/" + String(packet[5], HEX); // packet 5 is message type
for (unsigned int idx = 0; idx < length; idx++) {
if (packet[idx] < 16) {
message += "0"; // pad single hex digits with a 0
Expand All @@ -1354,7 +1355,7 @@ void hpPacketDebug(byte* packet, unsigned int length, const char* packetDirectio
root[packetDirection] = message;
String mqttOutput;
serializeJson(root, mqttOutput);
if (!mqtt_client.publish(ha_debug_pckts_topic.c_str(), mqttOutput.c_str())) {
if (!mqtt_client.publish(topic.c_str(), mqttOutput.c_str())) {
mqtt_client.publish(ha_debug_logs_topic.c_str(), (char*)("Failed to publish to heatpump/debug topic"));
}
}
Expand Down