Display the consumed energy for every single device in a Trend

Hi together,

i have a site with three electric devices but only one energy meter.
The task is to display the consumed energy for every single device in a Trend.
So i get the actual consumed accumulated Energy from the energymeter
There is only one device at time in operation and i have for every device a operational message.

I have tried to solve the task with lens visualization. In my mind i need some variables to
solve the problem.
If the device 1 is in operation, lets save the actual accumulated energy and wait if the device
is not more in operation and subtract the first saved value from the present accumulated energy.
The result should be saved in a variable, but how ? :upside_down_face:

here is my code:

ifelse( last_value(value.value_float32,kql='sensor.name.keyword : "air_01_compressor_03_working_b" ') == 1, 0, last_value(value.value_float32, kql='sensor.name.keyword : air_01_kompressor_03_energy-sum_m and value.value_float32 : * ') - last_value(value.value_float32, kql='sensor.name.keyword : air_01_kompressor_03_energy-sum_m and value.value_float32 : * ', shift='"1d'))

Elastic Version: 8.6.1

Maybe someone have an idea or tip how to solve it ? :smiley:

Greetz

Thomas

Sorry for the late reply, have you already solved your issue?

No Problem. Jep, i have already the problem

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