leneda-client 0.1.0__py3-none-any.whl → 0.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
leneda/__init__.py CHANGED
@@ -17,7 +17,7 @@ from .models import (
17
17
  )
18
18
 
19
19
  # Import the OBIS code constants
20
- from .obis_codes import ElectricityConsumption, ElectricityProduction, GasConsumption
20
+ from .obis_codes import ObisCode
21
21
 
22
22
  # Import the version
23
23
  from .version import __version__
@@ -25,9 +25,7 @@ from .version import __version__
25
25
  # Define what's available when using "from leneda import *"
26
26
  __all__ = [
27
27
  "LenedaClient",
28
- "ElectricityConsumption",
29
- "ElectricityProduction",
30
- "GasConsumption",
28
+ "ObisCode",
31
29
  "MeteringValue",
32
30
  "MeteringData",
33
31
  "AggregatedMeteringValue",
leneda/client.py CHANGED
@@ -8,11 +8,15 @@ energy consumption and production data for electricity and gas.
8
8
  import json
9
9
  import logging
10
10
  from datetime import datetime
11
- from typing import Any, Dict, Union
11
+ from typing import Any, Dict, List, Optional, Union
12
12
 
13
13
  import requests
14
14
 
15
- from .models import AggregatedMeteringData, MeteringData
15
+ from .models import (
16
+ AggregatedMeteringData,
17
+ MeteringData,
18
+ )
19
+ from .obis_codes import ObisCode
16
20
 
17
21
  # Set up logging
18
22
  logger = logging.getLogger("leneda.client")
@@ -50,22 +54,22 @@ class LenedaClient:
50
54
 
51
55
  def _make_request(
52
56
  self,
57
+ method: str,
53
58
  endpoint: str,
54
- method: str = "GET",
55
- params: Dict[str, Any] = None,
56
- data: Dict[str, Any] = None,
57
- ) -> Dict[str, Any]:
59
+ params: Optional[dict] = None,
60
+ json_data: Optional[dict] = None,
61
+ ) -> dict:
58
62
  """
59
63
  Make a request to the Leneda API.
60
64
 
61
65
  Args:
62
- endpoint: API endpoint to call
63
- method: HTTP method to use
64
- params: Query parameters
65
- data: Request body data
66
+ method: The HTTP method to use
67
+ endpoint: The API endpoint to call
68
+ params: Optional query parameters
69
+ json_data: Optional JSON data to send in the request body
66
70
 
67
71
  Returns:
68
- API response as a dictionary
72
+ The JSON response from the API
69
73
  """
70
74
  url = f"{self.BASE_URL}/{endpoint}"
71
75
 
@@ -73,13 +77,13 @@ class LenedaClient:
73
77
  logger.debug(f"Making {method} request to {url}")
74
78
  if params:
75
79
  logger.debug(f"Query parameters: {params}")
76
- if data:
77
- logger.debug(f"Request data: {data}")
80
+ if json_data:
81
+ logger.debug(f"Request data: {json.dumps(json_data, indent=2)}")
78
82
 
79
83
  try:
80
84
  # Make the request
81
85
  response = requests.request(
82
- method=method, url=url, headers=self.headers, params=params, json=data
86
+ method=method, url=url, headers=self.headers, params=params, json=json_data
83
87
  )
84
88
 
85
89
  # Check for HTTP errors
@@ -117,7 +121,7 @@ class LenedaClient:
117
121
  def get_metering_data(
118
122
  self,
119
123
  metering_point_code: str,
120
- obis_code: str,
124
+ obis_code: ObisCode,
121
125
  start_date_time: Union[str, datetime],
122
126
  end_date_time: Union[str, datetime],
123
127
  ) -> MeteringData:
@@ -126,7 +130,7 @@ class LenedaClient:
126
130
 
127
131
  Args:
128
132
  metering_point_code: The metering point code
129
- obis_code: The OBIS code
133
+ obis_code: The OBIS code (from ElectricityConsumption, ElectricityProduction, or GasConsumption)
130
134
  start_date_time: Start date and time (ISO format string or datetime object)
131
135
  end_date_time: End date and time (ISO format string or datetime object)
132
136
 
@@ -142,23 +146,21 @@ class LenedaClient:
142
146
  # Set up the endpoint and parameters
