From 5e8cddea856f10a468240c27a0f5aec12d1cf276 Mon Sep 17 00:00:00 2001 From: Gabrie van Zanten Date: Sat, 22 Apr 2023 00:30:33 +0200 Subject: [PATCH] Basic House Usage toegevoegd --- README.md | 3 ++- example.env | 3 ++- main.py | 2 -- plotgraph.py | 6 ++++++ 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 356dede..d3cec66 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,7 @@ This project makes use of the following other projects: - [Forecast.Solar by Knut Kohl](https://forecast.solar/) Though the use of his API is for free, please reward the maker by signing up for the 'personal' plan or use the 'buy me a coffee' button on the website. -# Breaking changes +# Changes - March 22nd, 2023: Added TIMEZONE=Europe/Amsterdam to the .env, you should add this as well (with your timezone) to prevent the script from failing. - April 21st, 2023: Added TMPIMAGEPATH=/home/OptimalEnergyUser to the .env. This points to the temp directory for the image generated. If not specified it will use the directory of the script. +- April 21st, 2023: Show the BASICHOUSEUSAGEWATT (Basic House Usage in WATT) in the image as third graph \ No newline at end of file diff --git a/example.env b/example.env index e94623f..da0f169 100644 --- a/example.env +++ b/example.env @@ -7,4 +7,5 @@ DEC=25 AZI=40 KWP=4.4 TIMEZONE=Europe/Amsterdam -TMPIMAGEPATH=/home/OptimalEnergyUser \ No newline at end of file +TMPIMAGEPATH=/home/OptimalEnergyUser +BASICHOUSEUSAGEWATT=400 \ No newline at end of file diff --git a/main.py b/main.py index c935985..62c0d38 100644 --- a/main.py +++ b/main.py @@ -43,8 +43,6 @@ def main(): image_name = tmp_image_path + "{}{:-%Y%m%d%H%M%S}.jpeg".format( str(uuid.uuid4().hex), datetime.datetime.now() ) - print( tmp_image_path) - print( image_name ) plt.savefig(image_name, format="png", dpi=300) # Send to Telegram diff --git a/plotgraph.py b/plotgraph.py index a1ac6f6..143e5d8 100644 --- a/plotgraph.py +++ b/plotgraph.py @@ -11,6 +11,10 @@ def create_plot(combined_list): """Generate the data for the Graph""" forecast_kwp = float(os.getenv("KWP")) * 1000 + if float( os.getenv("BASICHOUSEUSAGEWATT")) > 0: + basic_house_usage = float(os.getenv("BASICHOUSEUSAGEWATT")) + else: + basic_house_usage = 0 rows = len(combined_list) prices = combined_list[0 : rows + 1, 1:2] @@ -38,6 +42,8 @@ def create_plot(combined_list): ax2.set_ylim(ymax=forecast_kwp, ymin=0) ax2.legend() + plt.axhline(basic_house_usage,xmin=0, xmax=forecast_kwp, color="orange" ) + ax2.plot(basic_house_usage, color="orange", label="Basic House Usage in Watt") plt.title("Forecast for " + forecastdate) plt.legend(loc="upper left")