mysolenso.services.reports.powerbystation - Daily power aggregation service

MySolenso per-station daily power aggregation service.

Provides the MySolensoPowerByStation class, which queries the /report_select_power_by_station Solenso endpoint and exposes the aggregated power data for a single station over a given date range.

Unlike powerbyday, which uses the Hoymiles API and returns an intra-day power curve (HH:MM samples), this service uses the Solenso API and returns a single aggregated record per station per day - useful for day-level energy dashboards.

By default the service loads data for today (or yesterday if the local hour is before 01:00, to avoid an empty dataset at midnight). Use set_day() to query any historical date.

This module is intended to be instantiated by MySolenso and accessed via client.powerbaystation.

Example

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

data = client.powerbaystation.all_data
print(data)

# Query a specific date
client.powerbaystation.set_day("2026-01-01")
data = client.powerbaystation.all_data

# Refresh without changing station or date
client.powerbaystation.get_power_station_refresh()
class mysolenso.services.reports.powerbystation.MySolensoPowerByStation(parent)[source]

Bases: object

Daily aggregated power record for a single PV station.

Queries the /report_select_power_by_station Solenso endpoint with a station ID and a date range (start = end = target date) and caches the first element of the response list as all_data.

Parameters:

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

Raises:

MySolensoException – If parent.station.station_id is None (no active station resolved), or if the API call fails during instantiation.

parent

Reference to the parent MySolenso object.

Note

Unlike MySolensoPowerByDay, this class does not automatically fetch data at construction - call get_power_station_refresh() or set_day() to trigger the first request.

Example

client = MySolenso(username="admin", token="tok")
pb = client.powerbaystation

pb.get_power_station_refresh()
print(pb.all_data)

pb.set_day("2026-05-22")
print(pb.all_data)
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_power_by_station() 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.powerbaystation.set_station(43)
print(client.powerbaystation.all_data)
set_day(day, refresh=True)[source]

Set the queried date and optionally reload power data.

Parameters:
  • day (str) – Date string in YYYY-MM-DD format. Must be between 1900-01-01 and today (inclusive).

  • refresh (bool) – If True (default), immediately reloads data for the new date. Set to False to defer the call.

Raises:

MySolensoException – If day is not in YYYY-MM-DD format, is outside the allowed range, or if the API call fails.

Return type:

None

Example

client.powerbaystation.set_day("2026-05-22")
print(client.powerbaystation.all_data)
get_power_station_refresh()[source]

Re-fetch power data for the current station and date.

Triggers a new call to _get_power_by_station() without changing the active station ID or the queried date. Useful for polling the latest values during the day.

Example

# Poll every 5 minutes
import time
while True:
    client.powerbaystation.get_power_station_refresh()
    print(client.powerbaystation.all_data)
    time.sleep(300)
Return type:

None

property all_data: dict

Full raw record returned by the /report_select_power_by_station endpoint.

Contains the aggregated power fields for the active station on the queried date (fields depend on the API version; typically include production totals, peak power, and timestamps).

Data Example:

{ “sid”: 9876543, “name”: “DOE JOHN”, “tz_name”: “UTC+01”, “is_reflux”: 0, “is_balance”: 0, “meter_location”: 0, “classify”: 1, “dw”: null, “data_list”: [

{

“date”: “06:15”, “pv_power”: “26”, “consumption_power”: “0”, “meter_c_power”: “0”, “grid_p_power”: “0”, “bms_power”: “0”, “meter_location”: 0

{

“date”: “22:00”, “pv_power”: “0”, “consumption_power”: “0”, “meter_c_power”: “0”, “grid_p_power”: “0”, “bms_power”: “0”, “meter_location”: 0

}, {

“date”: “22:15”, “pv_power”: “0”, “consumption_power”: “0”, “meter_c_power”: “0”, “grid_p_power”: “0”, “bms_power”: “0”, “meter_location”: 0

}

]

}

Returns:

First element of the API response list for the active station and date.

Return type:

dict

Raises:

AttributeError – If get_power_station_refresh() or set_day() has not been called yet (_all_data not initialised).

Example

client.powerbaystation.get_power_station_refresh()
data = client.powerbaystation.all_data
print(data)
property extract_power_data: list[dict]

Extracts only: - date - power (from pv_power)

Expected output example: [

{“date”: “06:15”, “power”: 26}, {“date”: “06:30”, “power”: 56},

]

Returns:

A simplified list containing only date and power values.

Return type:

list[dict]

Raises:

ValueError – If data_list is missing or empty.