# How send persist data to cloud

**URL:** <https://discourse.nodered.org/t/how-send-persist-data-to-cloud/25395>\
**Category:** General\
**Created:** [24 April 2020 05:25 UTC](https://discourse.nodered.org/t/how-send-persist-data-to-cloud/25395 "2020-04-24T05:25:18Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![abedgarr](https://avatars.discourse-cdn.com/v4/letter/a/d26b3c/32.png) [@abedgarr](https://discourse.nodered.org/u/abedgarr)\
**Post date:** [24 April 2020 05:25 UTC](https://discourse.nodered.org/t/how-send-persist-data-to-cloud/25395/1 "2020-04-24T05:25:19Z")

</div>

Good morning, I have a query. I am using the cloud BeeBotte, and the data sent from BeeBotte to Node-network are persistent data messages, while the messages sent from Node-red to Beebotte are messages without persistence, how can I do that configuration?  
I need to send and receive data with persistence

---

<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:** [24 April 2020 09:03 UTC](https://discourse.nodered.org/t/how-send-persist-data-to-cloud/25395/2 "2020-04-24T09:03:54Z")

</div>

Firts off I'm moving this to the 'general' category since it is not a complete project you are displaying

Second, Beebotte is (per their wbpage) a "Cloud Platform for Real Time Connected Objects" so you can think of it as a sort of cloud based MQTT broker. This means it just passs messages between devices. This means some device is sending msgs thru Beebotte to your Pi and your Pi is sending msgs thru Beebotte to some device.

With that in mind,

1. what is the other device?
2. are you using the same Beebotte Channel and Resourses for the Pi to recieve AND send data?
3. in Beebotte how are the resources configured?
4. in Node-red, how have you configured the `MQTT-out` node?
5. in Node-red, how have you configured the `MQTT-in` node?
6. on the other device, how have you defined the mqtt out and in nodes?

---

<div class="post-metadata">

**Author:** ![abedgarr](https://avatars.discourse-cdn.com/v4/letter/a/d26b3c/32.png) [@abedgarr](https://discourse.nodered.org/u/abedgarr)\
**Post date:** [24 April 2020 14:49 UTC](https://discourse.nodered.org/t/how-send-persist-data-to-cloud/25395/3 "2020-04-24T14:49:15Z")

</div>

1. what is the other device?  
I'm using my PLC s7 without module MQTT

2. are you using the same Beebotte Channel and Resourses for the Pi to revive AND send data?  
I dont use raspberry PI, I am sending and receiving data to / from bebotte to my PLC throught nodered

3. in Beebotte how are the resources configured?

The data type of resource for read in Beebotte is boolean and numeric. Attached imagen

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

1. in Node-red, how have you configured the `MQTT-out` node?
2. in Node-red, how have you configured the `MQTT-in` node?

send flow:

[{"id":"360d7b7c.00db84","type":"tab","label":"Demo 1: Static","disabled":false,"info":""},{"id":"52bb3769.8e4558","type":"mqtt in","z":"360d7b7c.00db84","name":"","topic":"Hola/Joder","qos":"0","datatype":"json","broker":"a7e3e51b.14b6c8","x":280,"y":600,"wires":[["1f2f58f9.a88507"]]},{"id":"31f7840d.6b3b4c","type":"mqtt out","z":"360d7b7c.00db84","name":"","topic":"Hola/Mundo","qos":"","retain":"","broker":"a7e3e51b.14b6c8","x":350,"y":1340,"wires":},{"id":"1f2f58f9.a88507","type":"change","z":"360d7b7c.00db84","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.data","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":640,"wires":[["4ab2201f.35ce3"]]},{"id":"3de7c427.4037ac","type":"mqtt in","z":"360d7b7c.00db84","name":"","topic":"Hola/Analogico","qos":"2","datatype":"json","broker":"a7e3e51b.14b6c8","x":230,"y":720,"wires":[["cd3acde0.1746"]]},{"id":"cd3acde0.1746","type":"change","z":"360d7b7c.00db84","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.data","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":820,"wires":[["bca9cdd6.1f21e","9b7eced7.ac001"]]},{"id":"9b7eced7.ac001","type":"debug","z":"360d7b7c.00db84","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":630,"y":940,"wires":},{"id":"bca9cdd6.1f21e","type":"s7 out","z":"360d7b7c.00db84","endpoint":"24aa267d.cc5b3a","variable":"AYYY","name":"","x":650,"y":840,"wires":},{"id":"b0d425a.a997ed8","type":"s7 out","z":"360d7b7c.00db84","endpoint":"24aa267d.cc5b3a","variable":"AG","name":"","x":650,"y":1020,"wires":},{"id":"87825c60.c58e1","type":"debug","z":"360d7b7c.00db84","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":210,"y":1040,"wires":},{"id":"c2701e9e.3c1d6","type":"s7 in","z":"360d7b7c.00db84","endpoint":"fd95d498.f3b1d8","mode":"single","variable":"Edgar","diff":true,"name":"","x":90,"y":940,"wires":[["87825c60.c58e1","98c84420.7bb558"]]},{"id":"4ab2201f.35ce3","type":"s7 out","z":"360d7b7c.00db84","endpoint":"24aa267d.cc5b3a","variable":"JOJO","name":"","x":650,"y":680,"wires":},{"id":"98c84420.7bb558","type":"mqtt out","z":"360d7b7c.00db84","name":"","topic":"Hola/holi","qos":"","retain":"","broker":"a7e3e51b.14b6c8","x":460,"y":1060,"wires":},{"id":"cb96f234.0e673","type":"s7 in","z":"360d7b7c.00db84","endpoint":"fd95d498.f3b1d8","mode":"single","variable":"JHG","diff":true,"name":"","x":90,"y":1160,"wires":[["98eee397.c8095","31f7840d.6b3b4c"]]},{"id":"98eee397.c8095","type":"debug","z":"360d7b7c.00db84","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":310,"y":1220,"wires":},{"id":"a7e3e51b.14b6c8","type":"mqtt-broker","z":"","name":"","broker":"[mqtt.beebotte.com](http://mqtt.beebotte.com)","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"24aa267d.cc5b3a","type":"s7 endpoint","z":"","transport":"iso-on-tcp","address":"192.168.0.200","port":"102","rack":"0","slot":"2","localtsaphi":"02","localtsaplo":"00","remotetsaphi":"03","remotetsaplo":"00","connmode":"tsap","adapterauto":true,"adapterport":"","busaddr":"2","adapteraddr":"0","cycletime":"500","timeout":"1500","verbose":"default","name":"","vartable":[{"addr":"DB1,WORD0","name":"AYYY"},{"addr":"DBI,X3.0","name":"JOJO"}]},{"id":"fd95d498.f3b1d8","type":"s7 endpoint","z":"","transport":"iso-on-tcp","address":"192.168.0.200","port":"102","rack":"0","slot":"2","localtsaphi":"02","localtsaplo":"00","remotetsaphi":"03","remotetsaplo":"00","connmode":"tsap","adapterauto":true,"adapterport":"","busaddr":"2","adapteraddr":"0","cycletime":"500","timeout":"1500","verbose":"default","name":"","vartable":[{"addr":"DB1,I4","name":"Edgar"},{"addr":"I0.0","name":"JHG"}]}]

1. on the other device, how have you defined the mqtt out and in nodes?  
I simply send and receive data without configuring anything in my PLC

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [24 April 2020 15:15 UTC](https://discourse.nodered.org/t/how-send-persist-data-to-cloud/25395/4 "2020-04-24T15:15:34Z")

</div>

hi, in your screen shot (no.3), you have spelled false incorrectly (fales)

also, your flow export (no.5) your code is mangled. please wrap it in three backticks

`````  
`like this`  
`````

Can you send screen shot of data coming out of `s7 in` nodes (the ones connected to `Hola/holi` and `Hola/Mundo`) - it could be the `payload` from the S7 in nodes are not integer or boolean as is expected by your Beebotte config settings for those two topics?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [24 April 2020 15:27 UTC](https://discourse.nodered.org/t/how-send-persist-data-to-cloud/25395/5 "2020-04-24T15:27:10Z")

</div>

As a test, start simple - like this...

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

(note - it doesnt connect for me - perhaps a user name and password are required?)

try this flow...

```auto
[{"id":"90c3ff03.46a9a","type":"mqtt out","z":"c080bba8.8ac258","name":"","topic":"Hola/Mundo","qos":"","retain":"","broker":"efcffa9d.5ee308","x":430,"y":200,"wires":[]},{"id":"8e082970.cec8b8","type":"mqtt out","z":"c080bba8.8ac258","name":"","topic":"Hola/holi","qos":"","retain":"","broker":"efcffa9d.5ee308","x":420,"y":80,"wires":[]},{"id":"c2f45c80.70bd1","type":"inject","z":"c080bba8.8ac258","name":"","topic":"","payload":"5","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":60,"wires":[["8e082970.cec8b8"]]},{"id":"53d5df36.9e416","type":"inject","z":"c080bba8.8ac258","name":"","topic":"","payload":"10","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":100,"wires":[["8e082970.cec8b8"]]},{"id":"e75ffd23.cad23","type":"inject","z":"c080bba8.8ac258","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":180,"wires":[["90c3ff03.46a9a"]]},{"id":"1e86e59a.f2472a","type":"inject","z":"c080bba8.8ac258","name":"","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":220,"wires":[["90c3ff03.46a9a"]]},{"id":"efcffa9d.5ee308","type":"mqtt-broker","z":"","name":"","broker":"mqtt.beebotte.com","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

```

---

<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:** [24 April 2020 15:34 UTC](https://discourse.nodered.org/t/how-send-persist-data-to-cloud/25395/6 "2020-04-24T15:34:12Z")

</div>

@Steve-Mcl - with Beebotte you need a token stored in the 'Username' field in the 'Security' tab of the server configuration of the MQTT nodes.

@abedgarr Edgar, your flow has two `MQTT-in` and two 'MQTT-out`nodes. To what device is the`MQTT-out`node sending data to, and what device is sending data to the`MQTT-in` node?

What kind of settings are those devices using?

Note: in your `MQTT-out` nodes you haven't set an option for the `QoS` or `Retain` options

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [24 April 2020 15:37 UTC](https://discourse.nodered.org/t/how-send-persist-data-to-cloud/25395/7 "2020-04-24T15:37:41Z")

</div>

Yeah, figured that out.

@abedgarr

works for me...

 ![MfaLkMd72H](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/c/ece9881261f813941bf318b709a9be855ee5eb2a.gif)

using the flow I posted previously (put your API key in the MQTT config node)

---

<div class="post-metadata">

**Author:** ![abedgarr](https://avatars.discourse-cdn.com/v4/letter/a/d26b3c/32.png) [@abedgarr](https://discourse.nodered.org/u/abedgarr)\
**Post date:** [24 April 2020 16:57 UTC](https://discourse.nodered.org/t/how-send-persist-data-to-cloud/25395/8 "2020-04-24T16:57:30Z")

</div>

@Steve-Mcl The problem I have is that if I refresh the beebotte dashboard, the data is lost.  
@zenofmud The PLC logo8 send data at MQTT-out to Beebotte... and too beebotte send data at MQTT-in to PLC.  
I am using: node-red-contrib-s7. I probe with changing the QoS and hold but it doesn't work. Every time I refresh the Beebotte cloud the messages are deleted

---

<div class="post-metadata">

**Author:** ![abedgarr](https://avatars.discourse-cdn.com/v4/letter/a/d26b3c/32.png) [@abedgarr](https://discourse.nodered.org/u/abedgarr)\
**Post date:** [24 April 2020 17:51 UTC](https://discourse.nodered.org/t/how-send-persist-data-to-cloud/25395/9 "2020-04-24T17:51:01Z")

</div>

In beebotte the resources read no have persisted.

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

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [24 April 2020 18:41 UTC](https://discourse.nodered.org/t/how-send-persist-data-to-cloud/25395/10 "2020-04-24T18:41:59Z")

</div>

> [@abedgarr](#):
>
> The problem I have is that if I refresh the beebotte dashboard, the data is lost

This issue is NOT a node-red issue - however curiosity got the better of me

Excerpt from the documentation [here](https://beebotte.com/docs/mqtt)

> In order to persist a message sent using MQTT, the message payload MUST respect the following JSON format: `{"data": object, "write": true}` .

sample flow...

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/5/4533ee3a2d5f2c3e542d891ff924f5ad8b7ea24b.png)

```auto
[{"id":"90c3ff03.46a9a","type":"mqtt out","z":"c080bba8.8ac258","name":"","topic":"test/Mundo","qos":"2","retain":"true","broker":"efcffa9d.5ee308","x":430,"y":200,"wires":[]},{"id":"8e082970.cec8b8","type":"mqtt out","z":"c080bba8.8ac258","name":"","topic":"test/holi","qos":"2","retain":"true","broker":"efcffa9d.5ee308","x":420,"y":80,"wires":[]},{"id":"c2f45c80.70bd1","type":"inject","z":"c080bba8.8ac258","name":"5","topic":"","payload":"{\"data\": 5, \"write\": true}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":60,"wires":[["8e082970.cec8b8"]]},{"id":"53d5df36.9e416","type":"inject","z":"c080bba8.8ac258","name":"10","topic":"","payload":"{\"data\": 10, \"write\": true}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":100,"wires":[["8e082970.cec8b8"]]},{"id":"e75ffd23.cad23","type":"inject","z":"c080bba8.8ac258","name":"true","topic":"","payload":"{\"data\": true, \"write\": true}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":180,"wires":[["90c3ff03.46a9a"]]},{"id":"1e86e59a.f2472a","type":"inject","z":"c080bba8.8ac258","name":"false","topic":"","payload":"{\"data\": false, \"write\": true}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":220,"wires":[["90c3ff03.46a9a"]]},{"id":"efcffa9d.5ee308","type":"mqtt-broker","z":"","name":"","broker":"mqtt.beebotte.com","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"40","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

```

---

<div class="post-metadata">

**Author:** ![abedgarr](https://avatars.discourse-cdn.com/v4/letter/a/d26b3c/32.png) [@abedgarr](https://discourse.nodered.org/u/abedgarr)\
**Post date:** [24 April 2020 19:58 UTC](https://discourse.nodered.org/t/how-send-persist-data-to-cloud/25395/11 "2020-04-24T19:58:09Z")

</div>

I have copied what you have sent me, I have created a new channel and source, and it has worked for me regularly, my question is how you changed : {"data": object, "write": _true_} and... `{"data": object, "ispublic": true}` . I got "ispublic":false, I wish change it to true  
Sorry, I am just beginning in this world of programming

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [24 April 2020 20:00 UTC](https://discourse.nodered.org/t/how-send-persist-data-to-cloud/25395/12 "2020-04-24T20:00:16Z")

</div>

> [@abedgarr](#):
>
> `{"data": object, "ispublic": true}`

^ that is incorrect

Look at my example flow - I did this...  
`{"data": true, "write": true}` or `{"data": false, "write": true}`

---

<div class="post-metadata">

**Author:** ![abedgarr](https://avatars.discourse-cdn.com/v4/letter/a/d26b3c/32.png) [@abedgarr](https://discourse.nodered.org/u/abedgarr)\
**Post date:** [24 April 2020 20:39 UTC](https://discourse.nodered.org/t/how-send-persist-data-to-cloud/25395/13 "2020-04-24T20:39:13Z")

</div>

You have reason!. I'm sorry, but How write that code, if I use S7 node.  
Attached image:

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

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [24 April 2020 21:02 UTC](https://discourse.nodered.org/t/how-send-persist-data-to-cloud/25395/14 "2020-04-24T21:02:30Z")

</div>

you need to put something inbetween the s7 node and the MQTT Out node to "translate" it

thats why I asked

> [@Steve-Mcl](#):
>
> Can you send screen shot of data coming out of `s7 in` nodes

So - change he debug node (set the option "complete message") on the end of S7 node, expand the debug output msg (to show all properties & values) and screen shot it.

---

<div class="post-metadata">

**Author:** ![abedgarr](https://avatars.discourse-cdn.com/v4/letter/a/d26b3c/32.png) [@abedgarr](https://discourse.nodered.org/u/abedgarr)\
**Post date:** [24 April 2020 21:23 UTC](https://discourse.nodered.org/t/how-send-persist-data-to-cloud/25395/15 "2020-04-24T21:23:59Z")

</div>

Excuse me.  
Attached image

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

I appreciate very much that you are helping me

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [24 April 2020 21:27 UTC](https://discourse.nodered.org/t/how-send-persist-data-to-cloud/25395/16 "2020-04-24T21:27:31Z")

</div>

put a function node between s7 and mqtt nodes with this code...

```auto
let value = msg.payload;
msg.payload = {
  {"data": value, "write": true} 
}
return msg;

```

---

<div class="post-metadata">

**Author:** ![abedgarr](https://avatars.discourse-cdn.com/v4/letter/a/d26b3c/32.png) [@abedgarr](https://discourse.nodered.org/u/abedgarr)\
**Post date:** [24 April 2020 21:40 UTC](https://discourse.nodered.org/t/how-send-persist-data-to-cloud/25395/17 "2020-04-24T21:40:31Z")

</div>

@Steve-Mcl Thanks a lot!!!!!!!!!!!  
It worked for me, honestly thank you very much!

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/4/145774171395ddfd6160e798e074a156ca68db3a.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:** [8 May 2020 21:40 UTC](https://discourse.nodered.org/t/how-send-persist-data-to-cloud/25395/18 "2020-05-08T21:40:41Z")

</div>

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