mirror of
https://github.com/lehanspb/tuya-mqtt.git
synced 2025-12-16 17:54:36 +00:00
Fix for no template
This commit is contained in:
@@ -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)) {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user