mysolenso.services.dayofyeay - Day-of-Year Production History
MySolenso daily PV energy production service.
Provides the MySolensoCountByDayOfYeay class, which queries the
/power_day_of_year endpoint and parses the binary protobuf response to
expose a {date: energy_Wh} dictionary covering every day since the
station was commissioned.
The API returns a mixed response:
A UTF-8 text section listing dates in
YYYY-MM-DDformat (one per line).A binary protobuf section containing a
pv_eqfield encoded as a packedrepeated float(little-endian float32, wire type 2).
Both sections are parsed and zipped together to build the final mapping.
Example
client = MySolenso(username="user", token="tok")
data = client.day_of_year.get_data
print(data["2026-01-01"]) # e.g. 3241.5 (Wh)
# Switch station and refresh
client.day_of_year.set_station_id(43)
data = client.day_of_year.get_data
- class mysolenso.services.dayofyeay.MySolensoCountByDayOfYeay(parent)[source]
Bases:
objectDaily PV energy production indexed by date for a single station.
Parses the binary protobuf response from
/power_day_of_yearand exposes a{YYYY-MM-DD: float}dictionary where each value is the daily energy production in Wh.Days with no production (e.g. the current day before sunset, or cloudy days) are included with a value of
0.0rather than being silently dropped.- Parameters:
parent – Instance of
MySolensoproviding access to theauthandstationsub-modules.- Raises:
MySolensoException – If
parent.station.station_idisNone, or if parsing the response fails.
- parent
Reference to the parent
MySolensoobject.
Example
client = MySolenso(username="admin", token="tok") doy = client.day_of_year print(doy.get_data["2025-07-14"]) # 18432.0 Wh print(len(doy.get_data)) # number of days covered
- set_station_id(id, refresh=True)[source]
Switch the active station and optionally reload production 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.day_of_year.set_station_id(43) print(client.day_of_year.get_data["2026-01-01"])
- property get_data: Dict[str, float]
Daily energy production indexed by date.
Example
{‘2026-04-01’: 4825.0, ‘2026-04-02’: 10020.0, ‘2026-04-03’: 11647.0, ‘2026-04-04’: 16508.0, ‘2026-04-05’: 13898.0, ‘2026-04-06’: 25402.0, ‘2026-04-07’: 25699.0, ‘2026-04-08’: 25338.0, ‘2026-04-09’: 21791.0, ‘2026-04-10’: 22282.0, ‘2026-04-11’: 6802.0, ‘2026-04-12’: 16980.0, ‘2026-04-13’: 20415.0, ‘2026-04-14’: 26688.0, ‘2026-04-15’: 18080.0, ‘2026-04-16’: 23780.0, ‘2026-04-17’: 24516.0, ‘2026-04-18’: 17712.0, ‘2026-04-19’: 23548.0, ‘2026-04-20’: 22471.0, ‘2026-04-21’: 24273.0, ‘2026-04-22’: 26415.0, ‘2026-04-23’: 28823.0, ‘2026-04-24’: 28643.0, ‘2026-04-25’: 27013.0, ‘2026-04-26’: 26410.0, ‘2026-04-27’: 22913.0, ‘2026-04-28’: 23101.0, ‘2026-04-29’: 25910.0, ‘2026-04-30’: 29276.0, ‘2026-05-01’: 23831.0, ‘2026-05-02’: 25386.0, ‘2026-05-03’: 13307.0, ‘2026-05-04’: 10231.0, ‘2026-05-05’: 7342.0, ‘2026-05-06’: 16156.0, ‘2026-05-07’: 21370.0, ‘2026-05-08’: 28599.0, ‘2026-05-09’: 29313.0, ‘2026-05-10’: 11381.0, ‘2026-05-11’: 14577.0, ‘2026-05-12’: 25201.0, ‘2026-05-13’: 14353.0, ‘2026-05-14’: 17647.0, ‘2026-05-22’: 0.0}
Returns a dictionary where:
Keys are date strings in
YYYY-MM-DDformat.Values are energy production in Wh (
float), rounded to 2 decimal places. Days with no production have a value of0.0.
- Returns:
Complete date → Wh mapping for the active station, covering every day since commissioning up to today.
- Return type:
Example
data = client.day_of_year.get_data # {"2025-06-01": 28612.5, "2025-06-02": 31072.0, ..., "2026-05-22": 0.0} # Today's production (may be 0 if not yet updated) from datetime import date today = str(date.today()) print(data.get(today, "date not found"))