From c734158d1cd6e46467b4a152bf814977c499639b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Sun, 21 Jan 2018 00:33:08 +0100 Subject: [PATCH] Check current domoticz status to avoid (un)subscribe with every update from the webUI --- code/espurna/domoticz.ino | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/code/espurna/domoticz.ino b/code/espurna/domoticz.ino index daea88a2..92b6da36 100644 --- a/code/espurna/domoticz.ino +++ b/code/espurna/domoticz.ino @@ -104,8 +104,9 @@ void _domoticzWebSocketOnSend(JsonObject& root) { #endif // WEB_SUPPORT void _domoticzConfigure() { - _dcz_enabled = getSetting("dczEnabled", DOMOTICZ_ENABLED).toInt() == 1; - _domoticzMqttSubscribe(_dcz_enabled); + bool enabled = getSetting("dczEnabled", DOMOTICZ_ENABLED).toInt() == 1; + if (enabled != _dcz_enabled) _domoticzMqttSubscribe(enabled); + _dcz_enabled = enabled; } //------------------------------------------------------------------------------