Skip to content

Bug Fix: Stale Power Values at Night (Issue #41)

Choose a tag to compare

@smcneece smcneece released this 12 Dec 15:16

Release Date: 12-12-2025
Type: Bug fix + enhancements

What's New

Bug Fix: Stale Power Values at Night (NEW)

Fixed inverters showing non-zero power values when offline at night

  • Previously: Cached inverters retained last production values (e.g., showing 1.7W at 11 PM)
  • Now: Power-related fields automatically zeroed when inverters offline
  • Affects: All inverter power, current, voltage, and frequency sensors
  • Preserves: Lifetime production and temperature data remain accurate

Why this matters:

  • Eliminates confusing "ghost production" in nighttime graphs
  • Power dashboards now correctly show 0W when solar panels are offline
  • Cached inverter structure preserved for entity stability
  • Addresses user concern about misleading nighttime averages (Issue #41)

Bug Fix: Timestamp Accuracy

Fixed DATATIME timestamps to show actual PVS measurement time

  • Previously: DATATIME showed when integration processed the data
  • Now: DATATIME shows when PVS hardware actually measured the data
  • Affects: Inverters, Meters, ESS/Battery devices, Transfer Switches
  • Uses actual msmtEps timestamp from pypvs instead of datetime.utcnow()

Why this matters:

  • Cache files now show accurate "last measured" timestamps
  • Easier to diagnose stale data issues (Issue #39)
  • Timestamps reflect PVS hardware timing, not integration processing timing

Enhancement: Last Reported Sensor (NEW)

Added "Last Reported" timestamp sensor for each inverter

  • Shows when the PVS last measured data from each inverter
  • Displays as relative time ("3 hours ago") automatically by Home Assistant
  • Matches pvs-hass functionality for easy comparison
  • Helps identify stale inverter data at a glance

Enhancement: Inverter Sensor Precision

Added 3 decimal precision to inverter sensors matching pvs-hass

  • Lifetime Production: 3 decimals (2,329.650 kWh)
  • Production Current: 3 decimals (0.005 A)
  • MPPT Current: 3 decimals (0.035 A)
  • Helps see precise values during low light conditions and tracks exact lifetime production
  • Matches pvs-hass precision where they explicitly set 3 decimals

User Impact

Nighttime Power Display

  • Inverter power sensors now correctly show 0W when panels are offline
  • Eliminates "ghost production" in energy dashboards and graphs
  • No action required - automatic sanitization when inverters go offline
  • Lifetime production and temperature data remain accurate in cache

Timestamp Changes

  • Your cache files and diagnostic data will now show accurate PVS measurement times
  • No action required - timestamps will automatically reflect actual measurement times
  • This is particularly useful when debugging stuck inverter issues

New Last Reported Sensor

  • Each inverter gets a new "Last Reported" sensor showing measurement timestamp
  • Displays as "3 hours ago" style relative time in HA UI
  • Click the sensor to see actual date/time
  • Helpful for identifying when inverter data becomes stale

Inverter Sensor Precision

  • Lifetime production and current sensors now show 3 decimal places
  • Provides better visibility into low current values (dawn/dusk, cloudy days)
  • Shows exact lifetime production matching pvs-hass display
  • No action required - display will automatically update

Upgrade Instructions

Automatic Update

  • HACS Users: Standard HACS update process
  • Manual Install: Copy updated files and restart Home Assistant

Recommended Actions

  • Update anytime; no specific timing requirements

Technical Details

Files Modified:

  • __init__.py: Lines 516-553 - Added _sanitize_cached_inverter() function to zero power values
  • __init__.py: Lines 991-995 - Modified cache restoration to sanitize inverter data at night
  • pypvs_converter.py: Lines 9, 111, 145, 210, 238 - Added timezone import and fixed DATATIME to use actual last_report_date from pypvs
  • const.py: Lines 530, 556, 584 - Added suggested_display_precision: 3 to lifetime production and current sensors
  • const.py: Lines 605-613 - Added INVERTER_LAST_REPORTED timestamp sensor
  • sensor.py: Line 293 - Added suggested_display_precision parameter to SunPowerSensor.init()
  • sensor.py: Lines 327-330 - Added suggested_display_precision property to expose precision to Home Assistant
  • sensor.py: Line 191 - Pass suggested_display_precision from sensor config during entity creation
  • sensor.py: Lines 363-378 - Added DATATIME string to datetime conversion for timestamp sensors

Issues Addressed:

  • Issue #41 - Fixed stale power values showing in graphs when inverters offline at night
  • Issue #39 - Improves diagnostic capability for stuck inverter debugging

For detailed documentation, see the README and TROUBLESHOOTING guides.