143
147
  endpoint = f"metering-points/{metering_point_code}/time-series"
144
148
  params = {
145
- "obisCode": obis_code,
149
+ "obisCode": obis_code.value, # Use enum value for API request
146
150
  "startDateTime": start_date_time,
147
151
  "endDateTime": end_date_time,
148
152
  }
149
153
 
150
154
  # Make the request
151
- response_data = self._make_request(endpoint, params=params)
155
+ response_data = self._make_request(method="GET", endpoint=endpoint, params=params)
152
156
 
153
157
  # Parse the response into a MeteringData object
154
- return MeteringData.from_dict(
155
- response_data, metering_point_code=metering_point_code, obis_code=obis_code
156
- )
158
+ return MeteringData.from_dict(response_data)
157
159
 
158
160
  def get_aggregated_metering_data(
159
161
  self,
160
162
  metering_point_code: str,
161
- obis_code: str,
163
+ obis_code: ObisCode,
162
164
  start_date: Union[str, datetime],
163
165
  end_date: Union[str, datetime],
164
166
  aggregation_level: str = "Day",
@@ -169,11 +171,11 @@ class LenedaClient:
169
171
 
170
172
  Args:
171
173
  metering_point_code: The metering point code
172
- obis_code: The OBIS code
174
+ obis_code: The OBIS code (from ElectricityConsumption, ElectricityProduction, or GasConsumption)
173
175
  start_date: Start date (ISO format string or datetime object)
174
176
  end_date: End date (ISO format string or datetime object)
175
- aggregation_level: Aggregation level (Day, Week, Month, Quarter, Year)
176
- transformation_mode: Transformation mode (Accumulation, Average, Maximum, Minimum)
177
+ aggregation_level: Aggregation level (Hour, Day, Week, Month, Infinite)
178
+ transformation_mode: Transformation mode (Accumulation)
177
179
 
178
180
  Returns:
179
181
  AggregatedMeteringData object containing the aggregated time series data
@@ -187,7 +189,7 @@ class LenedaClient:
187
189
  # Set up the endpoint and parameters
188
190
  endpoint = f"metering-points/{metering_point_code}/time-series/aggregated"
189
191
  params = {
190
- "obisCode": obis_code,
192
+ "obisCode": obis_code.value, # Use enum value for API request
191
193
  "startDate": start_date,
192
194
  "endDate": end_date,
193
195
  "aggregationLevel": aggregation_level,
@@ -195,32 +197,40 @@ class LenedaClient:
195
197
  }
196
198
 
197
199
  # Make the request
198
- response_data = self._make_request(endpoint, params=params)
200
+ response_data = self._make_request(method="GET", endpoint=endpoint, params=params)
199
201
 
200
202
  # Parse the response into an AggregatedMeteringData object
201
- return AggregatedMeteringData.from_dict(
202
- response_data,
203
- metering_point_code=metering_point_code,
204
- obis_code=obis_code,
205
- aggregation_level=aggregation_level,
206
- transformation_mode=transformation_mode,
207
- )
208
-
209
- def request_metering_data_access(self, metering_point_code: str) -> Dict[str, Any]:
203
+ return AggregatedMeteringData.from_dict(response_data)
204
+
205
+ def request_metering_data_access(
206
+ self,
207
+ from_energy_id: str,
208
+ from_name: str,
209
+ metering_point_codes: List[str],
210
+ obis_codes: List[ObisCode],
211
+ ) -> Dict[str, Any]:
210
212
  """
211
213
  Request access to metering data for a specific metering point.
212
214
 
213
215
  Args:
214
- metering_point_code: The metering point code
216
+ from_energy_id: The energy ID of the requester
217
+ from_name: The name of the requester
218
+ metering_point_codes: The metering point codes to access
219
+ obis_point_codes: The OBIS point codes to access (from ElectricityConsumption, ElectricityProduction, or GasConsumption)
215
220
 
216
221
  Returns:
217
222
  Response data from the API
218
223
  """
219
224
  # Set up the endpoint and data
220
225
  endpoint = "metering-data-access-request"
221
- data = {"meteringPointCode": metering_point_code}
226
+ data = {
227
+ "from": from_energy_id,
228
+ "fromName": from_name,
229
+ "meteringPointCodes": metering_point_codes,
230
+ "obisCodes": [code.value for code in obis_codes], # Use enum values for API request
231
+ }
222
232
 
223
233
  # Make the request
224
- response_data = self._make_request(endpoint, method="POST", data=data)
234
+ response_data = self._make_request(method="POST", endpoint=endpoint, json_data=data)
225
235
 
226
236
  return response_data
leneda/models.py CHANGED
@@ -12,6 +12,8 @@ from typing import Any, Dict, List
12
12
 
13
13
  from dateutil import parser
14
14
 
15
+ from .obis_codes import ObisCode
16
+
15
17
  # Set up logging
16
18
  logger = logging.getLogger("leneda.models")
17
19
 
@@ -64,23 +66,21 @@ class MeteringData:
64
66
  """Metering data for a specific metering point and OBIS code."""
65
67
 
66
68
  metering_point_code: str
67
- obis_code: str
69
+ obis_code: ObisCode
68
70
  interval_length: str
69
71
  unit: str
70
72
  items: List[MeteringValue] = field(default_factory=list)
71
73
 
72
74
  @classmethod
73
- def from_dict(
74
- cls, data: Dict[str, Any], metering_point_code: str = "", obis_code: str = ""
75
- ) -> "MeteringData":
75
+ def from_dict(cls, data: Dict[str, Any]) -> "MeteringData":
76
76
  """Create a MeteringData from a dictionary."""
77
77
  try:
78
78
  # Log the raw data for debugging
79
79
  logger.debug(f"Creating MeteringData from: {data}")
80
80
 
81
- # Use values from the response, falling back to provided values if not in response
82
- metering_point_code_value = data.get("meteringPointCode", metering_point_code)
83
- obis_code_value = data.get("obisCode", obis_code)
81
+ # Use values from the response
82
+ metering_point_code_value = data["meteringPointCode"]
83
+ obis_code_value = ObisCode(data["obisCode"])
84
84
 
85
85
  # Extract items safely
86
86
  items_data = data.get("items", [])
@@ -101,6 +101,10 @@ class MeteringData:
101
101
  unit=data.get("unit", ""),
102
102
  items=items,
103
103
  )
