Fix for no template

This commit is contained in:
tsightler
2020-10-03 10:38:43 -04:00
parent 99f5358794
commit 68d8743882
2 changed files with 6 additions and 3 deletions

View File

@@ -11,6 +11,7 @@ class GenericDevice extends TuyaDevice {
// Map generic DPS topics to device specific topic names
this.deviceTopics = this.config.template
} else {
this.deviceTopics = {}
// Try to get schema to at least know what DPS keys to get initial update
const result = await this.device.get({"schema": true})
if (!utils.isJsonString(result)) {

View File

@@ -33,8 +33,10 @@ class TuyaDevice {
mf: 'Tuya'
}
this.dps = {} // This will hold dps state data for device
this.prevDps = {} // This will hold previous dps value for device to avoid republish of non-changed states
// Variables to hold device state data
this.dps = {} // Current dps state data for device
this.dpsPub = {} // Published dps state data for device
this.color = {h, s, b, t, w} // Current color values (Hue, Saturation, Brightness, White Temp, White Level)
// Build the MQTT topic for this device (friendly name or device id)
if (this.options.name) {
@@ -135,7 +137,7 @@ class TuyaDevice {
let setResult = this.setState(command, deviceTopic)
if (!setResult) {
debug('Command topic '+this.baseTopic+commandTopic+' received invalid value: '+command)
}
}
} else {
debug('Invalid command topic '+this.baseTopic+commandTopic+' for device: '+this.config.name)
return