Power_factor change suggestion: from -100%…100% to -1.0…1.0

Tags: #<Tag:0x00007f3270249678>

There are two problems with power factors right now.

Power factor is defined as the ratio of real power to apparent power. It is calculated as a cos(φ) from power vectors and it gives a numeric value between -1.0 and 1.0. It does not have any unit (more about that later).

In HA, all sensors using power_factor class are expected to report percent which is not a right power factor measurement.

In the core code there is only Shelly integration that uses this device class and does extra calculation for that. There could be other community modules that use power factor sensor.

Also in Tasmota, the power factor is a float ratio which is always less than 1.0 (it looks like Tasmota doesn’t calculate leading (negative) power factors).

I suggest using values between -1.0 and 1.0 for power factor. This also makes calculations simpler

I would like to raise a PR to change that if there is no good rationale to hold the current situation. This will be a breaking change but as much as I have looked around different public configurations, it is very rarely used sensor anyway.

I have is also one WTH with this measurement: because it is a unitless value, Lovelace doesn’t draw a history graph for that. I actually don’t know how to properly “fix” that. For myself I added a unit_of_measurement: "cos(φ)" to get the graph but this is not 100% correct because power factor doesn’t have a unit and “cos(φ)” is not a unit but a calculation formula.




I have a few ratios where I use a unit of measurement “ “ (space). You can’t see it in Lovelace.

1 Like

There wasn’t much feedback from forum but I did some homework and looked around how different platforms and integrations use power factor and I opened the architecture issue about that now.

Lets see if there are any users who are happy with the current situation or have any good reasons against the change.


1 Like

I agree with you that the PF should be -1.00 - 1.00