104
+ except KeyError as e:
105
+ logger.error(f"Missing key in API response: {e}")
106
+ logger.debug(f"API response data: {data}")
107
+ raise
104
108
  except Exception as e:
105
109
  logger.error(f"Error creating MeteringData: {e}")
106
110
  logger.debug(f"API response data: {data}")
@@ -184,10 +188,6 @@ class AggregatedMeteringData:
184
188
  def from_dict(
185
189
  cls,
186
190
  data: Dict[str, Any],
187
- metering_point_code: str = "",
188
- obis_code: str = "",
189
- aggregation_level: str = "",
190
- transformation_mode: str = "",
191
191
  ) -> "AggregatedMeteringData":
192
192
  """Create an AggregatedMeteringData from a dictionary."""
193
193
  try:
@@ -206,7 +206,11 @@ class AggregatedMeteringData:
206
206
  logger.warning(f"Skipping invalid aggregated item: {e}")
207
207
  logger.debug(f"Invalid item data: {item_data}")
208
208
 
209
- return cls(unit=data.get("unit", ""), aggregated_time_series=time_series)
209
+ return cls(unit=data["unit"], aggregated_time_series=time_series)
210
+ except KeyError as e:
211
+ logger.error(f"Missing key in API response: {e}")
212
+ logger.debug(f"API response data: {data}")
213
+ raise
210
214
  except Exception as e:
211
215
  logger.error(f"Error creating AggregatedMeteringData: {e}")
212
216
  logger.debug(f"API response data: {data}")
leneda/obis_codes.py CHANGED
@@ -20,139 +20,136 @@ class ObisCodeInfo:
20
20
  description: str
21
21
 
22
22
 
23
- class ElectricityConsumption(str, Enum):
24
- """OBIS codes for electricity consumption."""
23
+ class ObisCode(str, Enum):
24
+ """OBIS codes for all energy types."""
25
25
 
