# How to Click push button send value to mqtt

**URL:** <https://discourse.nodered.org/t/how-to-click-push-button-send-value-to-mqtt/64607>\
**Category:** General\
**Tags:** node-red-dashboard, mqtt\
**Created:** [2 July 2022 10:04 UTC](https://discourse.nodered.org/t/how-to-click-push-button-send-value-to-mqtt/64607 "2022-07-02T10:04:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![krowkong](https://avatars.discourse-cdn.com/v4/letter/k/d2c977/32.png) [@krowkong](https://discourse.nodered.org/u/krowkong)\
**Post date:** [2 July 2022 10:04 UTC](https://discourse.nodered.org/t/how-to-click-push-button-send-value-to-mqtt/64607/1 "2022-07-02T10:04:57Z")

</div>

I have two problems

1.How to save temperature and humidity values ​​to a CSV file? by splitting into two files Each file provides temperature/humidity and time values.  
I get the values ​​from MQTT.

Example  
CSV File no.1 = Timestemp / Temperature  
CSV File no.2 = Timestemp / Humidity

2.Get temperature value from MQTT and displays it in the gauge. and when the button is pressed it will send the temperature value to another MQTT topic

Sorry if my English is not good.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [3 July 2022 13:45 UTC](https://discourse.nodered.org/t/how-to-click-push-button-send-value-to-mqtt/64607/3 "2022-07-03T13:45:44Z")

</div>

Your topic description and details are confusing but let me see if I can help.

> How to Click push button send value to mqtt

Connect a `ui-button` node to a `change` node. In the `change` node, move your value (from where ever it is stored) to msg.payload. Connect the `change` node to a `mqtt-out` node and configure it with a ‘topic’ and the broker you will use. Now when you press the button on the dashboard, the msg will be sent to the broker.

I would try to answer your question about the csv file but you say you are going to save both temperature, humidity and time but then show an example where each file only has one of the data items. Which is it?

Take a look at the `write file` node and `csv` nodes and read the Help tab for each one.

I recommend watching this playlist: [Node-RED Essentials](https://www.youtube.com/playlist?list=PLyNBB9VCLmo1hyO-4fIZ08gqFcXBkHy-6). The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.

---

<div class="post-metadata">

**Author:** ![krowkong](https://avatars.discourse-cdn.com/v4/letter/k/d2c977/32.png) [@krowkong](https://discourse.nodered.org/u/krowkong)\
**Post date:** [4 July 2022 17:06 UTC](https://discourse.nodered.org/t/how-to-click-push-button-send-value-to-mqtt/64607/4 "2022-07-04T17:06:02Z")

</div>

Thank you very much, I am doing what you suggested.

---

<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:** [2 September 2022 17:06 UTC](https://discourse.nodered.org/t/how-to-click-push-button-send-value-to-mqtt/64607/5 "2022-09-02T17:06:07Z")

</div>

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