Skip to content
Open
Show file tree
Hide file tree
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
9 changes: 8 additions & 1 deletion devices/tuya-device.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ class TuyaDevice {
this.config = deviceInfo.configDevice
this.mqttClient = deviceInfo.mqttClient
this.topic = deviceInfo.topic
this.qos = deviceInfo.qos
this.retain = deviceInfo.retain

// Build TuyAPI device options from device config info
this.options = {
Expand Down Expand Up @@ -634,8 +636,13 @@ class TuyaDevice {

// Publish MQTT
publishMqtt(topic, message, isDebug) {
var options = {
qos: this.qos,
retain: this.retain
}

if (isDebug) { debugState(topic, message) }
this.mqttClient.publish(topic, message, { qos: 1 });
this.mqttClient.publish(topic, message, options);
}
}

Expand Down
4 changes: 3 additions & 1 deletion tuya-mqtt.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ function getDevice(configDevice, mqttClient) {
const deviceInfo = {
configDevice: configDevice,
mqttClient: mqttClient,
topic: CONFIG.topic
topic: CONFIG.topic,
qos: CONFIG.qos,
retain: CONFIG.retain
}
switch (configDevice.type) {
case 'SimpleSwitch':
Expand Down