diff --git a/lib/extension/publish.js b/lib/extension/publish.js index 1f80056b..d3becfb5 100644 --- a/lib/extension/publish.js +++ b/lib/extension/publish.js @@ -197,8 +197,9 @@ class EntityPublish extends Extension { if (!usedConverters.hasOwnProperty(endpointOrGroupID)) usedConverters[endpointOrGroupID] = []; const converter = converters.find((c) => c.key.includes(key)); - if (usedConverters[endpointOrGroupID].includes(converter)) { - // Use a converter only once (e.g. light_onoff_brightness converters can convert state and brightness) + if (topic.type === 'set' && usedConverters[endpointOrGroupID].includes(converter)) { + // Use a converter for set only once + // (e.g. light_onoff_brightness converters can convert state and brightness) continue; } diff --git a/test/publish.test.js b/test/publish.test.js index 6d069f45..49f7e03b 100644 --- a/test/publish.test.js +++ b/test/publish.test.js @@ -440,10 +440,11 @@ describe('Publish', () => { it('Should handle get', async () => { const device = zigbeeHerdsman.devices.bulb_color; const endpoint = device.getEndpoint(1); - await MQTT.events.message('zigbee2mqtt/bulb_color/get', stringify({state: ''})); + await MQTT.events.message('zigbee2mqtt/bulb_color/get', stringify({state: '', brightness: ''})); await flushPromises(); - expect(endpoint.read).toHaveBeenCalledTimes(1); + expect(endpoint.read).toHaveBeenCalledTimes(2); expect(endpoint.read).toHaveBeenCalledWith('genOnOff', ['onOff']); + expect(endpoint.read).toHaveBeenCalledWith('genLevelCtrl', ['currentLevel']); }); it('Should handle get with multiple endpoints', async () => {