# Switch object info to diffrent outputs

**URL:** <https://discourse.nodered.org/t/switch-object-info-to-diffrent-outputs/24558>\
**Category:** General\
**Created:** [10 April 2020 00:29 UTC](https://discourse.nodered.org/t/switch-object-info-to-diffrent-outputs/24558 "2020-04-10T00:29:09Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![espenbo](https://avatars.discourse-cdn.com/v4/letter/e/c57346/32.png) [@espenbo](https://discourse.nodered.org/u/espenbo)\
**Post date:** [10 April 2020 00:29 UTC](https://discourse.nodered.org/t/switch-object-info-to-diffrent-outputs/24558/1 "2020-04-10T00:29:09Z")

</div>

Hello  
I have a output from a energy meter. I can send it to a mqtt broker. But how do i switch the object info from the meter node to diffrent messageses.

 ![bilde](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/3/03896615dc92e3ea3034577f3a45db523303b42e.png)  
 ![bilde](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/6/56cce6662dcb38846ee7b0b93dbde9e1cce0af47.png)

I'm intrested inn the values from:  
act\_pow\_pos:  
act\_pow\_neg:  
react\_pow\_pos:  
react\_pow\_neg:  
curr\_L1:  
curr\_L2:  
curr\_L3:  
volt\_L1:  
volt\_L2:  
volt\_L3:

```auto
[{"id":"9ed3dad7.fdea18","type":"serial in","z":"47e4bab9.41def4","name":"","serial":"9fe0bf84.66e9a","x":420,"y":320,"wires":[["d76de71a.2bc9c"]]},{"id":"d76de71a.2bc9c","type":"function","z":"47e4bab9.41def4","name":"Buffer to string","func":"msg.payload = msg.payload.toString('hex');\nreturn msg;","outputs":1,"noerr":0,"x":600,"y":320,"wires":[["ae53b2.06107c5"]]},{"id":"ae53b2.06107c5","type":"AMS Decoder Kamstrup","z":"47e4bab9.41def4","name":"","x":780,"y":320,"wires":[["836416f7.c6bb7","62cbcaee.fee3e4","ab3051ad.d6031"]]},{"id":"836416f7.c6bb7","type":"debug","z":"47e4bab9.41def4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":970,"y":320,"wires":[]},{"id":"2c4461da.c2a49e","type":"json","z":"47e4bab9.41def4","name":"","x":591.5993957519531,"y":482.0909118652344,"wires":[["a4aff834.a95c78"]]},{"id":"7c010d64.bebb94","type":"debug","z":"47e4bab9.41def4","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1190,"y":360,"wires":[]},{"id":"ab3051ad.d6031","type":"switch","z":"47e4bab9.41def4","name":"","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"curr_L1","vt":"str"},{"t":"cont","v":"volt_L3","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":950,"y":380,"wires":[["7c010d64.bebb94"],["480a346d.940924"]]},{"id":"480a346d.940924","type":"debug","z":"47e4bab9.41def4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1170,"y":420,"wires":[]},{"id":"9fe0bf84.66e9a","type":"serial-port","z":"","serialport":"/dev/ttyUSB0","serialbaud":"2400","databits":"8","parity":"none","stopbits":"1","waitfor":"","dtr":"none","rts":"none","cts":"none","dsr":"none","newline":"1500","bin":"bin","out":"interbyte","addchar":"","responsetimeout":"10000"}]

```

Thank you

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [10 April 2020 00:43 UTC](https://discourse.nodered.org/t/switch-object-info-to-diffrent-outputs/24558/2 "2020-04-10T00:43:54Z")

</div>

I'm not sure what this `Kamstrup` node is or does.

Where are you seeing/getting the output you posted? (Which node)  
[![](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/3/03896615dc92e3ea3034577f3a45db523303b42e.png) ](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/3/03896615dc92e3ea3034577f3a45db523303b42e.png)

Let's start there.

I'm guessing the next step will be the `split` node to split the message.  
Then, we can start rearranging things to suit needs.

---

<div class="post-metadata">

**Author:** ![espenbo](https://avatars.discourse-cdn.com/v4/letter/e/c57346/32.png) [@espenbo](https://discourse.nodered.org/u/espenbo)\
**Post date:** [10 April 2020 01:17 UTC](https://discourse.nodered.org/t/switch-object-info-to-diffrent-outputs/24558/3 "2020-04-10T01:17:03Z")

</div>

Hello.  
the kamstrup node is a mbus/HAN port converter to get energy values from the energy meters in Norway. node-red-contrib-ams-decoder

I found out that I can use a debug output and use 'msg.payload.curr\_L2' then I get the rigth value.  
So the next is to get it to send values to the influx database I have.  
I get errors

 ![bilde](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/7/e72572d37bc6e2e3a0e298c19d7fac62e2b64d18.png)  
 ![bilde](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/6/969fa29141765c9e17e8696072e30d611583887e.png)

I have setup the node red influxdb with the same adresses and passwords as I use with InfluxDB Studio

But the logg gives me error  
Apr 10 03:15:13 piUNFI Node-RED[22342]: 10 Apr 03:15:13 - [error] [influxdb in:20e9f519.e400c2] Error: Request timed out  
could it be somting with IP4 vs IP6?

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [10 April 2020 01:19 UTC](https://discourse.nodered.org/t/switch-object-info-to-diffrent-outputs/24558/4 "2020-04-10T01:19:21Z")

</div>

sorry, but any/all database programs are way WAY out of my scope of knowledge.

And I have no knowledge of this _mbux/HAN_ thing.

Sorry. I'm still learning. (Or trying to)

---

<div class="post-metadata">

**Author:** ![espenbo](https://avatars.discourse-cdn.com/v4/letter/e/c57346/32.png) [@espenbo](https://discourse.nodered.org/u/espenbo)\
**Post date:** [10 April 2020 01:25 UTC](https://discourse.nodered.org/t/switch-object-info-to-diffrent-outputs/24558/5 "2020-04-10T01:25:17Z")

</div>

I'm trying to learn to 🙂  
Thank you for taking the time to replay. I will post more as I get things working, Maby more people can learn from it

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [10 April 2020 05:24 UTC](https://discourse.nodered.org/t/switch-object-info-to-diffrent-outputs/24558/6 "2020-04-10T05:24:34Z")

</div>

> But how do i switch the object info from the meter node to diffrent messageses.

Instead of "switching", use a change node to "extract" the info you are interested in.

 ![Screenshot 2020-04-10 at 07.23.44](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/b/dbeeed17d0c43c1de7f5bf2cf2008203cb808cb6.jpeg)

Note that most output-nodes can read the values directly in the same manner.  
In the debug node you could also use payload.curr\_L1 and see the output for example.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [9 June 2020 05:38 UTC](https://discourse.nodered.org/t/switch-object-info-to-diffrent-outputs/24558/7 "2020-06-09T05:38:14Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
