Skip to content

Cookie preferences

We use cookies for our own analytics, to see how our campaigns perform and, if you allow it, to load content from other services such as the Google site search. We never sell your data. Necessary cookies keep the site working and cannot be switched off. See our Cookie Policy for details and our Privacy Policy for how we handle personal data.

Security, load balancing and remembering your cookie choice.

Show us which pages people read, how they find the site and where they get stuck, so we can improve it (Google Analytics, Microsoft Clarity).

Show us which of our ad campaigns bring visitors to the site and remember the campaign or partner link you arrived from (Google Ads, LinkedIn, Meta, partner program). We do not use these cookies to build advertising profiles.

Load the site search from Google when you use it. Google sets its own cookies and shows ads in the search results.

© 2026 The ThingsBoard Authors

ThingsBoard Cloud

Choose your data region

Your data stays in the region you choose, for residency and compliance. No credit card required.

Rather run it yourself? Install on your own servers

Calculate Power Factor from Active Power, Voltage and Current

  • Calculated Field
  • 0 installs
  • v1.0.1
  • Nov 13, 2026
  • MIT license
  • v4.3+

Calculate power factor (PF, cos phi) from active power, voltage and current for single-phase energy meters, smart plugs, motors, pumps, compressors and HVAC units. Gives a true power factor key for load dashboards, low PF alarms and reactive power penalty checks, and skips readings when the load is off.

Type
  • Script
Category
  • Energy
  • Custom Formula
Use Cases
  • Smart Energy
  • Smart Metering
  • Industrial Automation
  • Smart Building

Who it’s for

Energy managers, facility engineers and electricians asking “what is the power factor of this motor?”, “is our PF low enough to get a reactive power penalty?”, “how much of the current does useful work?” — when the meter reports power, voltage and current, but not the power factor.

What it does

Reads the latest power (active power, W), voltage (V) and current (A) telemetry, divides the power by voltage × current, and writes the result as powerFactor:

power-factor

A heater or another load that only makes heat has a power factor of 1. A motor has about 0.85 at full load and much less with little load, down to about 0.2 when it runs with no load. Many utilities add a reactive power penalty when the power factor stays below the limit in the tariff, typically somewhere from 0.90 to 0.95.

This is the true power factor. It equals cos φ only when voltage and current are clean sine waves. With frequency drives, LED lighting and other electronics it is lower than the cos φ that some meters show.

When voltage × current is 0 or below, the load is off or the supply is down, and a power factor has no meaning. The field writes nothing, so powerFactor keeps its last value instead of showing a false low reading. Meters round their readings, so power can come out a little above voltage × current. The field then writes 1.

With the IEC convention, a minus means power flows to the grid, so powerFactor goes down to −1. This needs a meter that puts the minus on power. A meter that puts it on current gets no value while it sends power to the grid. Some meters use the IEEE convention instead, where the sign shows an inductive or capacitive load.

The field works on one phase. With the total power of a three-phase meter it shows 1 for most loads, and no error tells you. Give it the power, voltage and current of the same phase, or use this field for all three phases at once:

Calculate Three-Phase Power Factor per Phase and Total Dmytro Shvaika

power must be the active power that the meter measures. Power computed as voltage × current always gives a power factor of 1. If your meter already sends powerFactor, you do not need this field.

How to customize

  • To use this on your meter’s keys — change the Time series key on the power, voltage and current arguments (e.g. power → activePower, current → lineCurrent).
  • To use a meter that reports power in kW — in the Script, change power / apparent to power * 1000 / apparent.
  • To rename the output — in the Script, replace powerFactor in the return line with your own key (e.g. pf).
  • To show more decimals — in the Script, change the 2 in toFixed(pf, 2) to the number of decimals you need.
  • To timestamp the result with server time — in the Script, return { powerFactor: toFixed(pf, 2) } without the ts and values wrapper.
  • To filter, transform, or forward the result to external systems — switch Strategy to Process via Rule Chains. Rule nodes then receive the value and can drop it, change it, save it conditionally, or push it to an external system.

See also

To find the reactive power behind a low power factor, install the template below on the same device and change the Time series key on its powerFactor argument from cosPhi to powerFactor:

Active and Reactive Power Calculation Dmytro Shvaika

To raise an alarm when the power factor stays below the tariff limit:

Low Power Factor Alarm Dmytro Shvaika

Share Your Calculated Field with the Community

Built a useful data transformation? Export it as a JSON from ThingsBoard and publish it to the IoT Hub. Share it with thousands of ThingsBoard developers worldwide.