added cost to web interface

pull/146/head
jbruce12000 2022-09-11 14:10:38 -04:00
rodzic e45709a5a4
commit 7b646c95cf
4 zmienionych plików z 6 dodań i 1 usunięć

Wyświetl plik

@ -24,7 +24,7 @@ listening_port = 8082
# elements that when my switches are set to high, consume 9460 watts. # 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 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 currency_type = "$" # Currency Symbol to show when calculating cost to run job
######################################################################## ########################################################################

Wyświetl plik

@ -295,6 +295,7 @@ class Oven(threading.Thread):
def reset_if_schedule_ended(self): def reset_if_schedule_ended(self):
if self.runtime > self.totaltime: if self.runtime > self.totaltime:
log.info("schedule ended, shutting down") log.info("schedule ended, shutting down")
log.info("total cost = %s%.2f" % (config.currency_type,self.cost))
self.abort_run() self.abort_run()
def update_cost(self): def update_cost(self):

Wyświetl plik

@ -548,6 +548,8 @@ $(document).ready(function()
updateProgress(parseFloat(x.runtime)/parseFloat(x.totaltime)*100); updateProgress(parseFloat(x.runtime)/parseFloat(x.totaltime)*100);
$('#state').html('<span class="glyphicon glyphicon-time" style="font-size: 22px; font-weight: normal"></span><span style="font-family: Digi; font-size: 40px;">' + eta + '</span>'); $('#state').html('<span class="glyphicon glyphicon-time" style="font-size: 22px; font-weight: normal"></span><span style="font-family: Digi; font-size: 40px;">' + eta + '</span>');
$('#target_temp').html(parseInt(x.target)); $('#target_temp').html(parseInt(x.target));
$('#cost').html(x.currency_type + parseFloat(x.cost).toFixed(2));
} }

Wyświetl plik

@ -29,12 +29,14 @@
<div class="ds-title-panel"> <div class="ds-title-panel">
<div class="ds-title">Sensor Temp</div> <div class="ds-title">Sensor Temp</div>
<div class="ds-title">Target Temp</div> <div class="ds-title">Target Temp</div>
<div class="ds-title">Cost</div>
<div class="ds-title ds-state pull-right" style="border-left: 1px solid #ccc;">Status</div> <div class="ds-title ds-state pull-right" style="border-left: 1px solid #ccc;">Status</div>
</div> </div>
<div class="clearfix"></div> <div class="clearfix"></div>
<div class="ds-panel"> <div class="ds-panel">
<div class="display ds-num"><span id="act_temp">25</span><span class="ds-unit" id="act_temp_scale" >&deg;C</span></div> <div class="display ds-num"><span id="act_temp">25</span><span class="ds-unit" id="act_temp_scale" >&deg;C</span></div>
<div class="display ds-num ds-target"><span id="target_temp">---</span><span class="ds-unit" id="target_temp_scale">&deg;C</span></div> <div class="display ds-num ds-target"><span id="target_temp">---</span><span class="ds-unit" id="target_temp_scale">&deg;C</span></div>
<div class="display ds-num ds-cost"><span id="cost">0.00</span><span class="ds-unit" id="cost"></span></div>
<div class="display ds-num ds-text" id="state"></div> <div class="display ds-num ds-text" id="state"></div>
<div class="display pull-right ds-state" style="padding-right:0"><span class="ds-led" id="heat">&#92;</span><span class="ds-led" id="cool">&#108;</span><span class="ds-led" id="air">&#91;</span><span class="ds-led" id="hazard">&#73;</span><span class="ds-led" id="door">&#9832;</span></div> <div class="display pull-right ds-state" style="padding-right:0"><span class="ds-led" id="heat">&#92;</span><span class="ds-led" id="cool">&#108;</span><span class="ds-led" id="air">&#91;</span><span class="ds-led" id="hazard">&#73;</span><span class="ds-led" id="door">&#9832;</span></div>
</div> </div>