Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions nsw_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
sell_price_threshold_1 = 20 # sell in morning
sell_price_threshold_2 = 1000 # Sell during peak
buy_price_morning = 5 # Morning buy price
buy_top_up_price = 20
# This is when we expect the solar production to meet our house load
minutes_after_sunrise_solar_matches_load = 30
solar_production_time = sunrise + timedelta(minutes=minutes_after_sunrise_solar_matches_load)
Expand Down Expand Up @@ -79,10 +80,21 @@
action = 'export'
reason = f'nsw: pre 5am use it or lose it down to {desired_soc}%'

if 4 < hour and interval_time < solar_production_time and battery_soc > 10 and sell_price > 15:
if (hour > 21 or hour < 5) and (battery_soc < desired_soc):
if (buy_price < buy_top_up_price):
best_upcoming = min(buy_forecast)
if buy_price < (best_upcoming + 2):
action = 'import'
reason = f'nsw: low soc and price under top up and within 2 cents of best upcoming {best_upcoming}'
else:
reason += f' not within 2 cents of best {best_upcoming}'
else:
reason += f' waiting to top up {buy_price} < {buy_top_up_price}'

if 4 < hour < 8 and interval_time < solar_production_time and battery_soc > 10 and sell_price > 15:
action = 'export'
reason = f'nsw: before solar production time use it or lose it {solar_production_time}'
reason += f'nsw: before solar production time use it or lose it {solar_production_time}'

if rrp > 800 and battery_soc > min_sell_soc:
action = 'export'
reason += f'take the money down to {min_sell_soc}%'
reason += f'take the money down to {min_sell_soc}%'
Loading