To run the system and apply the optimal heating decision for the current hour:

python main.py

This will:

  1. Fetch current weather and price data
  2. Determine the optimal heating decision
  3. 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:

  1. Verify your API keys are correct
  2. Check your internet connection
  3. Ensure you haven’t exceeded API rate limits

Smart Plug Connection Issues

If you have trouble connecting to your smart plug:

  1. Verify the IP address is correct
  2. Ensure the smart plug is connected to your network
  3. Check that your TP-Link credentials are correct