Correct format of Current Power in Watt

Hi,
i have an tp-link power plug with messurement. I added it as thing and create an Dummy in HabPanel. I visit the Documentation about Units of Measurement and tried different Units for Energy and Power, e.g. “Watt”, “Watt Hour” and other, but non of this shows readable value. I suspected it like this 11.5W, but get 0.1153341Awatt or 0.1153341 Awatt Second. I use openhab 2.4.0-1 on debian stretch.
What is the right way?

What does this mean? It doesn’t make any sense.

The Thing will have Channels. Each Channel can only be used with a specific Item type. Not all Channels support Units of Measure. For example, this Channel from a Zwave energy meter

image

can only be linked to a Number Item without Units of Measure.

This Channel from OpenWeatherMap can only be linked to a Number:Temperature Item.

image

If you are dealing with a Number without UOM like the first example, you cannot use UOM to convert it to other units.

For this Channel, in order to use UOM the Item type shown in PaperUI will be Number:Energy and the units supported are Ws, Wh, and kWh.

Hi Rich,
sorry Dummy is the widget i used to show the values of the power meter. I use the TP-Link Smart Home Binding and the Channel shows only Number, like your first example. So i can nothing do to get a readable value in HABPanel?

It depends on what you mean by “readable”. There should be something in the binding docs or the device documentation somewhere to tell you what units that Channel if providing. Once you know the units being returned, you can, if you need to, use a transform to convert that to some other unit, round the result, etc.

Hi,
i found nothing in the docs, or missed it. I got actually 0.098234 as result for Watt of my Intel NUC. Thats 9.8234 Watt. So better readable means 9.82 Watt for example. Thats the aim.

The channels are plain number channels and not UoM. So you need to define them as Number. In habpanel configure to use format "%.2f W". I would guess this should work.


Use a JS Transform on the label to multiply the value and round it in the label of your Item. The first link has a bunch of examples.

Hi,
@hilbrand - i tried it allready before and the Value changed to 0.09W or 0.10W but it is 9.00W or 10.00W in real.

@rlkoshak - i read your link for JavaScript Transform Service and this happend on code level, right? If so, than i dont know where to change that. Perhaps one of the maintainer of the Binding can correct this, because i see this on code level. If it messure the Power in Watt, than the Transform Service by OPENHab can be used and not only the number format, right? Might be a better solution in generall.

What value does it display in PaperUI (or other UI?) Or in the log when the value is changed? Showing 0.09 (which would suggest 90 milliwatt) when it’s 9 Watt is not a conversion I can explain somehow. So either the binding gets the wrong value or the formatting makes converts it somehow wrongly. If it’s the binding it should also so the wrong value in other openHAB UI’s and in the log. Can you check what values are shown?

Transformations can done in item configuration and is not something that is part of the binding. This binding should always returns the value in Watt.

Hi,
the log shows the same e.g. changed from 0.09846 to 0.09932 A … If i use the TP-Link Kasa App it shows the correct 9.93Watt. Where it came from? I dont know. I only want to use it. I dont know how to to “The transformation in the item configuration …”. I tried it by the unit and format fields.

Showing it with A suggest it shows the current channel value. What is the value for the power channel?

Another option is to enable trace logging that will show the actual values send by the device (log:set TRACE org.openhab.binding.tplinksmarthome and disable with log:set DEFAULT org.openhab.binding.tplinksmarthome in the karaf console.

Some tp-link models had a firmware update about misreporting power. I wonder what the secret model involved here is?

I expect it is supposed to report in kW. So 90W would show as 0.09
If you want to display in W you would use a JS transform in the label to multiply by 1000, as already described.
That is about user display choice, not a binding function.

Hi,
@hilbrand - i tested it with power channel and this value is correct and formated as expected. So what is current?

It’s electrical current in Ampère.

Yes Hilbrand your totaly right. This was my fault. I wrong interpreted the channel and use the wrong one. But thx to all for your help and support.