26
- ACTIVE = "1-1:1.29.0" # Measured active consumption (kW)
27
- REACTIVE = "1-1:3.29.0" # Measured reactive consumption (kVAR)
26
+ # Electricity Consumption
27
+ ELEC_CONSUMPTION_ACTIVE = "1-1:1.29.0" # Measured active consumption (kW)
28
+ ELEC_CONSUMPTION_REACTIVE = "1-1:3.29.0" # Measured reactive consumption (kVAR)
28
29
 
29
30
  # Consumption covered by production sharing groups
30
- COVERED_LAYER1 = "1-65:1.29.1" # Layer 1 sharing Group (AIR)
31
- COVERED_LAYER2 = "1-65:1.29.3" # Layer 2 sharing Group (ACR/ACF/AC1)
32
- COVERED_LAYER3 = "1-65:1.29.2" # Layer 3 sharing Group (CEL)
33
- COVERED_LAYER4 = "1-65:1.29.4" # Layer 4 sharing Group (APS/CER/CEN)
34
- REMAINING = "1-65:1.29.9" # Remaining consumption after sharing invoiced by supplier
35
-
31
+ ELEC_CONSUMPTION_COVERED_LAYER1 = "1-65:1.29.1" # Layer 1 sharing Group (AIR)
32
+ ELEC_CONSUMPTION_COVERED_LAYER2 = "1-65:1.29.3" # Layer 2 sharing Group (ACR/ACF/AC1)
33
+ ELEC_CONSUMPTION_COVERED_LAYER3 = "1-65:1.29.2" # Layer 3 sharing Group (CEL)
34
+ ELEC_CONSUMPTION_COVERED_LAYER4 = "1-65:1.29.4" # Layer 4 sharing Group (APS/CER/CEN)
35
+ ELEC_CONSUMPTION_REMAINING = (
36
+ "1-65:1.29.9" # Remaining consumption after sharing invoiced by supplier
37
+ )
36
38
 
37
- class ElectricityProduction(str, Enum):
38
- """OBIS codes for electricity production."""
39
-
40
- ACTIVE = "1-1:2.29.0" # Measured active production (kW)
41
- REACTIVE = "1-1:4.29.0" # Measured reactive production (kVAR)
39
+ # Electricity Production
40
+ ELEC_PRODUCTION_ACTIVE = "1-1:2.29.0" # Measured active production (kW)
41
+ ELEC_PRODUCTION_REACTIVE = "1-1:4.29.0" # Measured reactive production (kVAR)
42
42
 
43
43
  # Production shared within sharing groups
44
- SHARED_LAYER1 = "1-65:2.29.1" # Layer 1 sharing Group (AIR)
45
- SHARED_LAYER2 = "1-65:2.29.3" # Layer 2 sharing Group (ACR/ACF/AC1)
46
- SHARED_LAYER3 = "1-65:2.29.2" # Layer 3 sharing Group (CEL)
47
- SHARED_LAYER4 = "1-65:2.29.4" # Layer 4 sharing Group (APS/CER/CEN)
48
- REMAINING = "1-65:2.29.9" # Remaining production after sharing sold to market
44
+ ELEC_PRODUCTION_SHARED_LAYER1 = "1-65:2.29.1" # Layer 1 sharing Group (AIR)
45
+ ELEC_PRODUCTION_SHARED_LAYER2 = "1-65:2.29.3" # Layer 2 sharing Group (ACR/ACF/AC1)
46
+ ELEC_PRODUCTION_SHARED_LAYER3 = "1-65:2.29.2" # Layer 3 sharing Group (CEL)
47
+ ELEC_PRODUCTION_SHARED_LAYER4 = "1-65:2.29.4" # Layer 4 sharing Group (APS/CER/CEN)
48
+ ELEC_PRODUCTION_REMAINING = "1-65:2.29.9" # Remaining production after sharing sold to market
49
49
 
50
-
51
- class GasConsumption(str, Enum):
52
- """OBIS codes for gas consumption."""
53
-
54
- VOLUME = "7-1:99.23.15" # Measured consumed volume (m³)
55
- STANDARD_VOLUME = "7-1:99.23.17" # Measured consumed standard volume (Nm³)
56
- ENERGY = "7-20:99.33.17" # Measured consumed energy (kWh)
50
+ # Gas Consumption
51
+ GAS_CONSUMPTION_VOLUME = "7-1:99.23.15" # Measured consumed volume ()
52
+ GAS_CONSUMPTION_STANDARD_VOLUME = "7-1:99.23.17" # Measured consumed standard volume (Nm³)
53
+ GAS_CONSUMPTION_ENERGY = "7-20:99.33.17" # Measured consumed energy (kWh)
57
54
 
