How to use values in different magnitudes coming from different sensors

Hey there!
I am pretty new to openHAB and quite impressed about the possibilites! Especially I like the idea to combine hardware from different vendors and technologies under one system.
However I ran across a small issue when I tried to combine energy-meter values from Fritz-AHA and Z-Wave (Fibaro) devices. Fritz-AHA give the values as number in unit [Wh] while the fibaro-plug gives energy value as float in unit [kWh]. When I do calculations later in rules I have to remember were the value came from (Fritz-AHA or Fibaro) to equalize the magnitude. This is not nice! Does openHAB offers something here, i.e. to set the magnitude in item configuration?

Many thanks in advance!

Thinking-Out-Loud…

The device may offer some control in its configuration options, so I’d start with (sigh) reading the manual on it.

If there’s no option there, then some construct like:

Number temp1 {binding to read the Fritz-AHA}
Number temp2 temp1*1.0/1000

Something like that might work directly in ITEMS. (DK, just thinking…)

If still no joy, then do the math in your rules via:
//initialize
var Fritz-converted = Fritz-AHA*1.0/1000

and combine with

when
Item Fritz-AHA changed
then
Fritz-converted=1.0*Fritz-AHA/1000
end

1 Like

Hi Bob!

Thanks for the reply. I checked manuals for both devices and there seems no such configuration option (or I missed it).

However I think the solution you drafted should do the job well for sure. I will try it on next occasion.

Thanks again!