# Zigbee2Mqtt dimmer -\> wifi bulb brightness

**URL:** <https://discourse.nodered.org/t/zigbee2mqtt-dimmer-wifi-bulb-brightness/95583>\
**Category:** General\
**Tags:** home-assistant, mqtt\
**Created:** [23 February 2025 00:01 UTC](https://discourse.nodered.org/t/zigbee2mqtt-dimmer-wifi-bulb-brightness/95583 "2025-02-23T00:01:39Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Caesar\_Naykid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/caesar_naykid/32/99064_2.png) [@Caesar\_Naykid](https://discourse.nodered.org/u/Caesar_Naykid)\
**Post date:** [23 February 2025 00:01 UTC](https://discourse.nodered.org/t/zigbee2mqtt-dimmer-wifi-bulb-brightness/95583/1 "2025-02-23T00:01:39Z")

</div>

Hello,  
I have a zigbee knob [(Knob link)](https://www.amazon.com/Azoula-Zigbee-Rotary-Dimmer-Switch/dp/B0CQJG111L) connected to my system with Zigbee2MQTT and I want to dim a WIFI light with it.

It's set up and I have a Zigbee2mqtt node in Node-Red with a debug node  
and when i turn the knob, i can see the data in the debug and within the data (msg.payload: Object) i see the brightness

but, I cannot figure out how to make the actual (wifi) light brightness change to that number from the msg.payload object  
action node: Home Assistant Entity (see below)

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/b/0b7effefc19c41fc60278e11c5c3d7f7f75f280c.png)

gives this error:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/e/ce4dbb9f03afb3c11c8d4706182b5a0e5fdad549.png)

I have some programming experience from the 1990's but i'm no Javascript wizard, however some of the things I've tried keeps sounding like this msg.payload is an "object" and these nodes don't seem to like that

i've tried json node and changed node

I've found people controlling zigbee lights with zigbee controllers with MQTT via both sides, but my light is wifi and isn't controlled via MQTT that i'm aware, just as an Home Assistant Entity

Any hints to what I need to take this msg.payload (data?) and have my light react to the brightness (value?) in the payload?

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [23 February 2025 09:02 UTC](https://discourse.nodered.org/t/zigbee2mqtt-dimmer-wifi-bulb-brightness/95583/2 "2025-02-23T09:02:26Z")

</div>

show us what the debug from the knob looks like. I'm guessing it will be payload.something rather than just payload

---

<div class="post-metadata">

**Author:** ![mikefila](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mikefila/32/95223_2.png) [@mikefila](https://discourse.nodered.org/u/mikefila)\
**Post date:** [24 February 2025 02:11 UTC](https://discourse.nodered.org/t/zigbee2mqtt-dimmer-wifi-bulb-brightness/95583/3 "2025-02-24T02:11:25Z")

</div>

You're missing a `}` at the end.

```auto
{"brightness_pct": {{payload}} }

```

---

<div class="post-metadata">

**Author:** ![Caesar\_Naykid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/caesar_naykid/32/99064_2.png) [@Caesar\_Naykid](https://discourse.nodered.org/u/Caesar_Naykid)\
**Post date:** [24 February 2025 03:44 UTC](https://discourse.nodered.org/t/zigbee2mqtt-dimmer-wifi-bulb-brightness/95583/4 "2025-02-24T03:44:35Z")

</div>

> show us what the debug from the knob looks like. I'm guessing it will be payload.something rather than just payload

Hello, here is the Debug

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/9/a9e8fa78a17a96c14b137cbeeab8fdcb670c2994.png)

I have the following:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/8/88b66c9b53dd2fe273504774ae1457acccc14513.png)

with this

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/e/6e48759cd79eabfefe14711731483af2c8161352.png)

and this

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/e/7ea4ca9713922cf2c803c7a9058f8e7f5adbf509.png)

maybe this msg.payload.brightness is what you mean by "payload.something rather than just payload"?

---

<div class="post-metadata">

**Author:** ![Caesar\_Naykid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/caesar_naykid/32/99064_2.png) [@Caesar\_Naykid](https://discourse.nodered.org/u/Caesar_Naykid)\
**Post date:** [24 February 2025 03:45 UTC](https://discourse.nodered.org/t/zigbee2mqtt-dimmer-wifi-bulb-brightness/95583/5 "2025-02-24T03:45:36Z")

</div>

Thanks, corrected that

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/c/ec61dee3055092b40d55373e7e5b2ea94601c0c5.png)

---

<div class="post-metadata">

**Author:** ![xx\_Nexus\_xx](https://avatars.discourse-cdn.com/v4/letter/x/54ee81/32.png) [@xx\_Nexus\_xx](https://discourse.nodered.org/u/xx_Nexus_xx)\
**Post date:** [24 February 2025 04:52 UTC](https://discourse.nodered.org/t/zigbee2mqtt-dimmer-wifi-bulb-brightness/95583/6 "2025-02-24T04:52:55Z")

</div>

it has to be

```auto
{"brightness_pct": {{payload.brightness}} }
```

---

<div class="post-metadata">

**Author:** ![Caesar\_Naykid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/caesar_naykid/32/99064_2.png) [@Caesar\_Naykid](https://discourse.nodered.org/u/Caesar_Naykid)\
**Post date:** [24 February 2025 05:10 UTC](https://discourse.nodered.org/t/zigbee2mqtt-dimmer-wifi-bulb-brightness/95583/7 "2025-02-24T05:10:33Z")

</div>

ok so that syntax worked..

..but also, a new problem arrose

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/4/841c4b90bcbc4d4f841ee56c3ff8e58a254c3293.png)

the expose value is 0 - 255 in Zigbee2MQTT

the "home assistant" "action" node brightness\_pct is 0-100

so.. i'll need to either find another route, or maybe use a formula to translate 0-255 to 0-100

---

<div class="post-metadata">

**Author:** ![xx\_Nexus\_xx](https://avatars.discourse-cdn.com/v4/letter/x/54ee81/32.png) [@xx\_Nexus\_xx](https://discourse.nodered.org/u/xx_Nexus_xx)\
**Post date:** [24 February 2025 05:14 UTC](https://discourse.nodered.org/t/zigbee2mqtt-dimmer-wifi-bulb-brightness/95583/8 "2025-02-24T05:14:02Z")

</div>

yes you need a function node to calculate

msg.payload.brightness=msg.payload.brightness/255\*100

---

<div class="post-metadata">

**Author:** ![mikefila](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mikefila/32/95223_2.png) [@mikefila](https://discourse.nodered.org/u/mikefila)\
**Post date:** [24 February 2025 05:28 UTC](https://discourse.nodered.org/t/zigbee2mqtt-dimmer-wifi-bulb-brightness/95583/9 "2025-02-24T05:28:13Z")

</div>

Or use the `brightness` key instead of `brightness_pct`

`{"brightness": {{payload.brightness}} }`

---

<div class="post-metadata">

**Author:** ![Caesar\_Naykid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/caesar_naykid/32/99064_2.png) [@Caesar\_Naykid](https://discourse.nodered.org/u/Caesar_Naykid)\
**Post date:** [24 February 2025 13:29 UTC](https://discourse.nodered.org/t/zigbee2mqtt-dimmer-wifi-bulb-brightness/95583/10 "2025-02-24T13:29:19Z")

</div>

> Or use the `brightness` key instead of `brightness_pct`
> 
> `{"brightness": {{payload.brightness}} }`

oh wow. that was it. Totally worked

thanks so much gents for your help

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [25 May 2025 13:30 UTC](https://discourse.nodered.org/t/zigbee2mqtt-dimmer-wifi-bulb-brightness/95583/11 "2025-05-25T13:30:10Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
