# Path: solarpi/extensions.py

# 
# Path: solarpi/pvdata/models.py
# class PVData(SurrogatePK, Model):
#     __tablename__ = "pvdata"
# 
#     id = Column(db.Integer(), nullable=False, primary_key=True)
#     created_at = Column(db.Text(), nullable=False, default=dt.datetime.utcnow)
#     dc_1_u = Column(db.Integer(), nullable=True)
#     dc_1_i = Column(db.Float(), nullable=True)
#     ac_1_u = Column(db.Integer(), nullable=True)
#     ac_1_p = Column(db.Integer(), nullable=True)
#     dc_2_u = Column(db.Integer(), nullable=True)
#     dc_2_i = Column(db.Float(), nullable=True)
#     ac_2_u = Column(db.Integer(), nullable=True)
#     ac_2_p = Column(db.Integer(), nullable=True)
#     dc_3_u = Column(db.Integer(), nullable=True)
#     dc_3_i = Column(db.Float(), nullable=True)
#     ac_3_u = Column(db.Integer(), nullable=True)
#     ac_3_p = Column(db.Integer(), nullable=True)
#     current_power = Column(db.Integer(), nullable=True)
#     daily_energy = Column(db.Float(), nullable=True)
#     total_energy = Column(db.Integer(), nullable=True)


import calendar
from datetime import datetime, timedelta
from sqlalchemy import func
from solarpi.extensions import db, cache
from solarpi.pvdata.models import PVData
# -*- coding: utf-8 -*-




@cache.cached(timeout=300, key_prefix="todays_max_power")
def get_todays_max_power():
    """
    :return: the maximum enegy yieled today
    """
    todays_max_power = (

# Path: solarpi/extensions.py

# 
# Path: solarpi/pvdata/models.py
# class PVData(SurrogatePK, Model):
#     __tablename__ = "pvdata"
# 
#     id = Column(db.Integer(), nullable=False, primary_key=True)
#     created_at = Column(db.Text(), nullable=False, default=dt.datetime.utcnow)
#     dc_1_u = Column(db.Integer(), nullable=True)
#     dc_1_i = Column(db.Float(), nullable=True)
#     ac_1_u = Column(db.Integer(), nullable=True)
#     ac_1_p = Column(db.Integer(), nullable=True)
#     dc_2_u = Column(db.Integer(), nullable=True)
#     dc_2_i = Column(db.Float(), nullable=True)
#     ac_2_u = Column(db.Integer(), nullable=True)
#     ac_2_p = Column(db.Integer(), nullable=True)
#     dc_3_u = Column(db.Integer(), nullable=True)
#     dc_3_i = Column(db.Float(), nullable=True)
#     ac_3_u = Column(db.Integer(), nullable=True)
#     ac_3_p = Column(db.Integer(), nullable=True)
#     current_power = Column(db.Integer(), nullable=True)
#     daily_energy = Column(db.Float(), nullable=True)
#     total_energy = Column(db.Integer(), nullable=True)


# Path: solarpi/pvdata/helper.py
import calendar
from datetime import datetime, timedelta
from sqlalchemy import func
from solarpi.extensions import db, cache
from solarpi.pvdata.models import PVData

# -*- coding: utf-8 -*-




@cache.cached(timeout=300, key_prefix="todays_max_power")
def get_todays_max_power():
    """
    :return: the maximum enegy yieled today
    """
    todays_max_power = (

        PVData.query.with_entities(func.max(PVData.current_power).label("todays_max_power"))