-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: Usage Calculator #102
Conversation
PR Summary
|
PR Description updated to latest commit (eed1d3c)
|
PR Review
✨ Review tool usage guide:Overview: The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on any PR.
See the review usage page for a comprehensive guide on using this tool. |
PR Code Suggestions
✨ Improve tool usage guide:Overview:
See the improve usage page for a comprehensive guide on using this tool. |
User description
What changes do you are proposing?
How did you test these changes?
Closing issues
Type
enhancement, bug_fix
Description
UsageCalculator
with functionality to calculate electricity consumption and costs.send_post_request
method.iec_client.py
with async file writing and usage calculator integration.static_data.py
.Consumption
,ElectricDevice
,GetCalculatorResponse
,Rates
) to support the usage calculator functionality.Changes walkthrough
10 files
example.py
Demonstrate UsageCalculator in Main Function
example.py
UsageCalculator
in themain
function.calculate consumption for a specific device.
const.py
Add Constant for Calculator Gadget URL
iec_api/const.py
GET_CALCULATOR_GADGET_URL
constant for the new calculator gadgetendpoint.
data.py
Code Cleanup and Removal of get_kwh_tariff Function
iec_api/data.py
get_efs_messages
to use formatted string for service code.get_kwh_tariff
function as it's now handled instatic_data.py
.iec_client.py
Integrate UsageCalculator and Async File Writing
iec_api/iec_client.py
get_usage_calculator
method to obtain theUsageCalculator
instance.
save_invoice_pdf_to_file
to useaiofiles
for asynchronousfile writing.
static_data.py
Implement Static Data Handling for Usage Calculator
iec_api/static_data.py
get_usage_calculator
andget_kwh_tariff
functions forhandling calculator data.
calculator.py
Add UsageCalculator Class with Consumption Calculation
iec_api/usage_calculator/calculator.py
UsageCalculator
class with methods to load data, get kWh tariff,device names, device info, and calculate consumption.
consumption.py
Introduce Consumption Dataclass
iec_api/usage_calculator/consumption.py
Consumption
dataclass to represent power consumption data.electric_device.py
Define ElectricDevice Dataclass and Enums
iec_api/usage_calculator/electric_device.py
ElectricDevice
dataclass and related enums for deviceinformation.
get_calculator_response.py
Add GetCalculatorResponse Dataclass
iec_api/usage_calculator/get_calculator_response.py
GetCalculatorResponse
dataclass to parse calculator gadget APIresponse.
rates.py
Add Rates Dataclass for Calculator
iec_api/usage_calculator/rates.py
Rates
dataclass to represent calculator rates including VAT.1 files
commons.py
Fix Timeout Assignment in send_post_request
iec_api/commons.py
timeout
was incorrectly assigned toheaders
insteadof being properly set.