简体   繁体   中英

Connect Raspberry Pi 3 to the IBM Cloud using Node-RED

I referenced the [Configure a Raspberry Pi and connect it to Watson IoT Platform]

In that, I am using Node-RED of Raspberry Pi 3 and send the data to IBM Cloud.

I use the Function Node for transform to Watson IoT Format, So, I write the code in function node.

msg.payload={'d':{'temp':msg.payload.replace("temp=","").replace("'C\n","")}}

However, it has the result that represent {d:obeject} I want to represent {"d":{"temp":"45.5"}}

Did I miss something?

I attached image file.

在此处输入图片说明

The Debug sidebar shows a structured, interactive, view of the message.

If you click on the {d: object } line it will expand to reveal its structure.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM