node-red-contrib-zigbee2mqtt icon indicating copy to clipboard operation
node-red-contrib-zigbee2mqtt copied to clipboard

How to use a variable for brightness?

Open tamueller opened this issue 1 year ago • 1 comments

Hi, I'm trying to set the brightness of a lamp to a global value, but can't figure out how. I tried to set the payload to: { "brightness": "{{global.flux_brightness}}", "kelvin": "{{global.flux_temperature}}", "transition": 0 }

but I get this in the zigbee2Mqtt logs: Error: Brightness value of message: '{"brightness":"{{global.flux_brightness}}","kelvin":"{{global.flux_temperature}}","transition":0}' invalid, must be a number >= 0 and =< 254 at Object.convertSet (/app/node_modules/zigbee-herdsman-converters/converters/toZigbee.js:846:23) at Publish.onMQTTMessage (/app/lib/extension/publish.ts:246:52) at EventEmitter.emit (node:events:539:35) at EventBus.emitMQTTMessage (/app/lib/eventBus.ts:109:22) at MQTT.onMessage (/app/lib/mqtt.ts:140:27) at MqttClient.emit (node:events:527:28) at MqttClient._handlePublish (/app/node_modules/mqtt/lib/client.js:1547:12) at MqttClient._handlePacket (/app/node_modules/mqtt/lib/client.js:535:12) at work (/app/node_modules/mqtt/lib/client.js:438:12) at Writable.writable._write (/app/node_modules/mqtt/lib/client.js:452:5)

The same syntax works e.g. for the HA-Integration, how can I do this with zigbee2Mqtt?

tamueller avatar Oct 23 '22 15:10 tamueller

{{global.flux_brightness}} is template syntax. Try to pass it though a template node first.

Impact123 avatar Oct 23 '22 19:10 Impact123