Skip to content

Commit e2e99a4

Browse files
authored
Merge pull request #17 from iconnor/main
2 parents 948b8e9 + ae4eab9 commit e2e99a4

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

nsw_script.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
sell_price_threshold_1 = 20 # sell in morning
66
sell_price_threshold_2 = 1000 # Sell during peak
77
buy_price_morning = 5 # Morning buy price
8+
buy_top_up_price = 20
89
# This is when we expect the solar production to meet our house load
910
minutes_after_sunrise_solar_matches_load = 30
1011
solar_production_time = sunrise + timedelta(minutes=minutes_after_sunrise_solar_matches_load)
@@ -79,10 +80,21 @@
7980
action = 'export'
8081
reason = f'nsw: pre 5am use it or lose it down to {desired_soc}%'
8182

82-
if 4 < hour and interval_time < solar_production_time and battery_soc > 10 and sell_price > 15:
83+
if (hour > 21 or hour < 5) and (battery_soc < desired_soc):
84+
if (buy_price < buy_top_up_price):
85+
best_upcoming = min(buy_forecast)
86+
if buy_price < (best_upcoming + 2):
87+
action = 'import'
88+
reason = f'nsw: low soc and price under top up and within 2 cents of best upcoming {best_upcoming}'
89+
else:
90+
reason += f' not within 2 cents of best {best_upcoming}'
91+
else:
92+
reason += f' waiting to top up {buy_price} < {buy_top_up_price}'
93+
94+
if 4 < hour < 8 and interval_time < solar_production_time and battery_soc > 10 and sell_price > 15:
8395
action = 'export'
84-
reason = f'nsw: before solar production time use it or lose it {solar_production_time}'
96+
reason += f'nsw: before solar production time use it or lose it {solar_production_time}'
8597

8698
if rrp > 800 and battery_soc > min_sell_soc:
8799
action = 'export'
88-
reason += f'take the money down to {min_sell_soc}%'
100+
reason += f'take the money down to {min_sell_soc}%'

0 commit comments

Comments
 (0)