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:
objectOEM daily PV energy report for a single station over a date range.
Queries the
/oem_eqSolenso 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 andset_station()to switch the monitored station.- Parameters:
parent – Instance of
MySolensoproviding access to theauthandstationsub-modules.- Raises:
MySolensoException – If
parent.station.station_idisNone.
- parent
Reference to the parent
MySolensoobject.
Note
Data is not fetched automatically at construction time. Call
set_day()(withrefresh=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
idis validated against the station list fromstations.- Parameters:
- Raises:
MySolensoException – If
idis not found in the account’s station list, or if the subsequent API call fails.- Return type:
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_minandday_maxmust be validYYYY-MM-DDstrings within[1900-01-01, today], andday_minmust not be later thanday_max.- Parameters:
- Raises:
If either date string is not exactly 10 characters. - If either date is outside
[1900-01-01, today]. - Ifday_min > day_max. - If either date string cannot be parsed asYYYY-MM-DD.
- Return type:
-
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:
- 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 inYYYY-MM-DDformat.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 benull).lfg(Any | None) - load-following generation (may benull).eq_hour(int) - equivalent production hours.
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
dateandpv_eqfields from each raw record inall_data, returning a concise list suitable for charting or CSV export.- Returns:
Each element has exactly two keys:
"date"(str) - date inYYYY-MM-DDformat."power"(str) - PV energy in kWh as a string (preserves the original API string representation).
- Return type:
- Raises:
ValueError – If
all_datais 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