Skip to content
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

[BUG][P076] calculation with multiplier values is broken #4893

Open
chromoxdor opened this issue Nov 28, 2023 · 21 comments · May be fixed by #4895
Open

[BUG][P076] calculation with multiplier values is broken #4893

chromoxdor opened this issue Nov 28, 2023 · 21 comments · May be fixed by #4895
Labels
Category: Plugin Related to supported sensors Type: Bug Considered a bug

Comments

@chromoxdor
Copy link
Contributor

chromoxdor commented Nov 28, 2023

Todays build with p076 causes it to display nonsense. (last used/working build ESP_Easy_mega_20220722)
Seems to be an issue with the calculation of the multiplier values.
If i use the same values as before or try the recalibrate with hlwcalibrate the output is not as expected.
e.g. with pure resistive load (80W): hlwcalibrate,228,0.352,80 ->
Bildschirmfoto 2023-11-28 um 10 37 34

@chromoxdor
Copy link
Contributor Author

@TD-er TD-er added Type: Bug Considered a bug Category: Plugin Related to supported sensors labels Nov 28, 2023
@TD-er
Copy link
Member

TD-er commented Nov 28, 2023

A lot has been changed to that plugin since 20220722.
Does your unit have significantly different default multipliers compared to the used defaults in the code?

@chromoxdor
Copy link
Contributor Author

Does your unit have significantly different default multipliers compared to the used defaults in the code?

I dont´t think so.
default:
default

calibrated:
calibrated

@TD-er
Copy link
Member

TD-er commented Nov 28, 2023

My voltage multiplier is 462022.94
I never calibrated the current/power on that node.

You could try to use the calibration command with only the voltage, just to see if that's working.

@chromoxdor
Copy link
Contributor Author

You could try to use the calibration command with only the voltage, just to see if that's working.

It doesn´t

My voltage multiplier is 462022.94

I have around 8 devices here (all gosund sp1 or sp111)
They all have similar values and they definitely needed calibration...

@chromoxdor
Copy link
Contributor Author

chromoxdor commented Nov 28, 2023

another issue is, that the command 'hlwcalibrate' doesn´t seem to work.. at least the values in the plugin do not change...

Edit: manually changing them works...

@TD-er
Copy link
Member

TD-er commented Nov 28, 2023

Maybe there needs to be an actual floating point value?

Can you try

hlwcalibrate,228.0,0.352,80.0

@TD-er
Copy link
Member

TD-er commented Nov 28, 2023

I think I see what may be happening here....
The function to apply calibration needs a proper last measurement value.
However it is somewhat of a trial-and-error to hit the command at just the right moment to get a proper _voltage value as this getVoltage function may every now and then return 0 as the reading is not yet ready.

TD-er added a commit to TD-er/ESPEasy that referenced this issue Nov 28, 2023
@TD-er TD-er linked a pull request Nov 28, 2023 that will close this issue
@TD-er
Copy link
Member

TD-er commented Nov 28, 2023

Made a fix for it, can you please test it?

@chromoxdor
Copy link
Contributor Author

chromoxdor commented Nov 28, 2023

Command works! Sadly calculation is still wrong.....

The current value still doesn´t change

@TD-er
Copy link
Member

TD-er commented Nov 28, 2023

"current" as in the last value, or the actual current as in amps?

@chromoxdor
Copy link
Contributor Author

amps :)

@chromoxdor
Copy link
Contributor Author

chromoxdor commented Nov 30, 2023

just realized that the power multiplier also doesn´t get changed.
So it´s only voltage that works.

It still is only "current" that doesn´t work 😬

@TD-er
Copy link
Member

TD-er commented Nov 30, 2023

Just curious, what is the actual current being used the moment you try to perform the calibration?

Like if you tell the unit there is some load like 100 Watt, you really should have it present and the task already must have it measured.

So if you have the task interval set to 5 minutes and you apply some load, perform the calibration and disconnect the load, then it will fail as the measured current will still be 0.

@chromoxdor
Copy link
Contributor Author

chromoxdor commented Nov 30, 2023

As always i use a 80w bulb, turn the plug on. See the measured values and enter the whole command (hlwcalibrate,228,0.352,80) if they differ from the real ones.
This sets on my old the devices the multipliers as expected.
(Even if i enter bogus values it changes the multipliers to my given values. This would be the expected behavior.)
Now it doesn´t set the current.
Not only the current multiplier doesn´t set but also the voltage multiplier seems to be based on something else. In the old build it would be e.g. 313103.87 now it is 164160.00 which is odd and would also mean, that even if the command will be fixed i have to recalibrate all my devices.

Edit: my taskinterval for that is always 1s

@TD-er
Copy link
Member

TD-er commented Nov 30, 2023

Since this is already an older bug, it doesn't really make a difference whether I will fix it today or tomorrow (and you will be perfectly capable to make your own builds ;) )

Deadline for a fix for this one to be included in the November build is ~20h today.

@chromoxdor
Copy link
Contributor Author

Since this is already an older bug, it doesn't really make a difference whether I will fix it today or tomorrow (and you will be perfectly capable to make your own builds ;) )

I am totally fine with that. Make your release first 🙂
But i have to ask if it would be ok for you not to wait too long with looking into it? Two of these power plugs i want to send to my brother as a present. Thats the only reason i updated these...
He has a photovoltaic system and does not necessarily want to feed the public power grid and use the excessive power for a heating. Thats why i also made the "thingspeakreply"-event. The power plug grabs the data from the inverter which is fed via a script to thingspeak and switches on and off a heater accordingly.

@chromoxdor
Copy link
Contributor Author

I hope I'm not bothering you too much. This is just a little reminder :)

@TD-er
Copy link
Member

TD-er commented Dec 4, 2023

I hope I'm not bothering you too much. This is just a little reminder :)

Makes me think about this Dutch commercial ;)

https://youtu.be/-c6zp7f9ZYw?t=25

@tonhuisman
Copy link
Contributor

I hope I'm not bothering you too much. This is just a little reminder :)

Makes me think about this Dutch commercial ;)

https://youtu.be/-c6zp7f9ZYw?t=25

That's a real classic, I don't think the language is a problem here 😛 🤣

@chromoxdor
Copy link
Contributor Author

Makes me think about this Dutch commercial ;)

🤣

That's a real classic, I don't think the language is a problem here 😛 🤣

definitely not...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Plugin Related to supported sensors Type: Bug Considered a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants