From e74776016a2275c31d5fe51ed3f2ab96b7c89dba Mon Sep 17 00:00:00 2001 From: Daithi Hearn Date: Sun, 26 Mar 2023 13:19:11 +0200 Subject: [PATCH] Adding Expensive price notifier --- ExpensivePriceNotifier.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 ExpensivePriceNotifier.py diff --git a/ExpensivePriceNotifier.py b/ExpensivePriceNotifier.py new file mode 100644 index 0000000..6b69365 --- /dev/null +++ b/ExpensivePriceNotifier.py @@ -0,0 +1,19 @@ + +from services.SmsService import send_sms +from services.PriceService import get_current_price, get_max_price, get_min_price + +curr_price = get_current_price() +min_price = get_min_price() +max_price = get_max_price() + +message = 'Turn everything off!! Now is the most expensive time. Min price: ' + \ + min_price.value_euro + '@' + min_price.hour + ', Max price: ' + max_price.value_euro + '@' + max_price.hour + \ + ', Current Price: ' + curr_price.value_euro + '@' + curr_price.hour + '.' + +print(message) + +if curr_price.value == max_price.value: + send_sms(message) +else: + print('No need to warn about the price. Min price is ' + + min_price.value_euro+', max price is' + max_price.value_euro+', current price is '+curr_price.value_euro+'.')