From 7b646c95cff3ec4630e103c8abdbb3e9566be41b Mon Sep 17 00:00:00 2001 From: jbruce12000 Date: Sun, 11 Sep 2022 14:10:38 -0400 Subject: [PATCH] added cost to web interface --- config.py | 2 +- lib/oven.py | 1 + public/assets/js/picoreflow.js | 2 ++ public/index.html | 2 ++ 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/config.py b/config.py index 5f0537e..30ca0e5 100644 --- a/config.py +++ b/config.py @@ -24,7 +24,7 @@ listening_port = 8082 # elements that when my switches are set to high, consume 9460 watts. kwh_rate = 0.1319 # cost per kilowatt hour per currency_type to calculate cost to run job -kw_elements = 0.9460 # if the kiln elements are on, the wattage in kilowatts +kw_elements = 9.460 # if the kiln elements are on, the wattage in kilowatts currency_type = "$" # Currency Symbol to show when calculating cost to run job ######################################################################## diff --git a/lib/oven.py b/lib/oven.py index 4773570..7503fac 100644 --- a/lib/oven.py +++ b/lib/oven.py @@ -295,6 +295,7 @@ class Oven(threading.Thread): def reset_if_schedule_ended(self): if self.runtime > self.totaltime: log.info("schedule ended, shutting down") + log.info("total cost = %s%.2f" % (config.currency_type,self.cost)) self.abort_run() def update_cost(self): diff --git a/public/assets/js/picoreflow.js b/public/assets/js/picoreflow.js index 90e3ecd..95c6ede 100644 --- a/public/assets/js/picoreflow.js +++ b/public/assets/js/picoreflow.js @@ -548,6 +548,8 @@ $(document).ready(function() updateProgress(parseFloat(x.runtime)/parseFloat(x.totaltime)*100); $('#state').html('' + eta + ''); $('#target_temp').html(parseInt(x.target)); + $('#cost').html(x.currency_type + parseFloat(x.cost).toFixed(2)); + } diff --git a/public/index.html b/public/index.html index 08b2d69..b37b682 100644 --- a/public/index.html +++ b/public/index.html @@ -29,12 +29,14 @@
Sensor Temp
Target Temp
+
Cost
Status
25°C
---°C
+
0.00
\l[I