How send persist data to cloud

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

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?
  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

  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","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

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?

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

image

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

try this flow...

[{"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":""}]

@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-outnodes. To what device is theMQTT-outnode sending data to, and what device is sending data to theMQTT-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

Yeah, figured that out.

@abedgarr

works for me...

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

@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

In beebotte the resources read no have persisted.

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

Excerpt from the documentation here

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

[{"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":""}]

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

^ that is incorrect

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

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

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

thats why I asked

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.

Excuse me.
Attached image

I appreciate very much that you are helping me

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

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

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

1 Like

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