Skip to main content

Solar Inverter State

Solar inverter state parameters provide real-time production data, battery status, household consumption, and energy metrics. These fields are read-only and automatically updated from the manufacturer’s API.
State data refresh frequency depends on the manufacturer’s API. Most values update every 5-15 minutes.

Solar Production

current_solar_production_w
integer
Current solar power production in Watts.Returns 0 during nighttime or cloudy conditions.Example: 6250
solar_surplus_w
integer
Excess solar power available after meeting household demand, in Watts.Positive values indicate surplus power available for battery charging or grid export.Example: 4500
production_last_day_kwh
float
Solar energy production for the previous day in kWh.Example: 32.5
production_last_week_kwh
float
Solar energy production for the previous week in kWh.Example: 120.1
production_last_month_kwh
float
Solar energy production for the previous month in kWh.Example: 451.3
production_last_updated_utc
datetime
Timestamp when production data was last calculated.Example: 2023-03-22T13:54:34.000Z

Household Consumption

household_consumption_w
integer
Current total power consumption of the household in Watts.Includes all electrical loads in the building.Example: 950

Battery Status

battery_charge_level_percent
integer
Current battery charge level in percent.Returns null or 0 if no battery is connected.Example: 85Range: 0-100
battery_charge_discharge_power_w
integer
Current battery power flow in Watts.Positive values: Battery is charging Negative values: Battery is dischargingExample: -755 (discharging at 755W)
charge_state_last_updated
datetime
Timestamp when the battery and inverter state was last updated from the manufacturer’s API.Use this to determine data freshness.Example: 2023-03-22T13:54:34.000Z

Usage Examples

Get Inverter State

curl -X GET \
  'https://app.podero.com/api/partners/v2.0/org/{org_id}/users/{user_id}/inverters/{device_id}' \
  -H 'Authorization: Bearer {auth_token}' \
  -H 'Accept: application/json'

Display Energy Flow

def format_energy_flow(inverter):
    """
    Format current energy flow for dashboard display
    """
    production = inverter['current_solar_production_w']
    consumption = inverter['household_consumption_w']
    battery_power = inverter['battery_charge_discharge_power_w']
    surplus = inverter['solar_surplus_w']

    # Calculate grid import/export
    grid_flow = consumption - production - battery_power

    # Determine battery status
    if battery_power > 0:
        battery_status = f"Charging at {battery_power}W"
    elif battery_power < 0:
        battery_status = f"Discharging at {abs(battery_power)}W"
    else:
        battery_status = "Idle"

    # Determine grid status
    if grid_flow > 0:
        grid_status = f"Importing {grid_flow}W"
    elif grid_flow < 0:
        grid_status = f"Exporting {abs(grid_flow)}W"
    else:
        grid_status = "Balanced"

    return {
        'solar': {
            'production': production,
            'display': f"{production}W"
        },
        'consumption': {
            'current': consumption,
            'display': f"{consumption}W"
        },
        'battery': {
            'power': battery_power,
            'level': inverter['battery_charge_level_percent'],
            'status': battery_status,
            'display': f"{inverter['battery_charge_level_percent']}% - {battery_status}"
        },
        'grid': {
            'flow': grid_flow,
            'status': grid_status
        },
        'surplus': surplus
    }

# Example usage
inverter = get_inverter(org_id, user_id, device_id)
flow = format_energy_flow(inverter)

print(f"Solar: {flow['solar']['display']}")
print(f"Consumption: {flow['consumption']['display']}")
print(f"Battery: {flow['battery']['display']}")
print(f"Grid: {flow['grid']['status']}")

Calculate Self-Consumption Rate

def calculate_self_consumption(inverter):
    """
    Calculate self-consumption metrics
    """
    production = inverter['current_solar_production_w']
    consumption = inverter['household_consumption_w']
    battery_power = inverter['battery_charge_discharge_power_w']

    # Solar power used directly in home (not via battery)
    direct_use = min(production, consumption)

    # Solar power stored in battery
    battery_charging = max(0, battery_power)

    # Total solar power consumed (not exported)
    total_self_consumed = direct_use + battery_charging

    # Self-consumption rate
    if production > 0:
        self_consumption_rate = (total_self_consumed / production) * 100
    else:
        self_consumption_rate = 0

    # Grid independence
    if consumption > 0:
        grid_independence = (direct_use / consumption) * 100
    else:
        grid_independence = 0

    return {
        'direct_use_w': direct_use,
        'battery_charging_w': battery_charging,
        'total_self_consumed_w': total_self_consumed,
        'exported_w': production - total_self_consumed,
        'self_consumption_rate': round(self_consumption_rate, 1),
        'grid_independence': round(grid_independence, 1)
    }

# Example usage
metrics = calculate_self_consumption(inverter)
print(f"Self-consumption rate: {metrics['self_consumption_rate']}%")
print(f"Grid independence: {metrics['grid_independence']}%")
print(f"Exported: {metrics['exported_w']}W")
def analyze_solar_production(inverter):
    """
    Analyze solar production patterns
    """
    daily = inverter['production_last_day_kwh']
    weekly = inverter['production_last_week_kwh']
    monthly = inverter['production_last_month_kwh']

    # Calculate averages
    avg_daily_from_week = weekly / 7
    avg_daily_from_month = monthly / 30

    # Estimate system performance
    # Assuming 4-5 peak sun hours per day
    solar_rating = inverter.get('solar_power_rating_kw', 0)
    if solar_rating > 0:
        expected_daily = solar_rating * 4  # Conservative estimate
        performance_ratio = (daily / expected_daily) * 100 if expected_daily > 0 else 0
    else:
        performance_ratio = None

    return {
        'production': {
            'yesterday': daily,
            'this_week': weekly,
            'this_month': monthly,
            'avg_per_day_week': round(avg_daily_from_week, 2),
            'avg_per_day_month': round(avg_daily_from_month, 2)
        },
        'performance_ratio': round(performance_ratio, 1) if performance_ratio else None,
        'trend': 'increasing' if daily > avg_daily_from_week else 'decreasing'
    }

# Example usage
analysis = analyze_solar_production(inverter)
print(f"Yesterday: {analysis['production']['yesterday']} kWh")
print(f"Weekly average: {analysis['production']['avg_per_day_week']} kWh/day")
if analysis['performance_ratio']:
    print(f"System performance: {analysis['performance_ratio']}%")

Battery Health Monitoring

from datetime import datetime, timedelta

def monitor_battery_health(inverter_history):
    """
    Monitor battery cycling and health indicators

    Args:
        inverter_history: List of inverter state readings over time
    """
    charge_cycles = 0
    total_charge_kwh = 0
    total_discharge_kwh = 0

    prev_level = None
    prev_direction = None

    for reading in inverter_history:
        battery_power = reading['battery_charge_discharge_power_w']
        battery_level = reading['battery_charge_level_percent']

        # Count charge cycles (0-100-0 = 1 cycle)
        if prev_level is not None:
            if battery_power > 0 and prev_direction == 'discharging':
                charge_cycles += 0.5  # Half cycle (discharge to charge transition)
            elif battery_power < 0 and prev_direction == 'charging':
                charge_cycles += 0.5  # Half cycle (charge to discharge transition)

        # Track energy throughput
        time_delta = 5 / 60  # Assuming 5-minute intervals, convert to hours
        if battery_power > 0:
            total_charge_kwh += (battery_power / 1000) * time_delta
            current_direction = 'charging'
        elif battery_power < 0:
            total_discharge_kwh += (abs(battery_power) / 1000) * time_delta
            current_direction = 'discharging'
        else:
            current_direction = 'idle'

        prev_level = battery_level
        prev_direction = current_direction

    # Calculate efficiency
    if total_charge_kwh > 0:
        round_trip_efficiency = (total_discharge_kwh / total_charge_kwh) * 100
    else:
        round_trip_efficiency = None

    return {
        'charge_cycles': round(charge_cycles, 2),
        'total_charge_kwh': round(total_charge_kwh, 2),
        'total_discharge_kwh': round(total_discharge_kwh, 2),
        'round_trip_efficiency': round(round_trip_efficiency, 1) if round_trip_efficiency else None
    }

Dashboard Integration

Energy Flow Visualization

def create_energy_sankey(inverter):
    """
    Generate data for Sankey diagram showing energy flows
    """
    production = inverter['current_solar_production_w']
    consumption = inverter['household_consumption_w']
    battery_power = inverter['battery_charge_discharge_power_w']

    flows = []

    # Solar to consumption (direct use)
    direct_use = min(production, consumption)
    if direct_use > 0:
        flows.append({
            'source': 'Solar',
            'target': 'Home',
            'value': direct_use
        })

    # Solar to battery
    if battery_power > 0:
        flows.append({
            'source': 'Solar',
            'target': 'Battery',
            'value': battery_power
        })

    # Battery to home
    if battery_power < 0:
        flows.append({
            'source': 'Battery',
            'target': 'Home',
            'value': abs(battery_power)
        })

    # Solar to grid (export)
    export = production - direct_use - max(0, battery_power)
    if export > 0:
        flows.append({
            'source': 'Solar',
            'target': 'Grid',
            'value': export
        })

    # Grid to home (import)
    grid_import = consumption - direct_use - max(0, -battery_power)
    if grid_import > 0:
        flows.append({
            'source': 'Grid',
            'target': 'Home',
            'value': grid_import
        })

    return flows

Understanding Power Flows

Scenario: current_solar_production_w: 8000, household_consumption_w: 1500
  • 1500W used directly in home
  • 6500W surplus available
  • Battery charges if below max charge limit
  • Remaining surplus exported to grid
Battery: Charging at maximum rate Grid: Exporting excess power

Best Practices

  • Poll inverter state every 5-10 minutes during daylight hours
  • Reduce polling to 15-30 minutes during nighttime
  • Check charge_state_last_updated to avoid unnecessary calls
  • Display last update timestamp for transparency
  • Show current production prominently during daylight
  • Display daily/weekly/monthly production trends
  • Calculate and show self-consumption percentage
  • Highlight peak production times
  • Display battery level with charge/discharge status
  • Show power flow direction (charging/discharging)
  • Alert on unusual battery behavior
  • Track cycling patterns for health monitoring
  • Visualize power flows between solar, battery, home, and grid
  • Calculate and display self-consumption rate
  • Show grid import/export in real-time
  • Provide historical energy flow analysis