QAlphaCloud  0.0.1
Qt bindings for Alpha Cloud
Public Types | Public Slots | Signals | Public Member Functions | Properties | List of all members
QAlphaCloud::OneDayPowerModel Class Reference

Historic power data for a day. More...

#include <onedaypowermodel.h>

Inherits QAbstractListModel.

Public Types

enum class  Roles {
  PhotovoltaicEnergy = Qt::UserRole , CurrentLoad , GridFeed , GridCharge ,
  BatterySoc , UploadTime , RawJson
}
 The model roles. More...
 

Public Slots

bool reload ()
 (Re)load data More...
 
bool forceReload ()
 Force a reload. More...
 
void reset ()
 Reset object. More...
 

Signals

void countChanged ()
 

Public Member Functions

 OneDayPowerModel (QObject *parent=nullptr)
 Creates a OneDateEnergy instance. More...
 
 OneDayPowerModel (Connector *connector, const QString &serialNumber, const QDate &date, QObject *parent=nullptr)
 Creates a OneDateEnergy intsance. More...
 
Q_REQUIRED_RESULT Connectorconnector () const
 
void setConnector (Connector *connector)
 
Q_SIGNAL void connectorChanged (Connector *connector)
 
Q_REQUIRED_RESULT QString serialNumber () const
 
void setSerialNumber (const QString &serialNumber)
 
Q_SIGNAL void serialNumberChanged (const QString &serialNumber)
 
Q_REQUIRED_RESULT QDate date () const
 
void setDate (const QDate &date)
 
void resetDate ()
 
Q_SIGNAL void dateChanged (const QDate &date)
 
Q_REQUIRED_RESULT bool cached () const
 
void setCached (bool cached)
 
Q_SIGNAL void cachedChanged (bool cached)
 
Q_REQUIRED_RESULT QDateTime fromDateTime () const
 
Q_SIGNAL void fromDateTimeChanged (const QDateTime &fromDateTime)
 
Q_REQUIRED_RESULT QDateTime toDateTime () const
 
Q_SIGNAL void toDateTimeChanged (const QDateTime &toDateTime)
 
Q_REQUIRED_RESULT int peakPhotovoltaic () const
 
Q_SIGNAL void peakPhotovoltaicChanged (int peakPhotovoltaicChanged)
 
Q_REQUIRED_RESULT int peakLoad () const
 
Q_SIGNAL void peakLoadChanged (int peakLoad)
 
Q_REQUIRED_RESULT int peakGridFeed () const
 
Q_SIGNAL void peakGridFeedChanged (int peakGridFeed)
 
Q_REQUIRED_RESULT int peakGridCharge () const
 
Q_SIGNAL void peakGridChargeChanged (int peakGridCharge)
 
QAlphaCloud::RequestStatus status () const
 
Q_SIGNAL void statusChanged (QAlphaCloud::RequestStatus status)
 
QAlphaCloud::ErrorCode error () const
 
Q_SIGNAL void errorChanged (QAlphaCloud::ErrorCode error)
 
QString errorString () const
 
Q_SIGNAL void errorStringChanged (const QString &errorString)
 
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
 
QHash< int, QByteArray > roleNames () const override
 

Properties

QAlphaCloud::Connectorconnector
 The connector to use.
 
QString serialNumber
 The serial number. More...
 
QDate date
 The date. More...
 
bool cached
 Cache data. More...
 
QDateTime fromDateTime
 The earliest date in the model. More...
 
QDateTime toDateTime
 The latest date in the model. More...
 
int peakPhotovoltaic
 Peak photovoltaic production in W. More...
 
int peakLoad
 Peak load in W. More...
 
int peakGridFeed
 Peak grid feed in W. More...
 
int peakGridCharge
 Peak grid charge in W. More...
 
int count
 The number of items in the model.
 
QAlphaCloud::RequestStatus status
 The current request status.
 
QAlphaCloud::ErrorCode error
 The error, if any. More...
 
QString errorString
 The error string, if any. More...
 

Detailed Description

Historic power data for a day.

Provides historic power data for a given day.

