# Function node to manually activate aqara smoke alarm buzzer

**URL:** https://discourse.nodered.org/t/function-node-to-manually-activate-aqara-smoke-alarm-buzzer/98098
**Category:** General
**Tags:** function-node
**Created:** [12 July 2025 12:13 UTC](https://discourse.nodered.org/t/function-node-to-manually-activate-aqara-smoke-alarm-buzzer/98098 "2025-07-12T12:13:51Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![thomasvjohansen](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/thomasvjohansen/32/32779_2.png) [@thomasvjohansen](https://discourse.nodered.org/u/thomasvjohansen)
#### Post date: [12 July 2025 12:13 UTC](https://discourse.nodered.org/t/function-node-to-manually-activate-aqara-smoke-alarm-buzzer/98098/1 "2025-07-12T12:13:51Z")

</div>

I have an Aqara smoke alarm where I want to use the buzzer as a siren for my alarm.

It should be possible to activate the buzzer manually,

> To write (`/set`) a value publish a message to topic `zigbee2mqtt/FRIENDLY_NAME/set` with payload `{"buzzer": NEW_VALUE}`. The possible values are: `mute`, `alarm`

I need to do this with a function but cant figure out how to get this working.

I thought it was as simple as adding this in function node:

> msg.payload = {"buzzer": alarm}  
> return msg;

and then send it to a mqtt exit node which have a zigbee2mqtt/FRIENDLY\_NAME/set topic.

but somehow that doesnt work.  
What am I doing wrong?

> **[Aqara JY-GZ-01AQ control via MQTT | Zigbee2MQTT](https://www.zigbee2mqtt.io/devices/JY-GZ-01AQ.html)**
>
> Integrate your Aqara JY-GZ-01AQ via Zigbee2MQTT with whatever smart home infrastructure you are using without the vendor's bridge or gateway.

---

<div class="post-metadata">

### Author: ![thomasvjohansen](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/thomasvjohansen/32/32779_2.png) [@thomasvjohansen](https://discourse.nodered.org/u/thomasvjohansen)
#### Post date: [12 July 2025 12:28 UTC](https://discourse.nodered.org/t/function-node-to-manually-activate-aqara-smoke-alarm-buzzer/98098/2 "2025-07-12T12:28:03Z")

</div>

figured it out

needed ' '

> msg.payload = {"buzzer": 'alarm'}  
> return msg;

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [12 July 2025 14:18 UTC](https://discourse.nodered.org/t/function-node-to-manually-activate-aqara-smoke-alarm-buzzer/98098/3 "2025-07-12T14:18:33Z")

</div>

> [@thomasvjohansen](#):
>
> I need to do this with a function

Why don't you use a Change node instead of a Function?

---

<div class="post-metadata">

### Author: ![thomasvjohansen](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/thomasvjohansen/32/32779_2.png) [@thomasvjohansen](https://discourse.nodered.org/u/thomasvjohansen)
#### Post date: [16 July 2025 18:09 UTC](https://discourse.nodered.org/t/function-node-to-manually-activate-aqara-smoke-alarm-buzzer/98098/4 "2025-07-16T18:09:32Z")

</div>

I'm using bit of boths.  
But my functions are simple, since I'm no good a programming.  
But got a working alarm system up and running:

main remotes and notifications

 ![alarm01](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/d/2d56feaae46ed27f139c0a1dd3275771451bfc30.png)

Smoke detectors & using them for alarm sirens too

 ![alarm02](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/6/b680a28f30176b3d643f9597ff60d6454c3c6b4d.png)  
 ![alarm02b](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/6/16a45e3009f39a78c7c08277f7e81acd7a842737.png)

motion

 ![alarm03](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/b/2b4bceaf9b22571e2e3144e4e4f54f867f8ce577.png)

door

 ![alarm04](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/1/11dad10c6747996549f57a8e17956ee6c2a6c2f4.png)

Dashboard (danish)

 ![alarm05](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/7/7720c2daf6299377ab6f850d24068d3017b61728.png)

---

<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: [30 July 2025 18:09 UTC](https://discourse.nodered.org/t/function-node-to-manually-activate-aqara-smoke-alarm-buzzer/98098/5 "2025-07-30T18:09:56Z")

</div>

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