Usage
To run the system and apply the optimal heating decision for the current hour:
python main.py
This will:
- Fetch current weather and price data
- Determine the optimal heating decision
- Control the smart plug accordingly
Customizing Heating Parameters
You can modify the heating parameters in the find_heating_decision
function call in main.py
:
user_input = bool(utils.find_heating_decision(
temp_price_df,
decision='discrete',
heat_loss=0.1, # Adjust heat loss rate
heating_power=2, # Adjust heating power
min_temperature=18 # Adjust minimum temperature
)[0][0])
Analysis and Visualization
To analyze and visualize the performance of different heating strategies:
# In a Python script or notebook
from strom import utils
# Get temperature and price data
temp_price_df = utils.get_temp_price_df()
# Compare optimal vs baseline strategies
compare_df = utils.compare_decision_costs(
temp_price_df,
heat_loss=0.1,
heating_power=2,
min_temperature=18
)
# Generate visualization
utils.plot_costs_and_temps(compare_df)
Troubleshooting
API Connection Issues
If you encounter API connection issues:
- Verify your API keys are correct
- Check your internet connection
- Ensure you haven’t exceeded API rate limits
Smart Plug Connection Issues
If you have trouble connecting to your smart plug:
- Verify the IP address is correct
- Ensure the smart plug is connected to your network
- Check that your TP-Link credentials are correct