-
Notifications
You must be signed in to change notification settings - Fork 109
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
Essential Power MathSensor isn't working properly #134
Comments
Just to note, this used to work perfectly (started using the add-on in December). I'm not sure when it changed, only noticed recently, it's possible that it happened when I switched to the |
Can you try this as mysensors.py? It prints the calculation in the logs every couple of seconds add these sensors - old1/old2 should be the December one, hopefully they are the same SENSORS:
- essential_power
- essential_power_old1
- essential_power_old2 import attrs
import re
from sunsynk import AMPS, CELSIUS, KWH, VOLT, WATT
from sunsynk.rwsensors import RWSensor, ResolveType
from sunsynk.sensors import RegType, ValType, SensorDefinitions, MathSensor, _LOGGER
SENSORS = SensorDefinitions()
@attrs.define(slots=True, eq=False)
class DebugMathSensor(MathSensor):
"""Math sensor, add multiple registers."""
cycle = attrs.field(default=1, init=False, repr=False)
def reg_to_value(self, regs: RegType) -> ValType:
"""Calculate the math value."""
res = super().reg_to_value(regs)
self.cycle -= 1
if self.cycle < 1:
self.cycle = 20
_LOGGER.info("%s=%s, %s", dict(zip(self.address, regs)), res, self)
return res
SENSORS += (
# https://github.com/kellerza/sunsynk/issues/75
# https://powerforum.co.za/topic/8646-my-sunsynk-8kw-data-collection-setup/?do=findComment&comment=147591
DebugMathSensor(
(175, 169, 166), "Essential power", WATT, factors=(1, 1, -1), absolute=True
),
DebugMathSensor(
(175, 169, 166), "Essential power old1", WATT, factors=(1, 1, -1)
),
DebugMathSensor(
(175, 167, 166), "Essential power old2", WATT, factors=(1, 1, -1)
),
) |
I was just about to open an issue on this as well. My panels have only been installed this week and prior to that I was running in UPS mode only. I switch between zero export and limit to load in the evenings and back to zero export in the mornings to feed non essentials. I am noticing the calculation of both My screenshot above is while in As you can see my non-essential and essential readings are pretty much the same and comparing it with my solar production it is clear that my non-essential load is actually included in both the |
In the latest version there are now 3 essential power sensors.
@kloon - let us know what works for you I'm expecting this has something to do with the use of Aux / register 235 - sensor |
Thanks for the fix, using |
I am assuming I need to change this in the MQTT sensor setting for https://kellerza.github.io/sunsynk/ addon? I will fiddle a bit and see. I would like the Essential Power to match the UPS or Load Power on the inverter screen. Here I have my Geyser on, as a Non-Essential load. After a bit I switch the Geyser off and the "Essential" Home icon changes to a Home with a Battery (634Watt) (How can I tag slipx06 here? 2024-10-28.22-33-13.mp4 |
Issue related to the Python sunsynk library
Describe the issue/bug
The Essential Power sensor seems to be calculating incorrectly. According to #75 it is a combination of
It looks to me like it's not subtracting the "Grid LD power" on my inverter. If you have a look at the below HA sensors:

(I have "Aux" labeled as "Generator" in HA as I have a generator connected. But at the moment it's not being used).
Essential Power = 1416 + (-640) + 0 = 776. Instead I'm getting 1428W
You'll also notice that I have a CBI nanoview measuring my usage. It never matches the inverter exactly but it's normally within range, in the screenshot it's showing 760W (pretty close to the expected value above) and not 1428W that the add-on is reporting.
Expected behavior
Covered most of this above, I'm expecting the correct Essential Power value
Logs (if applicable)
I can't see anything related in the logs.
The text was updated successfully, but these errors were encountered: