mysolenso.services.reports.oempower - Solenso endpoint and returns a list of daily PV energy production records for a given station over a configurable date range

MySolenso OEM PV energy report service.

Provides the MySolensoOEMPower class, which queries the /oem_eq Solenso endpoint and returns a list of daily PV energy production records for a given station over a configurable date range.

The API returns a JSON payload with a list of daily records and a total count. Each record contains the station ID, owner name, timezone, date, PV energy in kWh (pv_eq), and several other consumption/grid fields.

By default the service queries today (or yesterday before 01:00) for a single day. Use set_day() to adjust the date range and set_station() to switch the active station.

This module is instantiated automatically by MySolenso and is accessible via client.oem_power.

Example

client = MySolenso(username="user", token="tok")

# Fetch data for a custom date range
client.oem_power.set_day("2026-04-01", "2026-04-30")
records = client.oem_power.all_data
for r in records:
    print(r["date"], r["pv_eq"], "kWh")

# Simplified view: date + power only
print(client.oem_power.power_data)
class mysolenso.services.reports.oempower.MySolensoOEMPower(parent)[source]

Bases: object

OEM daily PV energy report for a single station over a date range.

Queries the /oem_eq Solenso endpoint and exposes the raw JSON record list as well as a simplified {date, power} view.

The date range defaults to today (or yesterday before 01:00 to avoid empty datasets at midnight). Call set_day() to change it and set_station() to switch the monitored station.

Parameters:

parent – Instance of MySolenso providing access to the auth and station sub-modules.

Raises:

MySolensoException – If parent.station.station_id is None.

parent

Reference to the parent MySolenso object.

Note

Data is not fetched automatically at construction time. Call set_day() (with refresh=True, the default) or _get_oem_pv() explicitly to load the first dataset.

Example

client = MySolenso(username="admin", token="tok")
oem = client.oem_power

oem.set_day("2026-04-01", "2026-04-30")
print(oem.all_data)     # full JSON list
print(oem.power_data)   # [{date, power}, ...]
set_station(id, refresh=True)[source]

Switch the active station and optionally reload power data.

The provided id is validated against the station list from stations.

Parameters:
  • id (int) – Station ID to activate. Must exist in the account’s station list.

  • refresh (bool) – If True (default), immediately calls _get_oem_pv() to reload data for the new station. Set to False to defer the network call.

Raises:

MySolensoException – If id is not found in the account’s station list, or if the subsequent API call fails.

Return type:

None

Example

client.oem_power.set_station(43)
print(client.oem_power.all_data)
set_day(day_min, day_max, refresh=True)[source]

Set the query date range and optionally reload the data.

Both day_min and day_max must be valid YYYY-MM-DD strings within [1900-01-01, today], and day_min must not be later than day_max.

Parameters:
  • day_min (str) – Start of the date range (inclusive), in YYYY-MM-DD format.

  • day_max (str) – End of the date range (inclusive), in YYYY-MM-DD format.

  • refresh (bool) – If True (default), immediately calls _get_oem_pv() to reload data for the new range. Set to False to defer the network call.

Raises:

MySolensoException

  • If either date string is not exactly 10 characters. - If either date is outside [1900-01-01, today]. - If day_min > day_max. - If either date string cannot be parsed as YYYY-MM-DD.

Return type:

None

client.oem_power.set_day("2026-04-01", "2026-04-30")
print(client.oem_power.all_data)

oem_pv_refresh()[source]

Re-fetch OEM PV data for the current station and date range.

Convenience method that delegates to _get_oem_pv(). Call this after the underlying data may have changed (e.g. for intra-day monitoring).

Example

client.oem_power.oem_pv_refresh()
print(client.oem_power.all_data)
Return type:

None

property all_data: list

Raw list of daily OEM PV records from the API.

Each element is a dictionary with the following keys:

  • sid (int) - station identifier.

  • name (str) - station owner’s display name.

  • tz_name (str) - IANA timezone name of the station.

  • date (str) - record date in YYYY-MM-DD format.

  • pv_eq (str) - daily PV energy production in kWh.

  • consumption_eq (str) - daily consumption energy in kWh, or "-" when no consumption meter is installed.

  • meter_c_eq (str) - meter energy value.

  • meter_location (int) - meter location type.

  • capacitor (int) - capacitor presence flag.

  • create_at (str | None) - record creation timestamp.

  • p2g (Any | None) - peer-to-grid value (may be null).

  • lfg (Any | None) - load-following generation (may be null).

  • eq_hour (int) - equivalent production hours.

Returns:

Complete raw record list for the active station and date range.

Return type:

list[dict]

Example

client.oem_power.set_day("2026-04-11", "2026-04-13")
for record in client.oem_power.all_data:
    print(record["date"], record["pv_eq"], "kWh")
# 2026-04-11  14.58 kWh
# 2026-04-12  25.2  kWh
# 2026-04-13  14.35 kWh
property power_data: list[dict]

Simplified list of {date, power} records.

Extracts only the date and pv_eq fields from each raw record in all_data, returning a concise list suitable for charting or CSV export.

Returns:

Each element has exactly two keys:

  • "date" (str) - date in YYYY-MM-DD format.

  • "power" (str) - PV energy in kWh as a string (preserves the original API string representation).

Return type:

list[dict]

Raises:

ValueError – If all_data is empty or missing.

Example

client.oem_power.set_day("2026-04-01", "2026-04-03")
for entry in client.oem_power.power_data:
    print(entry["date"], entry["power"])
# 2026-04-01  12.3
# 2026-04-02  18.7
# 2026-04-03  9.1