Problem understanding OWFS node

#1

Hello guys,
at the moment i try to build a 1-W to Ethernet Gateway. Therefor i have a raspberry pi with a 9 channel 1-W Shield. It runs well with piCore. Now i like to publish the sensor data via node-red to MQTT / UDP Listener on another system. I have found the OWFS-Node, which provides the functions i need. But i dont know how to use it.
If i put the node to the flow and open the edit dialog, i can see all devices, which are connected, with the possible sensor data. I can also choose which data i like to send.

But how can i start the node to read the data from bus and send the data to the output?

I have tested some things like the use of the inject node, but if i use it, i have to put a single device as input parameter. I have also tried to use the inject node without any arguments. In this case node red crashed and i have had to delete the flow.

In short, i like to start the node without any parameters, the node should read the sensor data for the selected data points in the config and send it to the output.

I would be happy, if someone can tell me a solution for my problem.

Thank you in advance, Bjoern

0 Likes

#2

Assuming you are using node-red-contrib-owfs then if you pass in a message with a topic set then it will cause a read from the device specified in the topic. If you pass in a message with no topic then that should cause it to read the devices configured in the node. I prefer to pass in a topic so it is clear from the flow what is happening. If you configure it in the node it is very easy to accidentally mess up the config, but that is up to you.

You say the node-red crashes if you do this but that should certainly not happen. I suggest first trying an inject node with no topic to inject only when you click it. Feed the output of the 1-wire node into a debug node and nothing else. Then open a terminal and stop node red and start it using node-red-start. That will give you a log in the terminal window. Let it startup fully then click the inject. Go back to the terminal (or even better arrange the windows so both are on screen at once) and see what you see in the log. If node red does crash in that situation Then copy/paste the log (from the Welcome message) for us to see.

0 Likes

#3

You realise that owserver (which you have presumably installed for the owfs node) is itself a 1-wire to Ethernet Gateway? Presumably you are trying to do more than just that.

0 Likes

#4

Hello Colin,

it’s very interessting. On my Pi it works as you described. I have a inject node with payload = empty string and topic = empty; a owfs node with selected data points and a debug node. I can see the data in the debug window and in the terminal window.

On my netbook wich runs ubuntu, owserver with fake devices i get this error message and node-red crashes

2 Jul 19:04:36 - [red] Uncaught Exception:
2 Jul 19:04:36 - TypeError: Cannot read property ‘replace’ of null
at /home/bjoern/.node-red/node_modules/owfs/lib/base/convert.js:30:54
at callbackOnce (/home/bjoern/.node-red/node_modules/owfs/lib/base/communication.js:30:13)
at Socket. (/home/bjoern/.node-red/node_modules/owfs/lib/base/communication.js:75:9)
at Socket.emit (events.js:187:15)
at endReadableNT (_stream_readable.js:1081:12)
at process._tickCallback (internal/process/next_tick.js:63:19)

You are also right, that owserver is a 1-W to ETH GW. I have forgotten to tell you, that i like to send frequently a summary in JSON format. For temperature every 5 mins, for window contacts every 30 secs.

0 Likes

#5

What versions of node-red and node.js are you using? Running node-red-log on the Ubuntu machine will tell you.

In fact if you have not already done so then update everything on the Ubuntu machine using the bash <(curl command from https://nodered.org/docs/hardware/raspberrypi. That works on all recent Debian based distributions, provided it is at least Ubuntu 16.04 it should do the business.

0 Likes