mysolenso.services.powerbyday - Intra-day Power Curve
MySolenso intra-day power curve service.
Provides the MySolensoPowerByDay class, which queries the
/count_power_by_day Hoymiles endpoint and parses the binary protobuf
response to expose a time-indexed dictionary of grid power measurements
(in Watts) for a single day.
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 instantiated automatically by MySolenso
and accessible via client.powerbyday.
Example
client = MySolenso(username="user", token="tok")
result = client.powerbyday.get_data
print(result["date"]) # "2026-05-22"
print(result["metric"]) # "grid_power"
print(result["values"]["08:30"]) # e.g. 1523.5 (W)
# Query a specific date
client.powerbyday.set_day("2026-01-01")
result = client.powerbyday.get_data
- class mysolenso.services.powerbyday.MySolensoPowerByDay(parent)[source]
Bases:
objectIntra-day grid power curve for a single PV station.
Parses the binary protobuf response from
/count_power_by_dayand exposes a structured result containing the date, the metric name ("grid_power"), and a{HH:MM: float}dictionary of power measurements in Watts sampled throughout the day.- Parameters:
parent – Instance of
MySolensoproviding access to theauthandstationsub-modules.- Raises:
MySolensoException – If
parent.station.station_idisNone, ifgrid_powermarker is absent from the response, or if any network or parsing error occurs.
- parent
Reference to the parent
MySolensoobject.
Note
If the local clock hour is before
01:00, the service automatically loads yesterday’s data to avoid returning an empty intra-day curve at midnight.Example
client = MySolenso(username="admin", token="tok") pb = client.powerbyday print(pb.get_data["date"]) # "2026-05-22" print(pb.get_data["metric"]) # "grid_power" print(pb.get_data["values"]["10:00"]) # 2048.75 (W)
- set_station_id(id, refresh=True)[source]
Switch the active station and optionally reload the power curve.
- Parameters:
- Raises:
MySolensoException – If
idis not found in the account’s station list, or if the subsequent API call fails.- Return type:
Example
client.powerbyday.set_station_id(43) print(client.powerbyday.get_data["values"])
- set_day(day, refresh=True)[source]
Set the queried date and optionally reload the power curve.
- Parameters:
- Raises:
MySolensoException – If
dayis not inYYYY-MM-DDformat, is outside the allowed range, or if the API call fails.- Return type:
Example
client.powerbyday.set_day("2026-05-22") print(client.powerbyday.get_data["values"])
- property get_data: dict
Intra-day power curve for the active station and date.
Example: {
‘metric’: ‘grid_power’, ‘date’: ‘2026-05-22’, ‘values’: {‘00:00’: 0.0, ‘01:00’: 0.0, ‘02:00’: 0.0, ‘03:00’: 0.0, ‘04:00’: 0.0, ‘05:00’: 0.0, ‘06:00’: 0.0, ‘06:30’: 42.6, ‘06:45’: 71.6, ‘07:00’: 108.3, ‘07:15’: 114.9, ‘07:30’: 199.4, ‘07:45’: 161.2, ‘08:00’: 139.6, ‘08:15’: 257.2, ‘08:30’: 501.9, ‘08:45’: 743.0, ‘09:00’: 784.7, ‘09:15’: 881.3, ‘09:30’: 1259.3, ‘09:45’: 929.3, ‘10:00’: 1225.9, ‘10:15’: 1416.0, ‘10:30’: 1535.7, ‘10:45’: 1131.0, ‘11:00’: 1917.1, ‘11:15’: 2750.5, ‘11:30’: 1542.4, ‘11:45’: 1220.3, ‘12:00’: 2245.9, ‘12:15’: 3135.0, ‘12:30’: 2582.1, ‘12:45’: 1930.6, ‘13:00’: 4368.4, ‘13:15’: 3474.5, ‘13:30’: 1516.8, ‘13:45’: 2436.1, ‘14:00’: 3371.3, ‘14:15’: 1513.3, ‘14:30’: 1891.5, ‘14:45’: 1967.2, ‘15:00’: 1906.7, ‘15:15’: 2066.9, ‘15:30’: 1863.2, ‘15:45’: 4957.9, ‘16:00’: 4360.8, ‘16:15’: 4118.8, ‘16:30’: 3748.1, ‘16:45’: 926.6, ‘17:00’: 1326.0, ‘17:15’: 1702.5, ‘17:30’: 1394.9, ‘17:45’: 1063.7, ‘18:00’: 645.2, ‘18:15’: 2089.5, ‘18:30’: 241.0, ‘18:45’: 549.7, ‘19:00’: 686.4, ‘19:15’: 583.5, ‘19:30’: 567.7, ‘19:45’: 434.7, ‘20:00’: 436.8, ‘20:15’: 426.4, ‘20:30’: 389.6, ‘20:45’: 177.9, ‘21:00’: 56.4, ‘21:15’: 20.8, ‘22:15’: 0.0, ‘23:15’: 0.0}
}
Returns a dictionary with three keys:
"metric"(str) - always"grid_power"."date"(str | None) - queried date inYYYY-MM-DDformat as confirmed by the API, orNoneif absent."values"(Dict[str, float]) -{HH:MM: watts}mapping of sampled grid power readings throughout the day.
- Returns:
Structured result with
metric,date, andvalueskeys.- Return type:
Example
data = client.powerbyday.get_data # { # "metric": "grid_power", # "date": "2026-05-22", # "values": {"08:00": 512.0, "08:30": 1024.5, ...} # } print(data["values"].get("12:00", 0))