mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Failsafe
This commit is contained in:
@@ -38,7 +38,7 @@ class Mh {
|
||||
|
||||
public function disconnect() {
|
||||
if ($this->mqtt) {
|
||||
log_message('error', 'disconnect from MQTT broker');
|
||||
log_message('debug', 'disconnect from MQTT broker');
|
||||
$this->mqtt->close();
|
||||
}
|
||||
}
|
||||
@@ -48,7 +48,10 @@ class Mh {
|
||||
if (!($this->mqtt)) {
|
||||
$this->connect();
|
||||
}
|
||||
$this->publish($this->mqsettings['prefix'].$topic, $message);
|
||||
if ($this->mqtt) { // Failsafe. Check if REALLY connected before trying to puv
|
||||
log_message('debug', 'published '.$this->mqsettings['prefix'].$topic.' -> '.$message.' to MQTT broker');
|
||||
$this->publish($this->mqsettings['prefix'].$topic, $message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user