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

Cumulative daily energy information. More...

#include <onedateenergy.h>

Inherits QObject.

Public Slots

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

Public Member Functions

 OneDateEnergy (QObject *parent=nullptr)
 Creates a OneDateEnergy instance. More...
 
 OneDateEnergy (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 int totalLoad () const
 
Q_SIGNAL void totalLoadChanged (int totalLoad)
 
Q_REQUIRED_RESULT int photovoltaic () const
 
Q_SIGNAL void photovoltaicChanged (int photovoltaic)
 
Q_REQUIRED_RESULT int input () const
 
Q_SIGNAL void inputChanged (int input)
 
Q_REQUIRED_RESULT int output () const
 
Q_SIGNAL void outputChanged (int output)
 
Q_REQUIRED_RESULT int charge () const
 
Q_SIGNAL void chargeChanged (int charge)
 
Q_REQUIRED_RESULT int discharge () const
 
Q_SIGNAL void dischargeChanged (int discharge)
 
Q_REQUIRED_RESULT int gridCharge () const
 
Q_SIGNAL void gridChargeChanged (int gridCharge)
 
Q_REQUIRED_RESULT QJsonObject rawJson () const
 
Q_SIGNAL void rawJsonChanged ()
 
Q_REQUIRED_RESULT bool valid () const
 
Q_SIGNAL void validChanged (bool valid)
 
Q_REQUIRED_RESULT 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)
 

Properties

QAlphaCloud::Connectorconnector
 The connector to use.
 
QString serialNumber
 The serial number. More...
 
QDate date
 The date. More...
 
bool cached
 Cache data. More...
 
int photovoltaic
 Photovoltaic production in Wh.
 
int totalLoad
 Total load in Wh.
 
int input
 Power input form grid in Wh.
 
int output
 Power output to the grid in Wh.
 
int charge
 Energy charged into the battery in Wh.
 
int discharge
 Energy discharged from the battery in Wh.
 
int gridCharge
 Battery charge from grid in Wh. More...
 
QJsonObject rawJson
 Raw JSON. More...
 
bool valid
 Whether this object contains data. More...
 
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

Cumulative daily energy information.

Provides cumulative information about a given date.

Wraps the /getOneDateEnergy API endpoint.

Constructor & Destructor Documentation

◆ OneDateEnergy() [1/2]

QAlphaCloud::OneDateEnergy::OneDateEnergy ( 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.

◆ OneDateEnergy() [2/2]

QAlphaCloud::OneDateEnergy::OneDateEnergy ( 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::OneDateEnergy::forceReload ( )
slot

Force a reload.

Reloads the data, ignoring the cache.

Returns
Whether the request was sent.

◆ reload

bool QAlphaCloud::OneDateEnergy::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::OneDateEnergy::reset ( )
slot

Reset object.

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

Property Documentation

◆ cached

bool QAlphaCloud::OneDateEnergy::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::OneDateEnergy::date
readwrite

The date.

The date for which to query the data.

◆ error

QAlphaCloud::ErrorCode QAlphaCloud::OneDateEnergy::error
read

The error, if any.

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

◆ errorString

QString QAlphaCloud::OneDateEnergy::errorString
read

The error string, if any.

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

◆ gridCharge

int QAlphaCloud::OneDateEnergy::gridCharge
read

Battery charge from grid in Wh.

How many Wh have been fed from the grid into the battery.

◆ rawJson

QJsonObject QAlphaCloud::OneDateEnergy::rawJson
read

Raw JSON.

The raw JSON returned by the API, useful for extracting data that isn't provided through the API yet.

◆ serialNumber

QString QAlphaCloud::OneDateEnergy::serialNumber
readwrite

The serial number.

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

◆ valid

bool QAlphaCloud::OneDateEnergy::valid
read

Whether this object contains data.

This is independent of the status. The status can be QAlphaCloud::Error when a subsequent request fails but any data isn't cleared unless new data is loaded successfully.


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