mysolenso.services.stationcount - Energy Counters
MySolenso station energy counters service.
Provides the MySolensoStationCount class, which queries the
/data_count_station_real_data endpoint and exposes the cumulative and
real-time energy production counters for a single PV station.
Returned metrics include today’s yield, monthly and yearly totals, lifetime production, current real power, CO₂ savings, equivalent trees planted, and timestamps for the latest data update.
This module is instantiated automatically by MySolenso
and accessible via client.stationcount.
Example
client = MySolenso(username="user", token="tok")
print(client.stationcount.today_eq) # e.g. "12.34" (kWh today)
print(client.stationcount.total_eq) # e.g. "4521.0" (kWh lifetime)
print(client.stationcount.real_power) # e.g. "2048" (W, current)
print(client.stationcount.co2_emission_reduction)
print(client.stationcount.last_data_time)
- class mysolenso.services.stationcount.MySolensoStationCount(parent)[source]
Bases:
objectReal-time and cumulative energy counters for a single PV station.
Queries the
/data_count_station_real_dataSolenso endpoint and caches the response. All production metrics are exposed as read-only properties.- Parameters:
parent – Instance of
MySolensoproviding access to theauthandstationsub-modules.- Raises:
MySolensoException – If
parent.station.station_idisNone, or if the API response is invalid.
- parent
Reference to the parent
MySolensoobject.
Example
client = MySolenso(username="jdoe", token="tok") sc = client.stationcount print(sc.today_eq) # today's yield in kWh print(sc.month_eq) # month-to-date yield in kWh print(sc.year_eq) # year-to-date yield in kWh print(sc.total_eq) # lifetime yield in kWh print(sc.real_power) # current AC output in W print(sc.co2_emission_reduction) # CO₂ saved in kg print(sc.plant_tree) # equivalent trees planted print(sc.data_time) # data timestamp print(sc.last_data_time) # last measurement timestamp print(sc.capacitor) # installed capacity in kWp
- set_station_count(id)[source]
Switch the active station and reload all counters from the API.
- Parameters:
id (
int) – Station ID to activate. Must exist in the account’s station list.- Raises:
MySolensoException – If
idis not found in the account’s station list, or if the API call fails.- Return type:
Example
client.stationcount.set_station_count(43) print(client.stationcount.today_eq)
- get_station_refresh()[source]
Query the API for refresh station energy counters.
Sends a POST request to
API_STATION_COUNTwith the current station ID wrapped in the Solenso RAW payload format, then maps each response field onto a private attribute.- Raises:
MySolensoException – If the request fails, times out, or the JSON response is malformed.
- Return type:
- property all_data: dict
Full raw response returned by the
/data_count_station_real_dataendpoint.Useful for accessing fields not exposed by the other properties.
Example
- {
“is_null”: 0, “today_eq”: “17647.0”, “month_eq”: “241047”, “year_eq”: “1769064”, “total_eq”: “14685977”, “real_power”: “0”, “co2_emission_reduction”: “14641919.069”, “plant_tree”: “800”, “data_time”: “2026-05-22 21:20:06”, “last_data_time”: “2026-05-22 21:20:06”, “capacitor”: “5”, “is_balance”: 0, “is_reflux”: 0, “pv2”: 0, “clp”: 200
}
- Returns:
Complete
datadictionary from the API response.- Return type:
- property station_id: int
Identifier of the station currently loaded.
- Returns:
Station ID used for the last API call.
- Return type:
- property today_eq: str
Energy produced today (Wh).
- Returns:
today_eqfield from the API response.- Return type:
- property month_eq: str
Energy produced in the current calendar month (Wh).
- Returns:
month_eqfield from the API response.- Return type:
- property year_eq: str
Energy produced in the current calendar year (Wh).
- Returns:
year_eqfield from the API response.- Return type:
- property total_eq: str
Lifetime energy produced by the station (Wh).
- Returns:
total_eqfield from the API response.- Return type:
- property real_power: str
Current AC output power of the station (W).
This value reflects the instantaneous grid injection measured at the time of the last data update.
- Returns:
real_powerfield from the API response.- Return type:
- property co2_emission_reduction: str
Cumulative CO₂ emissions avoided by the station (kg).
Calculated from lifetime production using a platform-defined carbon intensity factor.
- Returns:
co2_emission_reductionfield from the API response.- Return type:
- property plant_tree: str
Equivalent number of trees planted, based on CO₂ savings.
A symbolic metric provided by the Solenso platform.
- Returns:
plant_treefield from the API response.- Return type:
- property data_time: str
Timestamp of the data record returned by the API.
- Returns:
data_timefield (format depends on API; typicallyYYYY-MM-DD HH:MM:SSor Unix epoch).- Return type: