Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,15 @@ public void dispose() {

private synchronized void publishMessage(String topic, byte[] message) throws MqttException, InterruptedException {
try {
if (!publishMessageLocal(topic, message)) {
logger.trace("Publishing to mqtt...");
mqttConnector.publishMqttMessage(topic, message);
if (publishMessageLocal(topic, message)) {
return;
}
} catch (IOException e) {
logger.debug("Error communicating to device with IP address {} in LAN, trying cloud",
callback.getIpAddress());
logger.trace("Error: ", e);
}
logger.debug("Failed communicating to device with IP address {} in LAN, trying cloud", callback.getIpAddress());
logger.trace("Publishing to mqtt...");
mqttConnector.publishMqttMessage(topic, message);
}

private boolean publishMessageLocal(String topic, byte[] message) throws IOException {
Expand Down