Closed bj00rn closed 1 year ago
No domain knowledge at my end either but I see how you're thinking. @danielolsson100 or @mickecamino perhaps knows more?
@argoyle I have no clue in this matter since I am not using this value at all, I don't even store the history data in the DB for this sensor ;)
It should be pos / count - neg / count
.
Also, it shouldn't be int()
. Would be better to use something like round(float(pos / count - neg / count), 2)
.
The value from Ferroamp is a float, so it should be a float in the code:
It should be
pos / count - neg / count
.Also, it shouldn't be
int()
. Would be better to use something likeround(float(pos / count - neg / count), 2)
.
That would result in ~760 in the case @bj00rn had, right? Can someone provide a PR with those changes?
Hmmm, it seems that I looked at the wrong sensor, Here is the correct one:
It should be
pos / count - neg / count
. Also, it shouldn't beint()
. Would be better to use something likeround(float(pos / count - neg / count), 2)
.That would result in ~760 in the case @bj00rn had, right? Can someone provide a PR with those changes?
I can give it a shot
Works on my machine (TM) :-)
Seems that the sensor state sums up to zero.
Is this really the correct way to represent DC voltage? I have no domain knowledge here whatsoever here, it just appears to me that the current state value seems useless, especially when trying to correlate DC link voltage history with SSO fault codes.
Nominal DC link voltage is 760V (720-780V) according to specs, which leaves 380+380 within that range..
From the looks of it would seem that a useful way of summing up dc link voltage would be something like self._attr_native_value = int(abs(neg) / count + pos / count). Again, i have no domain knowledge here so maybe im wrong.
offending line: https://github.com/henricm/ha-ferroamp/blob/56df5e9f542d0b4d9f843acd52ab5107cdcfd614/custom_components/ferroamp/sensor.py#L759