emoncms / app

Emoncms App module: application specific dashboards: includes myelectric, mysolarpv, myheatpump and solar + wind app.
GNU Affero General Public License v3.0
27 stars 71 forks source link

My Electric considers kWh to be cost of energy #174

Open cricalix opened 2 years ago

cricalix commented 2 years ago

The code block

    var daily = feed.getdata(use_kwh,start*1000,end*1000,"daily",0,1);

    var usetoday_kwh = null;
    if (daily.length>0) {
        usetoday_kwh = daily[daily.length-1][1];
    }

    if (usetoday_kwh!==null) {
        if (usetoday_kwh<100) {
            $("#usetoday").html((usetoday_kwh).toFixed(1));
        } else {
            $("#usetoday").html((usetoday_kwh).toFixed(0));
        }
    } else {
        $("#usetoday").html("---");
    }

in the My Electric app makes no distinction between the "energy" and "cost" modes, resulting in the cost today being the kWh used today. The logic applied elsewhere in the file for current usage -> current cost should be applied here too, branching on the energy vs cost operating mode.

image

image