Wraps the /getOneDayPower API endpoint.

Member Enumeration Documentation

◆ Roles

The model roles.

Enumerator
PhotovoltaicEnergy 

The photovoltaic production in W (int)

CurrentLoad 

The current load in W (int)

GridFeed 

The current grid feed in W (int)

GridCharge 

The current grid charge in W (int)

BatterySoc 

The battery state of charge in per-cent % (qreal)

UploadTime 

When this entry was recorded. (QDateTime)

RawJson 

Returns the raw JSON data for this system. Useful for extracting properties that aren't provided through the model (QJsonObject).

Constructor & Destructor Documentation

◆ OneDayPowerModel() [1/2]

QAlphaCloud::OneDayPowerModel::OneDayPowerModel ( QObject *  parent = nullptr)
explicit

Creates a OneDateEnergy instance.

Parameters
parentThe owner
Note
A connector, serialNumber, and a date must be set before requests can be made.

◆ OneDayPowerModel() [2/2]

QAlphaCloud::OneDayPowerModel::OneDayPowerModel ( Connector connector,
const QString &  serialNumber,
const QDate &  date,
QObject *  parent = nullptr 
)

Creates a OneDateEnergy intsance.

Parameters
connectorThe connector
serialNumberThe serial number of the storage system whose data should be queried
dateThe date for which to query the data
parentThe owner

Member Function Documentation

◆ forceReload

bool QAlphaCloud::OneDayPowerModel::forceReload ( )
slot

Force a reload.

Reloads the data, ignoring the cache.

Returns
Whether the request was sent.

◆ reload

bool QAlphaCloud::OneDayPowerModel::reload ( )
slot

(Re)load data

In QML, this is done automatically on component completion if the active property (not documented here) is true, which is the default.

Returns
Whether the request was sent.
Note
You must set a connector, a serialNumber, and a date before requests can be sent.
When the request fails, the current data is not cleared.

◆ reset

void QAlphaCloud::OneDayPowerModel::reset ( )
slot

Reset object.

This clears all data and resets the object back to its initial state.

Property Documentation

◆ cached

bool QAlphaCloud::OneDayPowerModel::cached
readwrite

Cache data.

Whether to cache the returned data, default is true.

This allows for quicker navigation between dates when they have been loaded once and reduces network traffic.

Data from the current day is never cached as data is collected throughout the day.

◆ date

QDate QAlphaCloud::OneDayPowerModel::date
readwrite

The date.

The date for which to query the data.

◆ error

QAlphaCloud::ErrorCode QAlphaCloud::OneDayPowerModel::error
read

The error, if any.

There can still be valid data in this object from a previous successful request.

◆ errorString

QString QAlphaCloud::OneDayPowerModel::errorString
read

The error string, if any.

Note
Not every error code has an errorString associated with it.

◆ fromDateTime

QDateTime QAlphaCloud::OneDayPowerModel::fromDateTime
read

The earliest date in the model.

Useful for determining the range of the X axis on a plot.

◆ peakGridCharge

int QAlphaCloud::OneDayPowerModel::peakGridCharge
read

Peak grid charge in W.

Useful for determining the range of the Y axis on a plot.

◆ peakGridFeed

int QAlphaCloud::OneDayPowerModel::peakGridFeed
read

Peak grid feed in W.

Useful for determining the range of the Y axis on a plot.

◆ peakLoad

int QAlphaCloud::OneDayPowerModel::peakLoad
read

Peak load in W.

Useful for determining the range of the Y axis on a plot.

◆ peakPhotovoltaic

int QAlphaCloud::OneDayPowerModel::peakPhotovoltaic
read

Peak photovoltaic production in W.

Useful for determining the range of the Y axis on a plot.

◆ serialNumber

QString QAlphaCloud::OneDayPowerModel::serialNumber
readwrite

The serial number.

The serial number of the storage system whose data should be queried.

◆ toDateTime

QDateTime QAlphaCloud::OneDayPowerModel::toDateTime
read

The latest date in the model.

Useful for determining the range of the X axis on a plot.


The documentation for this class was generated from the following files: