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

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.

flows.json (35.2 KB)

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.

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

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.

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) 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

The essentials videos are worth a view as will give you many ideas of how to retrieve information and how to use many of the standard nodes.

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

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

image

image

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

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