-
Notifications
You must be signed in to change notification settings - Fork 638
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
V9261F Miscalculated Sensors #2554
Comments
We get that raw apparent power value from the buffer while reading everything else, is it always providing garbage values like that? |
Yes, apparent and |
s/apparent/reactive/ for data buffer, I meant that apparent and factor are derived from it :> what raw data looks like btw? |
I meant that apparent and reactive always showed the same value on the webpage, not factor. Sorry about that. So it doesn't seem like any calculation was being done for apparent. Anyway, here are some raw values:
|
diff --git a/code/espurna/sensor.cpp b/code/espurna/sensor.cpp
index 93bf7668..f74e82fc 100644
--- a/code/espurna/sensor.cpp
+++ b/code/espurna/sensor.cpp
@@ -1329,6 +1329,7 @@ constexpr bool ratio_supported(unsigned char type) {
return (type == MAGNITUDE_CURRENT)
|| (type == MAGNITUDE_VOLTAGE)
|| (type == MAGNITUDE_POWER_ACTIVE)
+ || (type == MAGNITUDE_POWER_REACTIVE)
|| (type == MAGNITUDE_ENERGY);
}
Ratio calc is ignored here, so instead of dividing by (default) ratio value it divides by 1.0 espurna/code/espurna/sensors/V9261FSensor.h Line 205 in 1169be2
espurna/code/espurna/sensors/BaseEmonSensor.h Lines 137 to 138 in 1169be2
espurna/code/espurna/sensor.cpp Line 4007 in 1169be2
espurna/code/espurna/config/sensors.h Lines 1171 to 1175 in 1169be2
|
UI does not expect anything but these four, reactive power would be Lines 2371 to 2374 in 1169be2
Lines 1864 to 1867 in 1169be2
Lines 1881 to 1885 in 1169be2
Quick edit is to just inject another <span> like the energy one, proper fix would be to stop .js from trying to access elems and inject style and / or css var instead
|
...does not seem to really make sense to add extra reactive ratio, though. Will bundle original patch instead, also with some fixes related to pointless |
Device
wemos-d1mini
Version
espurna-github20220816
Bug description
Ever since I got V9261F working I noticed that Reactive, Apparent and Power Factor values made no sense at all.
So I messed around in V9261FSensor.h and tried to match it with CSE7766Sensor.h, hoping that that one was actually working.
This is how it was before:
And now against my custom HA sensors (took inspiration for the sensors from here esphome :
So calculations seem to be exactly the same and this issue is fixed.
I don't know coding, I just messed around and copied stuff until it compiled. I couldn't even create a pretty diff.
Btw, Energy calculation doesn't work either. It should be far more than 0.003.
Steps to reproduce
No response
Build tools used
PlatformIO Core 6.1.5
Python 3.10.5-final.0
System Type windows_amd64
Platform Windows-10
File System Encoding utf-8
Locale Encoding cp1252
PlatformIO Core Directory C:\Users\kaank.platformio
PlatformIO Core Executable C:\Users\kaank.platformio\penv\Scripts\platformio.exe
Python Executable C:\Users\kaank.platformio\penv\Scripts\python.exe
Global Libraries 0
Development Platforms 1
Tools & Toolchains 5
Any relevant log output (when available)
No response
Decoded stack trace (when available)
No response
The text was updated successfully, but these errors were encountered: