jrouvier / esphome-emporia-vue-utility

Alternative ESPHome firmware for the Emporia Vue Utility Connect
GNU General Public License v2.0
75 stars 17 forks source link

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

Closed jgruen closed 8 months ago

jgruen commented 1 year ago

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)