Knx with raspberry


#1

Hi everyone,
I want connect raspberry into knx network by node-red. Some tutorial use KNX IP, but i having KNX USB interface. What should i do ?
Sorry, my language isn't english...:smiley:


#2

Same issue here.
I found a tutorial in michaels tech blog

That got me only so far......
Hoping to some hints from more experienced users.
I now get the telegram in to Node-red, But I cant send i back to the bus, and I cant filter or use it........

8.2.2019, 20:27:47node: 81561b16.33f618knx:event : msg.payload : Object
{ srcphy: "1.1.16", dstgad: "2/0/4", dpt: "no_dpt", value: "26.5", type: "event" }


#3

What do you mean by that?


#4

The message comes in unfiltered. So I have to filter or somehow use it to show the state or value for the different tempatures etc.

for example :
in 2/0/4 it comes in a temperature, and I woul like to log it and show the latest value in a desktop.
The only thing I have managed to perform so far, is to send me the message on Email.

/Øystein


#5

Looking back at what you posted you can see that msg.payload is an object containing attributes srcphy which is a string "1.1.16", value, which again is a string "26.5" and so on. If it is specifically the value attribute you want then you could feed the message through a Change node configured to Move msg.payload.value To msg.payload, which would give you, in this case, "26.5" in the payload of the message passed on. You could then pass that to a text display node, or a graph or gauge or whatever. You can obviously extract the other items similarly if you want them.
Is that what you are looking for?


#6

Yes thats what I am looking for. A way to show this as a number on the dashboard.
I have found a way now, send telegrams in to the KNX bus.
Now I`m looking for a way to show the values.
Maybe in a function module ?
How can I setup a module that filter on group adress 2/0/4 send only the values further onto a gauge ?


#7

First use a Switch node that tests for msg.payload.tstgad == 2/0/4 (string type) and sends it to output 1, you can test for others and send to other outputs. Then extract the value as I said in the last post and send that to the dashboard node.


#8

Thanks. I also found a way t use the function mode with the same solution :slight_smile:


I then send the value to a bar graph
But it still need some adjustment :smile:

This is starting to get exciting

/Øystein


#9

What does that function return if the test fails?


#10

Nothing.
If the test fails the message stops.


#11

If the test fails then it will do return undefined. Whilst this apparently is not an error it is certainly not good practice. Instead I would have done

if (msg.payload.dstgad === "2/0/1") {
  msg.payload = msg.payload.value
  return msg
}

Note that there is no return on the end so it does not try to return anything if the test fails.
Also note that it is passing on the same message that came in, which is more efficient and also does not remove any additional properties that may be defined on the message.