Possibility to show watt instead of kw

This commit is contained in:
Gunnar Skjold 2022-03-12 08:56:09 +01:00
parent 3706625760
commit b727f84c72

View File

@ -2,6 +2,7 @@ var nextVersion;
var im, em;
var ds = 0;
var currency = "";
var swatt = false;
// Price plot
var pp;
@ -268,6 +269,11 @@ $(function() {
});
$('#n').trigger('change');
$('.ipo,.epo').on('click', function() {
swatt = !swatt;
$('.ipo,.epo').html('wait');
});
// Navbar
switch(window.location.pathname) {
case '/temperature':
@ -647,7 +653,7 @@ var fetch = function() {
var v = parseInt(json.i);
var pct = (v*100)/parseInt(json.im);
var append = "W";
if(v > 1000) {
if(v > 1000 && !swatt) {
v = (v/1000).toFixed(1);
append = "kW";
}
@ -673,7 +679,7 @@ var fetch = function() {
var v = parseInt(json.e);
var pct = (v*100)/(om*1000);
var append = "W";
if(v > 1000) {
if(v > 1000 && !swatt) {
v = (v/1000).toFixed(1);
append = "kW";
}