diff --git a/lib/controller.js b/lib/controller.js index 8edbfa3f..e55c5042 100644 --- a/lib/controller.js +++ b/lib/controller.js @@ -235,9 +235,11 @@ class Controller { // - If NO payload is returned do nothing. This is for non-standard behaviour // for e.g. click switches where we need to count number of clicks and detect long presses. converters.forEach((converter) => { - const publish = (payload) => this.mqttPublishDeviceState( - device.ieeeAddr, payload, converter.disableCache !== true - ); + const publish = (payload) => { + // Don't cache messages with click and action. + const cache = !payload.hasOwnProperty('click') && !payload.hasOwnProperty('action'); + this.mqttPublishDeviceState(device.ieeeAddr, payload, cache); + }; const payload = converter.convert(message, publish, settings.getDevice(device.ieeeAddr)); diff --git a/lib/converters/zigbee2mqtt.js b/lib/converters/zigbee2mqtt.js index b0e8c899..b58baa47 100644 --- a/lib/converters/zigbee2mqtt.js +++ b/lib/converters/zigbee2mqtt.js @@ -69,7 +69,6 @@ const parsers = [ devices: ['WXKG01LM'], cid: 'genOnOff', type: 'attReport', - disableCache: true, convert: (msg, publish) => { const deviceID = msg.endpoints[0].device.ieeeAddr; const state = msg.data.data['onOff']; @@ -105,7 +104,6 @@ const parsers = [ devices: ['MFKZQ01LM'], cid: 'genMultistateInput', type: 'attReport', - disableCache: true, convert: (msg) => { /* Source: https://github.com/kirovilya/ioBroker.zigbee @@ -145,7 +143,6 @@ const parsers = [ devices: ['MFKZQ01LM'], cid: 'genAnalogInput', type: 'attReport', - disableCache: true, convert: (msg) => { /* Source: https://github.com/kirovilya/ioBroker.zigbee @@ -230,7 +227,6 @@ const parsers = [ devices: ['WXKG11LM'], cid: 'genOnOff', type: 'attReport', - disableCache: true, convert: (msg) => { const data = msg.data.data; let clicks; @@ -266,7 +262,6 @@ const parsers = [ devices: ['WXKG02LM'], cid: 'genOnOff', type: 'attReport', - disableCache: true, convert: (msg) => { return {click: WXKG02LM[msg.endpoints[0].epId]}; }, @@ -275,7 +270,6 @@ const parsers = [ devices: ['WXKG03LM'], cid: 'genOnOff', type: 'attReport', - disableCache: true, convert: () => { return {click: 'single'}; },