# Function to orient the payload (of an energy meter) according to a number

**URL:** <https://discourse.nodered.org/t/function-to-orient-the-payload-of-an-energy-meter-according-to-a-number/94135>\
**Category:** General\
**Tags:** function-node\
**Created:** [24 December 2024 11:29 UTC](https://discourse.nodered.org/t/function-to-orient-the-payload-of-an-energy-meter-according-to-a-number/94135 "2024-12-24T11:29:14Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ives25](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ives25/32/39877_2.png) [@Ives25](https://discourse.nodered.org/u/Ives25)\
**Post date:** [24 December 2024 11:29 UTC](https://discourse.nodered.org/t/function-to-orient-the-payload-of-an-energy-meter-according-to-a-number/94135/1 "2024-12-24T11:29:15Z")

</div>

Hello,  
The first part of the energy counting from a meter containing the energy values ​​and the tariff works.  
I started the second part which consists of starting from a meter containing only the active energy value to create six indexes for the six different tariffs.  
The extraction of the tariffs works (tariffs from 5 to 10) but I do not know how to implement the function that would allow to increment each of the six tariffs from the energy meter and the tariffs.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/d/0da916b03c2fda31866da291c9e97ba529f9f4b9.jpeg)

[flows.json](https://discourse.nodered.org/uploads/short-url/3e7wxDOueRrJmWBBMsf4ytHysYp.json) (35.2 KB)

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [24 December 2024 12:59 UTC](https://discourse.nodered.org/t/function-to-orient-the-payload-of-an-energy-meter-according-to-a-number/94135/2 "2024-12-24T12:59:12Z")

</div>

I have downloaded your flow and glanced at it.

Unfortunately I don't have the knxUltimate node, nor a smart meter of the same type as yours or access to your tariff data.

It might be a good idea to share the output of your knxUltimate (post as data not a screenshot) so that we know what you are working on.

You have not said why you need a separate output for each tariff so we can't tell if you are using the nodes in the most efficient way. However I am pretty sure that you can get rid of most of the change nodes by using msg.topic to keep track of the tariff number/colour.

Your function node contains no code so gives no clue what you want it to do. A more detailed account of the desired output is vital if you want advice.

---

<div class="post-metadata">

**Author:** ![Ives25](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ives25/32/39877_2.png) [@Ives25](https://discourse.nodered.org/u/Ives25)\
**Post date:** [24 December 2024 13:26 UTC](https://discourse.nodered.org/t/function-to-orient-the-payload-of-an-energy-meter-according-to-a-number/94135/3 "2024-12-24T13:26:50Z")

</div>

Thanks for your feedback  
I don't know how to publish the output of knxultimate as data ?

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/e/fe42799a7895028a7827a7c99447e30839972bd1.png)

13.010 DPT\_ActiveEnergy 4 bytes Long [-2 147 483 648 … 2 147 483 647] Wh

235.001 Tariff\_ActiveEnergy 6 bytes String V₃₂U₈C₆B₁A₁  
V = [-2 147 483 648 l … 2 147 483 647]; U = [0 … 254]; C = {000000}; B,A = {0,1}

I know that the function does not contain any code because I did not get anywhere; it was to give an idea of ​​what I wanted to know:

- from an energy meter only contains the consumption information and by using the figures of the different pricing periods have the consumption for each pricing period.

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [24 December 2024 13:37 UTC](https://discourse.nodered.org/t/function-to-orient-the-payload-of-an-energy-meter-according-to-a-number/94135/4 "2024-12-24T13:37:08Z")

</div>

The debug node can be used to get data output from any node.

There’s a great page in the docs ([Working with messages : Node-RED](https://nodered.org/docs/user-guide/messages)) that will explain how to use the debug panel to find the right path/value for any data item.

Pay particular attention to the part about the buttons that appear under your mouse pointer when you over hover a debug message property in the sidebar.

![BX00Cy7yHi](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/d/bd1f333a9e043b061b39917c328b0094d3e52d30.gif)

The [essentials videos](https://m.youtube.com/watch?list=PLyNBB9VCLmo1hyO-4fIZ08gqFcXBkHy-6&v=ksGeUD26Mw0&embeds_referring_euri=https%3A%2F%2Fnodered.org%2F&source_ve_path=OTY3MTQ&feature=emb_imp_woyt) are worth a view as will give you many ideas of how to retrieve information and how to use many of the standard nodes.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [24 December 2024 13:40 UTC](https://discourse.nodered.org/t/function-to-orient-the-payload-of-an-energy-meter-according-to-a-number/94135/5 "2024-12-24T13:40:21Z")

</div>

> [@Ives25](#):
>
> I don't know how to publish the output of knxultimate as data ?

Use a debug node set to show the complete message object.  
Then in the debug panel use the "Copy value" button.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/7/67fd605f92592798ad7c57f3426b6b3a7a7af59e.png)

And paste the value here using the `</>` button so that what you post gets three backticks on the line above and the line below it.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/5/15f769769a912d52480e20c8cc8765df7eea3956.png)

---

<div class="post-metadata">

**Author:** ![Ives25](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ives25/32/39877_2.png) [@Ives25](https://discourse.nodered.org/u/Ives25)\
**Post date:** [24 December 2024 13:48 UTC](https://discourse.nodered.org/t/function-to-orient-the-payload-of-an-energy-meter-according-to-a-number/94135/6 "2024-12-24T13:48:47Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/4/542ad3f49273fbd1daa9100a3e0e7a610530c363.png)

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/f/8fc160bd9da71ff45c80f376354a0956b022cf99.png)

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/b/5be5c069d5c92c2fb8c320477f88d1ecf5c486a0.png)

```auto
{"activeElectricalEnergy":1537750,"tariff":6,"validityTariff":false,"validityEnergy":false}

```

{"activeElectricalEnergy":1537750,"tariff":6,"validityTariff":false,"validityEnergy":false}

---

<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:** [24 March 2025 13:49 UTC](https://discourse.nodered.org/t/function-to-orient-the-payload-of-an-energy-meter-according-to-a-number/94135/7 "2025-03-24T13:49:30Z")

</div>

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