Example #1
0
def overview():
    cur_date = date.today()

    from_date = cur_date - timedelta(days=30)
    to_date = cur_date

    data = json_rpc(url, "getDayData", {
        "from": from_date.isoformat(),
        "to": to_date.isoformat()
    })
    inverters = json_rpc(url, "getInverters", {})
    return render_template("public/overview.html",
                           data=data,
                           inverters=inverters)
Example #2
0
def yearly(date_string=None):
    if (date_string != None):
        cur_date = datetime.strptime(date_string, '%Y').date()
    else:
        cur_date = date.today()

    year = cur_date.year

    data = json_rpc(url, "getMonthData", {"year": str(year)})
    inverters = json_rpc(url, "getInverters", {})

    return render_template("public/charts/yearly.html",
                           current=year,
                           before=year - 1,
                           after=year + 1,
                           data=data,
                           inverters=inverters)
Example #3
0
def daily(day_date=None):
    """Renders a chart with daily data"""

    if (day_date == None):
        day_date = date.today()

    yesterday = day_date - timedelta(days=1)
    tomorrow = day_date + timedelta(days=1)

    data = json_rpc(url, "getSpotData", {"date": day_date.isoformat()})
    inverters = json_rpc(url, "getInverters", {})

    return render_template("public/charts/daily.html",
                           current=day_date,
                           before=yesterday,
                           after=tomorrow,
                           data=data,
                           inverters=inverters)
Example #4
0
def monthly(date_string=None):
    if (date_string != None):
        cur_date = datetime.strptime(date_string, '%Y-%m').date()
    else:
        cur_date = date.today()

    fromDate = cur_date.replace(day=1)
    toDate = last_day_of_month(cur_date)

    before_date = fromDate - timedelta(days=1)
    after_date = toDate + timedelta(days=1)

    data = json_rpc(url, "getDayData", {
        "from": fromDate.isoformat(),
        "to": toDate.isoformat()
    })
    inverters = json_rpc(url, "getInverters", {})

    return render_template("public/charts/monthly.html",
                           current=cur_date.strftime("%Y-%m"),
                           before=before_date.strftime("%Y-%m"),
                           after=after_date.strftime("%Y-%m"),
                           data=data,
                           inverters=inverters)
Example #5
0
def datalogger_status():
    result = json_rpc(url, "getDataloggerStatus", {})
    return jsonify(result)
Example #6
0
def live_data():
    result = json_rpc(url, "getLiveSpotData", {})
    return jsonify(result)
Example #7
0
def statistics():
    result = json_rpc(url, "getStatistics", {})
    return render_template("public/statistics.html", data=result)
Example #8
0
def events():
    data = json_rpc(url, "getEvents", {})
    inverters = json_rpc(url, "getInverters", {})
    return render_template("public/events.html",
                           data=data,
                           inverters=inverters)
Example #9
0
def totaly(date_string=None):
    data = json_rpc(url, "getYearData", {})
    inverters = json_rpc(url, "getInverters", {})
    return render_template("public/charts/totaly.html",
                           data=data,
                           inverters=inverters)