58
55
 
59
56
  # Complete mapping of all OBIS codes to their details
60
57
  OBIS_CODES: Dict[str, ObisCodeInfo] = {
61
58
  # Electricity Consumption
62
- ElectricityConsumption.ACTIVE: ObisCodeInfo(
63
- ElectricityConsumption.ACTIVE,
59
+ ObisCode.ELEC_CONSUMPTION_ACTIVE: ObisCodeInfo(
60
+ ObisCode.ELEC_CONSUMPTION_ACTIVE,
64
61
  "kW",
65
62
  "Consumption",
66
63
  "Measured active consumption",
67
64
  ),
68
- ElectricityConsumption.REACTIVE: ObisCodeInfo(
69
- ElectricityConsumption.REACTIVE,
65
+ ObisCode.ELEC_CONSUMPTION_REACTIVE: ObisCodeInfo(
66
+ ObisCode.ELEC_CONSUMPTION_REACTIVE,
70
67
  "kVAR",
71
68
  "Consumption",
72
69
  "Measured reactive consumption",
73
70
  ),
74
- ElectricityConsumption.COVERED_LAYER1: ObisCodeInfo(
75
- ElectricityConsumption.COVERED_LAYER1,
71
+ ObisCode.ELEC_CONSUMPTION_COVERED_LAYER1: ObisCodeInfo(
72
+ ObisCode.ELEC_CONSUMPTION_COVERED_LAYER1,
76
73
  "kW",
77
74
  "Consumption",
78
75
  "Consumption covered by production of layer 1 sharing Group (AIR)",
79
76
  ),
80
- ElectricityConsumption.COVERED_LAYER2: ObisCodeInfo(
81
- ElectricityConsumption.COVERED_LAYER2,
77
+ ObisCode.ELEC_CONSUMPTION_COVERED_LAYER2: ObisCodeInfo(
78
+ ObisCode.ELEC_CONSUMPTION_COVERED_LAYER2,
82
79
  "kW",
83
80
  "Consumption",
84
81
  "Consumption covered by production of layer 2 sharing Group (ACR/ACF/AC1)",
85
82
  ),
86
- ElectricityConsumption.COVERED_LAYER3: ObisCodeInfo(
87
- ElectricityConsumption.COVERED_LAYER3,
83
+ ObisCode.ELEC_CONSUMPTION_COVERED_LAYER3: ObisCodeInfo(
84
+ ObisCode.ELEC_CONSUMPTION_COVERED_LAYER3,
88
85
  "kW",
89
86
  "Consumption",
90
87
  "Consumption covered by production of layer 3 sharing Group (CEL)",
91
88
  ),
92
- ElectricityConsumption.COVERED_LAYER4: ObisCodeInfo(
93
- ElectricityConsumption.COVERED_LAYER4,
89
+ ObisCode.ELEC_CONSUMPTION_COVERED_LAYER4: ObisCodeInfo(
90
+ ObisCode.ELEC_CONSUMPTION_COVERED_LAYER4,
94
91
  "kW",
95
92
  "Consumption",
96
93
  "Consumption covered by production of layer 4 sharing Group (APS/CER/CEN)",
97
94
  ),
98
- ElectricityConsumption.REMAINING: ObisCodeInfo(
99
- ElectricityConsumption.REMAINING,
95
+ ObisCode.ELEC_CONSUMPTION_REMAINING: ObisCodeInfo(
96
+ ObisCode.ELEC_CONSUMPTION_REMAINING,
100
97
  "kW",
101
98
  "Consumption",
102
99
  "Remaining consumption after sharing invoiced by supplier",
103
100
  ),
104
101
  # Electricity Production
105
- ElectricityProduction.ACTIVE: ObisCodeInfo(
106
- ElectricityProduction.ACTIVE, "kW", "Production", "Measured active production"
102
+ ObisCode.ELEC_PRODUCTION_ACTIVE: ObisCodeInfo(
103
+ ObisCode.ELEC_PRODUCTION_ACTIVE, "kW", "Production", "Measured active production"
107
104
  ),
108
- ElectricityProduction.REACTIVE: ObisCodeInfo(
109
- ElectricityProduction.REACTIVE,
105
+ ObisCode.ELEC_PRODUCTION_REACTIVE: ObisCodeInfo(
106
+ ObisCode.ELEC_PRODUCTION_REACTIVE,
110
107
  "kVAR",
111
108
  "Consumption",
112
109
  "Measured reactive production",
113
110
  ),
114
- ElectricityProduction.SHARED_LAYER1: ObisCodeInfo(
115
- ElectricityProduction.SHARED_LAYER1,
111
+ ObisCode.ELEC_PRODUCTION_SHARED_LAYER1: ObisCodeInfo(
112
+ ObisCode.ELEC_PRODUCTION_SHARED_LAYER1,
116
113
  "kW",
117
114
  "Production",
118
115
  "Production shared within layer 1 sharing Group (AIR)",
119
116
  ),
120
- ElectricityProduction.SHARED_LAYER2: ObisCodeInfo(
121
- ElectricityProduction.SHARED_LAYER2,
117
+ ObisCode.ELEC_PRODUCTION_SHARED_LAYER2: ObisCodeInfo(
118
+ ObisCode.ELEC_PRODUCTION_SHARED_LAYER2,
122
119
  "kW",
123
120
  "Production",
124
121
  "Production shared within layer 2 sharing Group (ACR/ACF/AC1)",
125
122
  ),
126
- ElectricityProduction.SHARED_LAYER3: ObisCodeInfo(
127
- ElectricityProduction.SHARED_LAYER3,
123
+ ObisCode.ELEC_PRODUCTION_SHARED_LAYER3: ObisCodeInfo(
124
+ ObisCode.ELEC_PRODUCTION_SHARED_LAYER3,
128
125
  "kW",
129
126
  "Production",
130
127
  "Production shared within layer 3 sharing Group (CEL)",
131
128
  ),
132
- ElectricityProduction.SHARED_LAYER4: ObisCodeInfo(
133
- ElectricityProduction.SHARED_LAYER4,
129
+ ObisCode.ELEC_PRODUCTION_SHARED_LAYER4: ObisCodeInfo(
130
+ ObisCode.ELEC_PRODUCTION_SHARED_LAYER4,
134
131
  "kW",
135
132
  "Production",
136
133
  "Production shared within layer 4 sharing Group (APS/CER/CEN)",
137
134
  ),
138
- ElectricityProduction.REMAINING: ObisCodeInfo(
139
- ElectricityProduction.REMAINING,
135
+ ObisCode.ELEC_PRODUCTION_REMAINING: ObisCodeInfo(
136
+ ObisCode.ELEC_PRODUCTION_REMAINING,
140
137
  "kW",
141
138
  "Production",
142
139
  "Remaining production after sharing sold to market",
143
140
  ),
144
141
  # Gas Consumption
145
- GasConsumption.VOLUME: ObisCodeInfo(
146
- GasConsumption.VOLUME, "m³", "Consumption", "Measured consumed volume"
142
+ ObisCode.GAS_CONSUMPTION_VOLUME: ObisCodeInfo(
143
+ ObisCode.GAS_CONSUMPTION_VOLUME, "m³", "Consumption", "Measured consumed volume"
147
144
  ),
148
- GasConsumption.STANDARD_VOLUME: ObisCodeInfo(
149
- GasConsumption.STANDARD_VOLUME,
145
+ ObisCode.GAS_CONSUMPTION_STANDARD_VOLUME: ObisCodeInfo(
146
+ ObisCode.GAS_CONSUMPTION_STANDARD_VOLUME,
150
147
  "Nm³",
151
148
  "Consumption",
152
149
  "Measured consumed standard volume",
153
150
  ),
154
- GasConsumption.ENERGY: ObisCodeInfo(
155
- GasConsumption.ENERGY, "kWh", "Consumption", "Measured consumed energy"
151
+ ObisCode.GAS_CONSUMPTION_ENERGY: ObisCodeInfo(
152
+ ObisCode.GAS_CONSUMPTION_ENERGY, "kWh", "Consumption", "Measured consumed energy"
156
153
  ),
157
154
  }
158
155
 
@@ -171,7 +168,7 @@ def get_obis_info(obis_code: str) -> ObisCodeInfo:
171
168
  KeyError: If the OBIS code is not found
172
169
 
173
170
  Example:
174
- >>> info = get_obis_info(ElectricityConsumption.ACTIVE)
171
+ >>> info = get_obis_info(ObisCode.ELEC_CONSUMPTION_ACTIVE)
175
172
  >>> print(info.unit)
176
173
  'kW'
177
174
  """
@@ -192,7 +189,7 @@ def get_unit(obis_code: str) -> str:
192
189
  KeyError: If the OBIS code is not found
193
190
 
194
191
  Example:
195
- >>> unit = get_unit(ElectricityConsumption.ACTIVE)
192
+ >>> unit = get_unit(ObisCode.ELEC_CONSUMPTION_ACTIVE)
196
193
  >>> print(unit)
197
194
  'kW'
198
195
  """
leneda/version.py CHANGED
@@ -1,3 +1,3 @@
1
1
  """Version information."""
2
2
 
3
- __version__ = "0.1.0"
3
+ __version__ = "0.2.0"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: leneda-client
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: Python client for the Leneda energy data platform
5
5
  Home-page: https://github.com/fedus/leneda-client
6
6
  Author: fedus
@@ -0,0 +1,9 @@
1
+ leneda/__init__.py,sha256=-BHIXBfTTbX6EKDHr2Bq7rPzsPNYrrkgs9AJqWJR_1Q,732
2
+ leneda/client.py,sha256=NFZczkNkvTBZOSU5FCQ9A_TE_x4s7eX9iKrWqzeubr4,8393
3
+ leneda/models.py,sha256=jdU2cIZZDExUSiSfz9zaYjJepr0m3v_x5b1fyOaEI8Q,7930
4
+ leneda/obis_codes.py,sha256=VfsJQN1U80eZ5g1bIteDCLkkmBQ0AIkkm_zNAeM1Dog,7507
5
+ leneda/version.py,sha256=K2uqgpmNuApS_OV5kcSoshVG9LFQlr-es1HuZALwCq4,50
6
+ leneda_client-0.2.0.dist-info/METADATA,sha256=CqBEdkRXJUCOk9qSKmv9ZBNIgzov_9mroXa5v7i_pcA,1994
7
+ leneda_client-0.2.0.dist-info/WHEEL,sha256=lTU6B6eIfYoiQJTZNc-fyaR6BpL6ehTzU3xGYxn2n8k,91
8
+ leneda_client-0.2.0.dist-info/top_level.txt,sha256=PANScm25ep7WLjKiph0fhJPb8s_sa_uLHemnBpQBaJ8,7
9
+ leneda_client-0.2.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (78.1.0)
2
+ Generator: setuptools (78.1.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,9 +0,0 @@
1
- leneda/__init__.py,sha256=JLvEM9M0jk2LcYK9DWYKrSF_BXTvmC8i570N_BggPck,850
2
- leneda/client.py,sha256=G_4kQi54ob3Te5gcQqH1KBRfkYBe00b-WDDTn6HCMNI,7716
3
- leneda/models.py,sha256=hTDEsdgUZJA-9jSqbOOoeJbCvFmgHMj3eZ8JZilWGpo,7861
4
- leneda/obis_codes.py,sha256=gPrxnYfUNvWrbKFA3z-4TSTHnOhWHt5hkm5GAwoo0-w,7170
5
- leneda/version.py,sha256=HOmU5sgXU14tXjdvSe0iIIyluugGL0Y7R8eo1JaeyxE,50
6
- leneda_client-0.1.0.dist-info/METADATA,sha256=lVPMKoe-FKvngJjQXzFLEpmKn3nrhsMppBWhwEvoobI,1994
7
- leneda_client-0.1.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
8
- leneda_client-0.1.0.dist-info/top_level.txt,sha256=PANScm25ep7WLjKiph0fhJPb8s_sa_uLHemnBpQBaJ8,7
9
- leneda_client-0.1.0.dist-info/RECORD,,