# Firmware for listening command

**URL:** <https://forum.hardwario.com/t/firmware-for-listening-command/896>\
**Category:** TOWER\
**Created:** [July 21, 2025, 6:51pm UTC](https://forum.hardwario.com/t/firmware-for-listening-command/896 "2025-07-21T18:51:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Budul](https://forum.hardwario.com/letter_avatar_proxy/v4/letter/b/dfb087/32.png) [@Budul](https://forum.hardwario.com/u/Budul)\
**Post date:** [July 21, 2025, 6:51pm UTC](https://forum.hardwario.com/t/firmware-for-listening-command/896/1 "2025-07-21T18:51:47Z")

</div>

hi,  
I have a simple firmware for the power module, everything works, now I would like to be able to send a command/value to the module. How do I do it the easiest way? Thank you

---

<div class="post-metadata">

**Author:** ![hub.martin](https://forum.hardwario.com/user_avatar/forum.hardwario.com/hub.martin/32/631_2.png) [@hub.martin](https://forum.hardwario.com/u/hub.martin)\
**Post date:** [July 22, 2025, 7:19am UTC](https://forum.hardwario.com/t/firmware-for-listening-command/896/2 "2025-07-22T07:19:24Z")

</div>

Hi, since the power module is externally powered, you might initialize radio so it will listen.

> **[Sub-GHz Radio | HARDWARIO Documentation](https://docs.hardwario.com/tower/radio-communication/sub-ghz-radio/)**
>
> Radio communication technology is the heart of the TOWER Kit. This document describes the basic operation of the radio.

Take inspiration from generic FW where the power module is powered and there is radio event handler set

> <https://github.com/hardwario/twr-generic-node/blob/main/src/application.c#L215>

Related:

> [@How BC\_RADIO\_MODE\_NODE\_LISTENING affects battery lifetime?](https://forum.hardwario.com/t/how-bc-radio-mode-node-listening-affects-battery-lifetime/372):
>
> Hi, Yesterday I totaly drained my batteries in climate module. It works for about two weeks slight_smile Yes, it is short lifetime… At this moment I am not sure if I made some changes which causes this abnormal battery consumption, or it is normal, because I am using listening mode. I modified [bcf-radio-climate-monitor](https://github.com/bigclownlabs/bcf-radio-climate-monitor) example. I changed mode to “radio listening mode” and I modified some intervals. I am checking new values every 20s… I know, that during some tests, I checked new values so f…

---

<div class="post-metadata">

**Author:** ![Budul](https://forum.hardwario.com/letter_avatar_proxy/v4/letter/b/dfb087/32.png) [@Budul](https://forum.hardwario.com/u/Budul)\
**Post date:** [July 27, 2025, 2:22pm UTC](https://forum.hardwario.com/t/firmware-for-listening-command/896/3 "2025-07-27T14:22:46Z")

</div>

Hi,  
thanks, I initialize radio with TWR\_RADIO\_MODE\_NODE\_LISTENING, but I could not find any handler for operations with incoming mqqt messages.

---

<div class="post-metadata">

**Author:** ![hub.martin](https://forum.hardwario.com/user_avatar/forum.hardwario.com/hub.martin/32/631_2.png) [@hub.martin](https://forum.hardwario.com/u/hub.martin)\
**Post date:** [July 29, 2025, 10:22am UTC](https://forum.hardwario.com/t/firmware-for-listening-command/896/4 "2025-07-29T10:22:08Z")

</div>

Hi,

See the MQTT commands page. Search for `/set`, which are the topics tosend data from dongle(or different node) to the end node.

> **[Topics Reference | HARDWARIO Documentation](https://docs.hardwario.com/tower/mqtt-protocol/topics-reference/)**
>
> Node Topics

Then in your C code you use pre-defined C functions. They are `weak` so they are defined in SDK, but if you redefine them in your app code, then linker uses your implementation.  
Here is the list of all of them

> <https://github.com/hardwario/twr-sdk/blob/9ded554952a605bc65420a572f098bb1c5cb8488/twr/src/twr_radio_node.c#L3>

If you look at those weak functions, think about them like they could control LED or relay, but you can also use them and in you weak function use the received parameters for completely something else. I’ll explain that later below.

Now, the question is, what would you like to control?

- A single device that expects on/off (use the relay functions, one of them has also a duration)
- Some color LED (you can also send multiple colors, see “compound”, you might use that to pass multiple values in a array to your device from MQTT)
- Or even something bigger and more complex? (use generic twr\_radio\_node\_on\_buffer, however this function is in C, but the Dongle does not have it implemented in the MQTT topics)

Look to the generic node FW, which contains relay and LED receive logic, and inside those weak functions it decides which relay to turn off/on

> <https://github.com/hardwario/twr-generic-node/blob/main/src/application.c#L500>

Here is how the C code of the LED compound might look. You might send an array in the MQTT using `node/{id}/led-strip/-/compound/set` and receive the array in your node. Then you might not need to use it for LEDs, you might use the data to control something completely different, just using the compound message to encapsulate your payload.

> <https://github.com/hardwario/twr-generic-node/blob/main/src/application.c#L672>

---

<div class="post-metadata">

**Author:** ![danielscott](https://forum.hardwario.com/letter_avatar_proxy/v4/letter/d/838e76/32.png) [@danielscott](https://forum.hardwario.com/u/danielscott)\
**Post date:** [November 24, 2026, 7:43am UTC](https://forum.hardwario.com/t/firmware-for-listening-command/896/5 "2026-11-24T07:43:57Z")

</div>

You won’t find an MQTT handler inside the Power Module firmware; MQTT is handled by the dongle/gateway, and the node receives radio commands. In your application code, override the weak twr\_radio\_node\_on\_state\_set() for /set state topics, or twr\_radio\_node\_on\_buffer() for buffer payloads. Check the incoming id/state\_id, apply the requested value, and keep your radio event handler initialized as you already have it.

---

<div class="post-metadata">

**Author:** ![hub.martin](https://forum.hardwario.com/user_avatar/forum.hardwario.com/hub.martin/32/631_2.png) [@hub.martin](https://forum.hardwario.com/u/hub.martin)\
**Post date:** [November 25, 2026, 8:43am UTC](https://forum.hardwario.com/t/firmware-for-listening-command/896/6 "2026-11-25T08:43:38Z")

</div>


