# Knx with raspberry

**URL:** <https://discourse.nodered.org/t/knx-with-raspberry/5872>\
**Category:** General\
**Created:** [17 December 2018 09:44 UTC](https://discourse.nodered.org/t/knx-with-raspberry/5872 "2018-12-17T09:44:16Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![gaara7271](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gaara7271/32/7474_2.png) [@gaara7271](https://discourse.nodered.org/u/gaara7271)\
**Post date:** [17 December 2018 09:44 UTC](https://discourse.nodered.org/t/knx-with-raspberry/5872/1 "2018-12-17T09:44:16Z")

</div>

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...😃

---

<div class="post-metadata">

**Author:** ![Rulevalley](https://avatars.discourse-cdn.com/v4/letter/r/3be4f8/32.png) [@Rulevalley](https://discourse.nodered.org/u/Rulevalley)\
**Post date:** [8 February 2019 19:28 UTC](https://discourse.nodered.org/t/knx-with-raspberry/5872/2 "2019-02-08T19:28:59Z")

</div>

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

> **[Raspberry Pi: EIB/KNX IP Gateway and Router with knxd](https://michlstechblog.info/blog/raspberry-pi-eibknx-ip-gateway-and-router-with-knxd/)**
>
> Hi,
> 
> in my previous posts EIB/KNX Router with an USB Interface and KNX/EIB Router with a TPUART module I described how to use a Raspberry PI as EIB/KNX Router with eibd.
> 
> eibd is no longer in development so I decided to give knxd, a fork of eibd,...

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:47[node: 81561b16.33f618](http://100.0.0.160:1880/#)knx:event : msg.payload : Object  
{ srcphy: "1.1.16", dstgad: "2/0/4", dpt: "no\_dpt", value: "26.5", type: "event" }

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [8 February 2019 22:06 UTC](https://discourse.nodered.org/t/knx-with-raspberry/5872/3 "2019-02-08T22:06:42Z")

</div>

> [@Rulevalley](#):
>
> I cant filter or use it.

What do you mean by that?

---

<div class="post-metadata">

**Author:** ![Rulevalley](https://avatars.discourse-cdn.com/v4/letter/r/3be4f8/32.png) [@Rulevalley](https://discourse.nodered.org/u/Rulevalley)\
**Post date:** [9 February 2019 19:09 UTC](https://discourse.nodered.org/t/knx-with-raspberry/5872/4 "2019-02-09T19:09:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [9 February 2019 21:17 UTC](https://discourse.nodered.org/t/knx-with-raspberry/5872/5 "2019-02-09T21:17:16Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Rulevalley](https://avatars.discourse-cdn.com/v4/letter/r/3be4f8/32.png) [@Rulevalley](https://discourse.nodered.org/u/Rulevalley)\
**Post date:** [9 February 2019 21:44 UTC](https://discourse.nodered.org/t/knx-with-raspberry/5872/6 "2019-02-09T21:44:47Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [9 February 2019 21:56 UTC](https://discourse.nodered.org/t/knx-with-raspberry/5872/7 "2019-02-09T21:56:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Rulevalley](https://avatars.discourse-cdn.com/v4/letter/r/3be4f8/32.png) [@Rulevalley](https://discourse.nodered.org/u/Rulevalley)\
**Post date:** [9 February 2019 22:48 UTC](https://discourse.nodered.org/t/knx-with-raspberry/5872/8 "2019-02-09T22:48:19Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/4/471260ec25c0bcbdf4db85fc4a16a1fb0435fee2.png)  
I then send the value to a bar graph  
But it still need some adjustment 😄

This is starting to get exciting

/Øystein

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [10 February 2019 09:47 UTC](https://discourse.nodered.org/t/knx-with-raspberry/5872/9 "2019-02-10T09:47:26Z")

</div>

What does that function return if the test fails?

---

<div class="post-metadata">

**Author:** ![Rulevalley](https://avatars.discourse-cdn.com/v4/letter/r/3be4f8/32.png) [@Rulevalley](https://discourse.nodered.org/u/Rulevalley)\
**Post date:** [10 February 2019 10:25 UTC](https://discourse.nodered.org/t/knx-with-raspberry/5872/10 "2019-02-10T10:25:54Z")

</div>

Nothing.  
If the test fails the message stops.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [10 February 2019 10:38 UTC](https://discourse.nodered.org/t/knx-with-raspberry/5872/11 "2019-02-10T10:38:11Z")

</div>

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

```auto
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.
