From 69736a883edc15636095d6ced31413a802595ec8 Mon Sep 17 00:00:00 2001 From: Koen Kanters Date: Wed, 18 Apr 2018 22:07:18 +0200 Subject: [PATCH] Use device retain setting. --- lib/controller.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/controller.js b/lib/controller.js index fb4a2be09..8e2a7a81e 100644 --- a/lib/controller.js +++ b/lib/controller.js @@ -130,7 +130,11 @@ class Controller { const callback = (error) => { // Devices do not report when they go off, this ensures state (on/off) is always in sync. if (!error && key === 'state') { - this.mqtt.publish(friendlyName, JSON.stringify({state: json[key]}), true); + this.mqtt.publish( + friendlyName, + JSON.stringify({state: json[key]}), + settings.get().devices[deviceID].retain, + ); } };