Use device retain setting.

This commit is contained in:
Koen Kanters
2018-04-18 22:07:18 +02:00
parent 31c6d794a9
commit 69736a883e
+5 -1
View File
@@ -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,
);
}
};