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

Live Power Data. More...

#include <lastpowerdata.h>

Inherits QObject.

Public Slots

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

Public Member Functions

 LastPowerData (QObject *parent=nullptr)
 Creates a LastPowerData instance. More...
 
 LastPowerData (QAlphaCloud::Connector *connector, const QString &serialNumber, QObject *parent=nullptr)
 Creates a LastPowerData intsance. More...
 
Q_REQUIRED_RESULT QAlphaCloud::Connectorconnector () const
 
void setConnector (QAlphaCloud::Connector *connector)
 
Q_SIGNAL void connectorChanged (QAlphaCloud::Connector *connector)
 
Q_REQUIRED_RESULT QString serialNumber () const
 
void setSerialNumber (const QString &serialNumber)
 
Q_SIGNAL void serialNumberChanged (const QString &serialNumber)
 
Q_REQUIRED_RESULT int photovoltaicPower () const
 
Q_SIGNAL void photovoltaicPowerChanged (int photovoltaicPower)
 
Q_REQUIRED_RESULT int currentLoad () const
 
Q_SIGNAL void currentLoadChanged (int currentLoad)
 
Q_REQUIRED_RESULT int gridPower () const
 
Q_SIGNAL void gridPowerChanged (int gridPower)
 
Q_REQUIRED_RESULT int batteryPower () const
 
Q_SIGNAL void batteryPowerChanged (int batteryPower)
 
Q_REQUIRED_RESULT qreal batterySoc () const
 
Q_SIGNAL void batterySocChanged (qreal batterySoc)
 
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...
 
int photovoltaicPower
 Photovoltaic power in W.
 
int currentLoad
 Current load in W.
 
int gridPower
 Grid power in W. More...
 
int batteryPower
 Battery power in W.
 
qreal batterySoc
 Battery state of charge in %.
 
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

Live Power Data.

Provides live information.

Wraps the /getLastPowerData API endpoint.

Constructor & Destructor Documentation

◆ LastPowerData() [1/2]

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

Creates a LastPowerData instance.

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

◆ LastPowerData() [2/2]

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

Creates a LastPowerData intsance.

Parameters
connectorThe connector
serialNumberThe serial number of the storage system whose data should be queried
parentThe owner

Member Function Documentation

◆ reload

bool QAlphaCloud::LastPowerData::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 and serialNumber before requests can be sent.
When the request fails, the current data is not cleared.

◆ reset

void QAlphaCloud::LastPowerData::reset ( )
slot

Reset object.

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

Property Documentation

◆ error

QAlphaCloud::ErrorCode QAlphaCloud::LastPowerData::error
read

The error, if any.

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

◆ errorString

QString QAlphaCloud::LastPowerData::errorString
read

The error string, if any.

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

◆ gridPower

int QAlphaCloud::LastPowerData::gridPower
read

Grid power in W.

  • When this is negative, power is being fed into the grid.
  • When this is positive, power is drawn from the grid.

◆ rawJson

QJsonObject QAlphaCloud::LastPowerData::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::LastPowerData::serialNumber
readwrite

The serial number.

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

◆ valid

bool QAlphaCloud::LastPowerData::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: