Closed shinobu1234 closed 6 years ago
Yes. The current desing is wrong for that purpose. I can modify it to reuse the inconming message so no properties are lost.
I can commit the changes to the master branch. Could you help me testing it?
Regards,
Then that will simplify matters. I'll test of course.
I commit a quick fix among other pending commits I had. It's not tested and not updated on nmp yet. You can test if works however.
it's work! thank you!
Great! I will in publish the new version to npm soon. Could you share a sample flow with http integration? I will put on the respository to help other users.
Regards,
JSON version sample. Data of the JSON form can be acquired. http: //{Node-RED host-ip}: 1880/bme280json
[{"id":"17646079.863cc","type":"http in","z":"9b546cc2.584d9","name":"","url":"bme280json","method":"get","upload":false,"swaggerDoc":"","x":110,"y":860,"wires":[["56ddef05.a245c"]]},{"id":"12587b55.d46e65","type":"http response","z":"9b546cc2.584d9","name":"","statusCode":"200","headers":{},"x":720,"y":860,"wires":[]},{"id":"56ddef05.a245c","type":"Bme280","z":"9b546cc2.584d9","name":"","bus":"1","address":"0x76","topic":"bme280","extra":false,"x":280,"y":860,"wires":[["46a48ddd.381ca4"]]},{"id":"46a48ddd.381ca4","type":"json","z":"9b546cc2.584d9","name":"","property":"payload","action":"","pretty":false,"x":410,"y":860,"wires":[["7dc41cd6.f34034"]]},{"id":"7dc41cd6.f34034","type":"template","z":"9b546cc2.584d9","name":"plain json","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{payload}}","output":"str","x":560,"y":860,"wires":[["12587b55.d46e65"]]}]
enjoy.
HTML version sample flow. Data can be acquired by a web page. http: //{Node-RED host-ip}: 1880/bme280
[{"id":"17646079.863cc","type":"http in","z":"9b546cc2.584d9","name":"","url":"bme280","method":"get","upload":false,"swaggerDoc":"","x":90,"y":860,"wires":[["56ddef05.a245c"]]},{"id":"12587b55.d46e65","type":"http response","z":"9b546cc2.584d9","name":"","statusCode":"200","headers":{},"x":600,"y":860,"wires":[]},{"id":"2a13956c.f3379a","type":"template","z":"9b546cc2.584d9","name":"メインHTML","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"BME280 DATA: <BR>\n<HR>\nTEMPERATURE: {{payload.temperature_C}}<BR>\nPRESSURE: {{payload.pressure_hPa}}<BR>\nHUMIDITY: {{payload.humidity}}<BR>\n<HR>","output":"str","x":430,"y":860,"wires":[["12587b55.d46e65"]]},{"id":"56ddef05.a245c","type":"Bme280","z":"9b546cc2.584d9","name":"","bus":"1","address":"0x76","topic":"bme280","extra":false,"x":260,"y":860,"wires":[["2a13956c.f3379a"]]}]
Thanks! I will include them in the project!
this node does lose any message properties of the received message. msg.req msg.res to be also lost, it isn't possible to use in HTTP In/Response.