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

Handle time going backwards, and net consumption never going decreasing #11

Merged
merged 3 commits into from
Jan 29, 2024

Conversation

jgruen
Copy link
Contributor

@jgruen jgruen commented May 6, 2023

On my meter, kWh net never decreases. However, Watts does go negative. This PR adds sensors that can be integrated in Home Assistant to make net metering make sense.
Furthermore, if using e.g. https://esphome.io/components/time/homeassistant.html, time can jump backwards, which breaks communication with the meter. This PR adds sanity checks to

  1. allow usage of time components without breaking compilation, and
  2. handling backwards time jumps by resetting the next_ variable(s)

jgruen added 3 commits May 6, 2023 14:49
If a solar customer is not yet on _net metering_, then the kWh_net
Sensor will never decrease (i.e., meter does _not_ run
backwards). This means that kWh_returned will always be zero, even
though power _is_ flowing back to the grid (though the customer is not
being credited for it).

For visualizing in e.g. Home Assistant's Energy dashboard, we
therefore export the Watts flowing in either direction (to or from the
grid) so that integral helpers/sensors/entities can be used to show
the _actual_ energy flow to and from the grid (again, even though the
customer is not being credited (yet?) on the meter / bill).
@jgruen jgruen changed the title Handle time going backwards, and net consumption never going backwards Handle time going backwards, and net consumption never going decreasing May 6, 2023
@jrouvier jrouvier merged commit 44a0050 into jrouvier:main Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants