1-wire to MQTT bridge

This flow is an example of using the owfs node type which can be found here: https://www.npmjs.org/package/node-red-contrib-owfs

This simple flows reads a 1-wire temperature sensor using owfs and publishes the reading to MQTT as a retained message.


In this flow, the inject node is used to specify the name of the 1-wire device to be read from, this triggers every 10 seconds. When the owfs node receives this message, it makes a query to owserver, running on the same machine. It takes a temperature reading and outputs the temperature value in msg.payload.

The change node is used to set msg.retain to true - this causes MQTT to keep a copy of the latest temperature reading, so when a new client subscribes, it immediately gets a value.

[{"id":"eb19c569.14e638","type":"mqtt-broker","broker":"localhost","port":"1883"},{"id":"a505fac.f5afa08","type":"owfs","name":"","host":"localhost","port":"4304","paths":[],"x":303,"y":231,"z":"792ca5d.f86d35c","wires":[["30f9454a.cf06ba"]]},{"id":"20e02457.df1fdc","type":"inject","name":"28.E87BC4030000","topic":"28.D8FE434D9855/temperature","payload":"","payloadType":"none","repeat":"10","crontab":"","once":true,"x":136,"y":231,"z":"792ca5d.f86d35c","wires":[["a505fac.f5afa08"]]},{"id":"c8ea9dff.37156","type":"mqtt out","name":"","topic":"","qos":"","retain":"","broker":"eb19c569.14e638","x":639,"y":280,"z":"792ca5d.f86d35c","wires":[]},{"id":"30f9454a.cf06ba","type":"change","action":"replace","property":"retain","from":"","to":"true","reg":false,"name":"","x":459,"y":231,"z":"792ca5d.f86d35c","wires":[["c8ea9dff.37156","97c00da7.683ff"]]},{"id":"97c00da7.683ff","type":"debug","name":"","active":true,"console":false,"complete":false,"x":661,"y":201,"z":"792ca5d.f86d35c","wires":[]}]

Flow Info

created 2 years, 10 months ago
updated 2 years, 9 months ago

Node Types

  • change (x1)
  • debug (x1)
  • inject (x1)
  • mqtt out (x1)
  • mqtt-broker (x1)


  • 1-wire
  • mqtt
  • owfs
  • DS18B20
  • DS18S20
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option