Skip to content

Commit

Permalink
Update server_mqtt.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
caco3 authored Dec 2, 2024
1 parent ba7b4ee commit e70829b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion code/components/jomjol_mqtt/server_mqtt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ bool sendHomeAssistantDiscoveryTopic(std::string group, std::string field,
else if (field == "flowstart") { // Special case: Button
topicFull = "homeassistant/button/" + node_id + "/" + configTopic + "/config";
}
else if (field == "set_prevalue") { // Special case: Command with payload
topicFull = "homeassistant/number/" + node_id + "/" + configTopic + "/config";
}
else {
topicFull = "homeassistant/sensor/" + node_id + "/" + configTopic + "/config";
}
Expand Down Expand Up @@ -119,7 +122,11 @@ bool sendHomeAssistantDiscoveryTopic(std::string group, std::string field,
}
else if (field == "flowstart") { // Special case: Button
payload += "\"cmd_t\":\"~/ctrl/flow_start\","; // Add command topic
payload += "\"pl_prs\":\"1\",";
// payload += "\"pl_prs\":\"1\",";
}
else if (field == "set_prevalue") { // Special case: Command with value
payload += "\"cmd_t\":\"~/ctrl/set_prevalue\","; // Add command topic
payload += "\"pl_prs\":\"0\",";
}
else {
payload += "\"state_topic\": \"~/" + field + "\",";
Expand Down

0 comments on commit e70829b

Please sign in to comment.