Update alphainnotec plugin to libnyma-modbus
This commit is contained in:
parent
5224831da6
commit
06cde7a4ec
File diff suppressed because it is too large
Load Diff
@ -1,273 +0,0 @@
|
|||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
||||||
*
|
|
||||||
* Copyright 2013 - 2021, nymea GmbH
|
|
||||||
* Contact: contact@nymea.io
|
|
||||||
*
|
|
||||||
* This fileDescriptor is part of nymea.
|
|
||||||
* This project including source code and documentation is protected by
|
|
||||||
* copyright law, and remains the property of nymea GmbH. All rights, including
|
|
||||||
* reproduction, publication, editing and translation, are reserved. The use of
|
|
||||||
* this project is subject to the terms of a license agreement to be concluded
|
|
||||||
* with nymea GmbH in accordance with the terms of use of nymea GmbH, available
|
|
||||||
* under https://nymea.io/license
|
|
||||||
*
|
|
||||||
* GNU Lesser General Public License Usage
|
|
||||||
* Alternatively, this project may be redistributed and/or modified under the
|
|
||||||
* terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; version 3. This project is distributed in the hope that
|
|
||||||
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
|
|
||||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with this project. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* For any further details and any questions please contact us under
|
|
||||||
* contact@nymea.io or see our FAQ/Licensing Information on
|
|
||||||
* https://nymea.io/license/faq
|
|
||||||
*
|
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
||||||
|
|
||||||
#ifndef ALPHACONNECTMODBUSTCPCONNECTION_H
|
|
||||||
#define ALPHACONNECTMODBUSTCPCONNECTION_H
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
|
|
||||||
#include "../modbus/modbusdatautils.h"
|
|
||||||
#include "../modbus/modbustcpmaster.h"
|
|
||||||
|
|
||||||
class AlphaConnectModbusTcpConnection : public ModbusTCPMaster
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
enum SystemStatus {
|
|
||||||
SystemStatusHeatingMode = 0,
|
|
||||||
SystemStatusDomesticHotWater = 1,
|
|
||||||
SystemStatusSwimmingPool = 2,
|
|
||||||
SystemStatusEVUOff = 3,
|
|
||||||
SystemStatusDefrost = 4,
|
|
||||||
SystemStatusOff = 5,
|
|
||||||
SystemStatusExternalEnergySource = 6,
|
|
||||||
SystemStatusCoolingMode = 7
|
|
||||||
};
|
|
||||||
Q_ENUM(SystemStatus)
|
|
||||||
|
|
||||||
enum SmartGridState {
|
|
||||||
SmartGridStateOff = 0,
|
|
||||||
SmartGridStateLow = 1,
|
|
||||||
SmartGridStateStandard = 2,
|
|
||||||
SmartGridStateHigh = 3
|
|
||||||
};
|
|
||||||
Q_ENUM(SmartGridState)
|
|
||||||
|
|
||||||
explicit AlphaConnectModbusTcpConnection(const QHostAddress &hostAddress, uint port, quint16 slaveId, QObject *parent = nullptr);
|
|
||||||
~AlphaConnectModbusTcpConnection() = default;
|
|
||||||
|
|
||||||
/* Flow [°C] - Address: 1, Size: 1 */
|
|
||||||
float flowTemperature() const;
|
|
||||||
|
|
||||||
/* Return [°C] - Address: 2, Size: 1 */
|
|
||||||
float returnTemperature() const;
|
|
||||||
|
|
||||||
/* External return [°C] - Address: 3, Size: 1 */
|
|
||||||
float externalReturnTemperature() const;
|
|
||||||
|
|
||||||
/* Hot water temperature [°C] - Address: 4, Size: 1 */
|
|
||||||
float hotWaterTemperature() const;
|
|
||||||
|
|
||||||
/* Hot gas temperature [°C] - Address: 8, Size: 1 */
|
|
||||||
float hotGasTemperature() const;
|
|
||||||
|
|
||||||
/* Heat source inlet temperature [°C] - Address: 9, Size: 1 */
|
|
||||||
float heatSourceInletTemperature() const;
|
|
||||||
|
|
||||||
/* Heat source outlet temperature [°C] - Address: 10, Size: 1 */
|
|
||||||
float heatSourceOutletTemperature() const;
|
|
||||||
|
|
||||||
/* Room remote adjuster 1 temperature [°C] - Address: 11, Size: 1 */
|
|
||||||
float roomTemperature1() const;
|
|
||||||
|
|
||||||
/* Room remote adjuster 2 temperature [°C] - Address: 12, Size: 1 */
|
|
||||||
float roomTemperature2() const;
|
|
||||||
|
|
||||||
/* Room remote adjuster 3 temperature [°C] - Address: 13, Size: 1 */
|
|
||||||
float roomTemperature3() const;
|
|
||||||
|
|
||||||
/* Solar collector temperature [°C] - Address: 14, Size: 1 */
|
|
||||||
float solarCollectorTemperature() const;
|
|
||||||
|
|
||||||
/* Solar storage tank temperature [°C] - Address: 15, Size: 1 */
|
|
||||||
float solarStorageTankTemperature() const;
|
|
||||||
|
|
||||||
/* External energy source temperature [°C] - Address: 16, Size: 1 */
|
|
||||||
float externalEnergySourceTemperature() const;
|
|
||||||
|
|
||||||
/* Supply air temperature [°C] - Address: 17, Size: 1 */
|
|
||||||
float supplyAirTemperature() const;
|
|
||||||
|
|
||||||
/* External air temperature [°C] - Address: 18, Size: 1 */
|
|
||||||
float externalAirTemperature() const;
|
|
||||||
|
|
||||||
/* RBE actual room temperature [°C] - Address: 24, Size: 1 */
|
|
||||||
float rbeRoomActualTemperature() const;
|
|
||||||
|
|
||||||
/* RBE room temperature setpoint [°C] - Address: 24, Size: 1 */
|
|
||||||
float rbeRoomSetpointTemperature() const;
|
|
||||||
|
|
||||||
/* Heating pump operating hours [h] - Address: 33, Size: 1 */
|
|
||||||
quint16 heatingPumpOperatingHours() const;
|
|
||||||
|
|
||||||
/* System status - Address: 37, Size: 1 */
|
|
||||||
SystemStatus systemStatus() const;
|
|
||||||
|
|
||||||
/* Heating energy [kWh] - Address: 38, Size: 2 */
|
|
||||||
float heatingEnergy() const;
|
|
||||||
|
|
||||||
/* Water heat energy [kWh] - Address: 40, Size: 2 */
|
|
||||||
float waterHeatEnergy() const;
|
|
||||||
|
|
||||||
/* Total energy [kWh] - Address: 44, Size: 2 */
|
|
||||||
float totalHeatEnergy() const;
|
|
||||||
|
|
||||||
/* Outdoor temperature [°C] - Address: 0, Size: 1 */
|
|
||||||
float outdoorTemperature() const;
|
|
||||||
QModbusReply *setOutdoorTemperature(float outdoorTemperature);
|
|
||||||
|
|
||||||
/* Return setpoint temperature [°C] - Address: 1, Size: 1 */
|
|
||||||
float returnSetpointTemperature() const;
|
|
||||||
QModbusReply *setReturnSetpointTemperature(float returnSetpointTemperature);
|
|
||||||
|
|
||||||
/* Hot water setpoint temperature [°C] - Address: 5, Size: 1 */
|
|
||||||
float hotWaterSetpointTemperature() const;
|
|
||||||
QModbusReply *setHotWaterSetpointTemperature(float hotWaterSetpointTemperature);
|
|
||||||
|
|
||||||
/* Smart grid control - Address: 14, Size: 1 */
|
|
||||||
SmartGridState smartGrid() const;
|
|
||||||
QModbusReply *setSmartGrid(SmartGridState smartGrid);
|
|
||||||
|
|
||||||
virtual void initialize();
|
|
||||||
virtual void update();
|
|
||||||
|
|
||||||
void updateFlowTemperature();
|
|
||||||
void updateReturnTemperature();
|
|
||||||
void updateExternalReturnTemperature();
|
|
||||||
void updateHotWaterTemperature();
|
|
||||||
void updateHotGasTemperature();
|
|
||||||
void updateHeatSourceInletTemperature();
|
|
||||||
void updateHeatSourceOutletTemperature();
|
|
||||||
void updateRoomTemperature1();
|
|
||||||
void updateRoomTemperature2();
|
|
||||||
void updateRoomTemperature3();
|
|
||||||
void updateSolarCollectorTemperature();
|
|
||||||
void updateSolarStorageTankTemperature();
|
|
||||||
void updateExternalEnergySourceTemperature();
|
|
||||||
void updateSupplyAirTemperature();
|
|
||||||
void updateExternalAirTemperature();
|
|
||||||
void updateRbeRoomActualTemperature();
|
|
||||||
void updateRbeRoomSetpointTemperature();
|
|
||||||
void updateHeatingPumpOperatingHours();
|
|
||||||
void updateSystemStatus();
|
|
||||||
void updateHeatingEnergy();
|
|
||||||
void updateWaterHeatEnergy();
|
|
||||||
void updateTotalHeatEnergy();
|
|
||||||
void updateOutdoorTemperature();
|
|
||||||
void updateReturnSetpointTemperature();
|
|
||||||
void updateHotWaterSetpointTemperature();
|
|
||||||
void updateSmartGrid();
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void initializationFinished();
|
|
||||||
|
|
||||||
void flowTemperatureChanged(float flowTemperature);
|
|
||||||
void returnTemperatureChanged(float returnTemperature);
|
|
||||||
void externalReturnTemperatureChanged(float externalReturnTemperature);
|
|
||||||
void hotWaterTemperatureChanged(float hotWaterTemperature);
|
|
||||||
void hotGasTemperatureChanged(float hotGasTemperature);
|
|
||||||
void heatSourceInletTemperatureChanged(float heatSourceInletTemperature);
|
|
||||||
void heatSourceOutletTemperatureChanged(float heatSourceOutletTemperature);
|
|
||||||
void roomTemperature1Changed(float roomTemperature1);
|
|
||||||
void roomTemperature2Changed(float roomTemperature2);
|
|
||||||
void roomTemperature3Changed(float roomTemperature3);
|
|
||||||
void solarCollectorTemperatureChanged(float solarCollectorTemperature);
|
|
||||||
void solarStorageTankTemperatureChanged(float solarStorageTankTemperature);
|
|
||||||
void externalEnergySourceTemperatureChanged(float externalEnergySourceTemperature);
|
|
||||||
void supplyAirTemperatureChanged(float supplyAirTemperature);
|
|
||||||
void externalAirTemperatureChanged(float externalAirTemperature);
|
|
||||||
void rbeRoomActualTemperatureChanged(float rbeRoomActualTemperature);
|
|
||||||
void rbeRoomSetpointTemperatureChanged(float rbeRoomSetpointTemperature);
|
|
||||||
void heatingPumpOperatingHoursChanged(quint16 heatingPumpOperatingHours);
|
|
||||||
void systemStatusChanged(SystemStatus systemStatus);
|
|
||||||
void heatingEnergyChanged(float heatingEnergy);
|
|
||||||
void waterHeatEnergyChanged(float waterHeatEnergy);
|
|
||||||
void totalHeatEnergyChanged(float totalHeatEnergy);
|
|
||||||
void outdoorTemperatureChanged(float outdoorTemperature);
|
|
||||||
void returnSetpointTemperatureChanged(float returnSetpointTemperature);
|
|
||||||
void hotWaterSetpointTemperatureChanged(float hotWaterSetpointTemperature);
|
|
||||||
void smartGridChanged(SmartGridState smartGrid);
|
|
||||||
|
|
||||||
private:
|
|
||||||
quint16 m_slaveId = 1;
|
|
||||||
QVector<QModbusReply *> m_pendingInitReplies;
|
|
||||||
|
|
||||||
float m_flowTemperature = 0;
|
|
||||||
float m_returnTemperature = 0;
|
|
||||||
float m_externalReturnTemperature = 0;
|
|
||||||
float m_hotWaterTemperature = 0;
|
|
||||||
float m_hotGasTemperature = 0;
|
|
||||||
float m_heatSourceInletTemperature = 0;
|
|
||||||
float m_heatSourceOutletTemperature = 0;
|
|
||||||
float m_roomTemperature1 = 0;
|
|
||||||
float m_roomTemperature2 = 0;
|
|
||||||
float m_roomTemperature3 = 0;
|
|
||||||
float m_solarCollectorTemperature = 0;
|
|
||||||
float m_solarStorageTankTemperature = 0;
|
|
||||||
float m_externalEnergySourceTemperature = 0;
|
|
||||||
float m_supplyAirTemperature = 0;
|
|
||||||
float m_externalAirTemperature = 0;
|
|
||||||
float m_rbeRoomActualTemperature = 0;
|
|
||||||
float m_rbeRoomSetpointTemperature = 0;
|
|
||||||
quint16 m_heatingPumpOperatingHours = 0;
|
|
||||||
SystemStatus m_systemStatus = SystemStatusHeatingMode;
|
|
||||||
float m_heatingEnergy = 0;
|
|
||||||
float m_waterHeatEnergy = 0;
|
|
||||||
float m_totalHeatEnergy = 0;
|
|
||||||
float m_outdoorTemperature = 0;
|
|
||||||
float m_returnSetpointTemperature = 0;
|
|
||||||
float m_hotWaterSetpointTemperature = 0;
|
|
||||||
SmartGridState m_smartGrid = SmartGridStateStandard;
|
|
||||||
|
|
||||||
void verifyInitFinished();
|
|
||||||
|
|
||||||
QModbusReply *readFlowTemperature();
|
|
||||||
QModbusReply *readReturnTemperature();
|
|
||||||
QModbusReply *readExternalReturnTemperature();
|
|
||||||
QModbusReply *readHotWaterTemperature();
|
|
||||||
QModbusReply *readHotGasTemperature();
|
|
||||||
QModbusReply *readHeatSourceInletTemperature();
|
|
||||||
QModbusReply *readHeatSourceOutletTemperature();
|
|
||||||
QModbusReply *readRoomTemperature1();
|
|
||||||
QModbusReply *readRoomTemperature2();
|
|
||||||
QModbusReply *readRoomTemperature3();
|
|
||||||
QModbusReply *readSolarCollectorTemperature();
|
|
||||||
QModbusReply *readSolarStorageTankTemperature();
|
|
||||||
QModbusReply *readExternalEnergySourceTemperature();
|
|
||||||
QModbusReply *readSupplyAirTemperature();
|
|
||||||
QModbusReply *readExternalAirTemperature();
|
|
||||||
QModbusReply *readRbeRoomActualTemperature();
|
|
||||||
QModbusReply *readRbeRoomSetpointTemperature();
|
|
||||||
QModbusReply *readHeatingPumpOperatingHours();
|
|
||||||
QModbusReply *readSystemStatus();
|
|
||||||
QModbusReply *readHeatingEnergy();
|
|
||||||
QModbusReply *readWaterHeatEnergy();
|
|
||||||
QModbusReply *readTotalHeatEnergy();
|
|
||||||
QModbusReply *readOutdoorTemperature();
|
|
||||||
QModbusReply *readReturnSetpointTemperature();
|
|
||||||
QModbusReply *readHotWaterSetpointTemperature();
|
|
||||||
QModbusReply *readSmartGrid();
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, AlphaConnectModbusTcpConnection *alphaConnectModbusTcpConnection);
|
|
||||||
|
|
||||||
#endif // ALPHACONNECTMODBUSTCPCONNECTION_H
|
|
||||||
@ -1,4 +1,6 @@
|
|||||||
{
|
{
|
||||||
|
"className": "AlphaInnotec",
|
||||||
|
"protocol": "TCP",
|
||||||
"endianness": "BigEndian",
|
"endianness": "BigEndian",
|
||||||
"enums": [
|
"enums": [
|
||||||
{
|
{
|
||||||
@ -397,5 +399,6 @@
|
|||||||
"defaultValue": "SmartGridStateStandard",
|
"defaultValue": "SmartGridStateStandard",
|
||||||
"access": "RW"
|
"access": "RW"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"blocks": [ ]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,15 +1,12 @@
|
|||||||
include(../plugins.pri)
|
include(../plugins.pri)
|
||||||
|
|
||||||
QT += network serialbus
|
# Generate modbus connection
|
||||||
|
MODBUS_CONNECTIONS += alphainnotec-registers.json
|
||||||
|
MODBUS_TOOLS_CONFIG += VERBOSE
|
||||||
|
include(../modbus.pri)
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
integrationpluginalphainnotec.cpp \
|
integrationpluginalphainnotec.cpp
|
||||||
alphaconnectmodbustcpconnection.cpp \
|
|
||||||
../modbus/modbustcpmaster.cpp \
|
|
||||||
../modbus/modbusdatautils.cpp
|
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
integrationpluginalphainnotec.h \
|
integrationpluginalphainnotec.h
|
||||||
alphaconnectmodbustcpconnection.h \
|
|
||||||
../modbus/modbustcpmaster.h \
|
|
||||||
../modbus/modbusdatautils.h
|
|
||||||
|
|||||||
@ -107,8 +107,8 @@ void IntegrationPluginAlphaInnotec::setupThing(ThingSetupInfo *info)
|
|||||||
uint port = thing->paramValue(alphaConnectThingPortParamTypeId).toUInt();
|
uint port = thing->paramValue(alphaConnectThingPortParamTypeId).toUInt();
|
||||||
quint16 slaveId = thing->paramValue(alphaConnectThingSlaveIdParamTypeId).toUInt();
|
quint16 slaveId = thing->paramValue(alphaConnectThingSlaveIdParamTypeId).toUInt();
|
||||||
|
|
||||||
AlphaConnectModbusTcpConnection *alphaConnectTcpConnection = new AlphaConnectModbusTcpConnection(hostAddress, port, slaveId, this);
|
AlphaInnotecModbusTcpConnection *alphaConnectTcpConnection = new AlphaInnotecModbusTcpConnection(hostAddress, port, slaveId, this);
|
||||||
connect(alphaConnectTcpConnection, &AlphaConnectModbusTcpConnection::connectionStateChanged, this, [thing, alphaConnectTcpConnection](bool status){
|
connect(alphaConnectTcpConnection, &AlphaInnotecModbusTcpConnection::connectionStateChanged, this, [thing, alphaConnectTcpConnection](bool status){
|
||||||
qCDebug(dcAlphaInnotec()) << "Connected changed to" << status << "for" << thing;
|
qCDebug(dcAlphaInnotec()) << "Connected changed to" << status << "for" << thing;
|
||||||
if (status) {
|
if (status) {
|
||||||
alphaConnectTcpConnection->update();
|
alphaConnectTcpConnection->update();
|
||||||
@ -119,181 +119,181 @@ void IntegrationPluginAlphaInnotec::setupThing(ThingSetupInfo *info)
|
|||||||
|
|
||||||
|
|
||||||
// Input registers
|
// Input registers
|
||||||
// connect(alphaConnectTcpConnection, &AlphaConnectModbusTcpConnection::meanTemperatureChanged, this, [thing](float meanTemperature){
|
// connect(alphaConnectTcpConnection, &AlphaInnotecModbusTcpConnection::meanTemperatureChanged, this, [thing](float meanTemperature){
|
||||||
// qCDebug(dcAlphaInnotec()) << thing << "mean temperature changed" << meanTemperature << "°C";
|
// qCDebug(dcAlphaInnotec()) << thing << "mean temperature changed" << meanTemperature << "°C";
|
||||||
// thing->setStateValue(alphaConnectMeanTemperatureStateTypeId, meanTemperature);
|
// thing->setStateValue(alphaConnectMeanTemperatureStateTypeId, meanTemperature);
|
||||||
// });
|
// });
|
||||||
|
|
||||||
connect(alphaConnectTcpConnection, &AlphaConnectModbusTcpConnection::flowTemperatureChanged, this, [thing](float flowTemperature){
|
connect(alphaConnectTcpConnection, &AlphaInnotecModbusTcpConnection::flowTemperatureChanged, this, [thing](float flowTemperature){
|
||||||
qCDebug(dcAlphaInnotec()) << thing << "flow temperature changed" << flowTemperature << "°C";
|
qCDebug(dcAlphaInnotec()) << thing << "flow temperature changed" << flowTemperature << "°C";
|
||||||
thing->setStateValue(alphaConnectFlowTemperatureStateTypeId, flowTemperature);
|
thing->setStateValue(alphaConnectFlowTemperatureStateTypeId, flowTemperature);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(alphaConnectTcpConnection, &AlphaConnectModbusTcpConnection::returnTemperatureChanged, this, [thing](float returnTemperature){
|
connect(alphaConnectTcpConnection, &AlphaInnotecModbusTcpConnection::returnTemperatureChanged, this, [thing](float returnTemperature){
|
||||||
qCDebug(dcAlphaInnotec()) << thing << "return temperature changed" << returnTemperature << "°C";
|
qCDebug(dcAlphaInnotec()) << thing << "return temperature changed" << returnTemperature << "°C";
|
||||||
thing->setStateValue(alphaConnectReturnTemperatureStateTypeId, returnTemperature);
|
thing->setStateValue(alphaConnectReturnTemperatureStateTypeId, returnTemperature);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(alphaConnectTcpConnection, &AlphaConnectModbusTcpConnection::externalReturnTemperatureChanged, this, [thing](float externalReturnTemperature){
|
connect(alphaConnectTcpConnection, &AlphaInnotecModbusTcpConnection::externalReturnTemperatureChanged, this, [thing](float externalReturnTemperature){
|
||||||
qCDebug(dcAlphaInnotec()) << thing << "external return temperature changed" << externalReturnTemperature << "°C";
|
qCDebug(dcAlphaInnotec()) << thing << "external return temperature changed" << externalReturnTemperature << "°C";
|
||||||
thing->setStateValue(alphaConnectExternalReturnTemperatureStateTypeId, externalReturnTemperature);
|
thing->setStateValue(alphaConnectExternalReturnTemperatureStateTypeId, externalReturnTemperature);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(alphaConnectTcpConnection, &AlphaConnectModbusTcpConnection::hotWaterTemperatureChanged, this, [thing](float hotWaterTemperature){
|
connect(alphaConnectTcpConnection, &AlphaInnotecModbusTcpConnection::hotWaterTemperatureChanged, this, [thing](float hotWaterTemperature){
|
||||||
qCDebug(dcAlphaInnotec()) << thing << "hot water temperature changed" << hotWaterTemperature << "°C";
|
qCDebug(dcAlphaInnotec()) << thing << "hot water temperature changed" << hotWaterTemperature << "°C";
|
||||||
thing->setStateValue(alphaConnectHotWaterTemperatureStateTypeId, hotWaterTemperature);
|
thing->setStateValue(alphaConnectHotWaterTemperatureStateTypeId, hotWaterTemperature);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(alphaConnectTcpConnection, &AlphaConnectModbusTcpConnection::hotGasTemperatureChanged, this, [thing](float hotGasTemperature){
|
connect(alphaConnectTcpConnection, &AlphaInnotecModbusTcpConnection::hotGasTemperatureChanged, this, [thing](float hotGasTemperature){
|
||||||
qCDebug(dcAlphaInnotec()) << thing << "hot gas temperature changed" << hotGasTemperature << "°C";
|
qCDebug(dcAlphaInnotec()) << thing << "hot gas temperature changed" << hotGasTemperature << "°C";
|
||||||
thing->setStateValue(alphaConnectHotGasTemperatureStateTypeId, hotGasTemperature);
|
thing->setStateValue(alphaConnectHotGasTemperatureStateTypeId, hotGasTemperature);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(alphaConnectTcpConnection, &AlphaConnectModbusTcpConnection::heatSourceInletTemperatureChanged, this, [thing](float heatSourceInletTemperature){
|
connect(alphaConnectTcpConnection, &AlphaInnotecModbusTcpConnection::heatSourceInletTemperatureChanged, this, [thing](float heatSourceInletTemperature){
|
||||||
qCDebug(dcAlphaInnotec()) << thing << "heat source inlet temperature changed" << heatSourceInletTemperature << "°C";
|
qCDebug(dcAlphaInnotec()) << thing << "heat source inlet temperature changed" << heatSourceInletTemperature << "°C";
|
||||||
thing->setStateValue(alphaConnectHeatSourceInletTemperatureStateTypeId, heatSourceInletTemperature);
|
thing->setStateValue(alphaConnectHeatSourceInletTemperatureStateTypeId, heatSourceInletTemperature);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(alphaConnectTcpConnection, &AlphaConnectModbusTcpConnection::heatSourceOutletTemperatureChanged, this, [thing](float heatSourceOutletTemperature){
|
connect(alphaConnectTcpConnection, &AlphaInnotecModbusTcpConnection::heatSourceOutletTemperatureChanged, this, [thing](float heatSourceOutletTemperature){
|
||||||
qCDebug(dcAlphaInnotec()) << thing << "heat source outlet temperature changed" << heatSourceOutletTemperature << "°C";
|
qCDebug(dcAlphaInnotec()) << thing << "heat source outlet temperature changed" << heatSourceOutletTemperature << "°C";
|
||||||
thing->setStateValue(alphaConnectHeatSourceOutletTemperatureStateTypeId, heatSourceOutletTemperature);
|
thing->setStateValue(alphaConnectHeatSourceOutletTemperatureStateTypeId, heatSourceOutletTemperature);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(alphaConnectTcpConnection, &AlphaConnectModbusTcpConnection::roomTemperature1Changed, this, [thing](float roomTemperature1){
|
connect(alphaConnectTcpConnection, &AlphaInnotecModbusTcpConnection::roomTemperature1Changed, this, [thing](float roomTemperature1){
|
||||||
qCDebug(dcAlphaInnotec()) << thing << "room remote adjuster 1 temperature changed" << roomTemperature1 << "°C";
|
qCDebug(dcAlphaInnotec()) << thing << "room remote adjuster 1 temperature changed" << roomTemperature1 << "°C";
|
||||||
thing->setStateValue(alphaConnectRoomTemperature1StateTypeId, roomTemperature1);
|
thing->setStateValue(alphaConnectRoomTemperature1StateTypeId, roomTemperature1);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(alphaConnectTcpConnection, &AlphaConnectModbusTcpConnection::roomTemperature2Changed, this, [thing](float roomTemperature2){
|
connect(alphaConnectTcpConnection, &AlphaInnotecModbusTcpConnection::roomTemperature2Changed, this, [thing](float roomTemperature2){
|
||||||
qCDebug(dcAlphaInnotec()) << thing << "room remote adjuster 2 temperature changed" << roomTemperature2 << "°C";
|
qCDebug(dcAlphaInnotec()) << thing << "room remote adjuster 2 temperature changed" << roomTemperature2 << "°C";
|
||||||
thing->setStateValue(alphaConnectRoomTemperature2StateTypeId, roomTemperature2);
|
thing->setStateValue(alphaConnectRoomTemperature2StateTypeId, roomTemperature2);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(alphaConnectTcpConnection, &AlphaConnectModbusTcpConnection::roomTemperature3Changed, this, [thing](float roomTemperature3){
|
connect(alphaConnectTcpConnection, &AlphaInnotecModbusTcpConnection::roomTemperature3Changed, this, [thing](float roomTemperature3){
|
||||||
qCDebug(dcAlphaInnotec()) << thing << "room remote adjuster 3 temperature changed" << roomTemperature3 << "°C";
|
qCDebug(dcAlphaInnotec()) << thing << "room remote adjuster 3 temperature changed" << roomTemperature3 << "°C";
|
||||||
thing->setStateValue(alphaConnectRoomTemperature2StateTypeId, roomTemperature3);
|
thing->setStateValue(alphaConnectRoomTemperature2StateTypeId, roomTemperature3);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(alphaConnectTcpConnection, &AlphaConnectModbusTcpConnection::solarCollectorTemperatureChanged, this, [thing](float solarCollectorTemperature){
|
connect(alphaConnectTcpConnection, &AlphaInnotecModbusTcpConnection::solarCollectorTemperatureChanged, this, [thing](float solarCollectorTemperature){
|
||||||
qCDebug(dcAlphaInnotec()) << thing << "solar collector temperature changed" << solarCollectorTemperature << "°C";
|
qCDebug(dcAlphaInnotec()) << thing << "solar collector temperature changed" << solarCollectorTemperature << "°C";
|
||||||
thing->setStateValue(alphaConnectSolarCollectorTemperatureStateTypeId, solarCollectorTemperature);
|
thing->setStateValue(alphaConnectSolarCollectorTemperatureStateTypeId, solarCollectorTemperature);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(alphaConnectTcpConnection, &AlphaConnectModbusTcpConnection::solarStorageTankTemperatureChanged, this, [thing](float solarStorageTankTemperature){
|
connect(alphaConnectTcpConnection, &AlphaInnotecModbusTcpConnection::solarStorageTankTemperatureChanged, this, [thing](float solarStorageTankTemperature){
|
||||||
qCDebug(dcAlphaInnotec()) << thing << "solar storage tank temperature changed" << solarStorageTankTemperature << "°C";
|
qCDebug(dcAlphaInnotec()) << thing << "solar storage tank temperature changed" << solarStorageTankTemperature << "°C";
|
||||||
thing->setStateValue(alphaConnectSolarCollectorTemperatureStateTypeId, solarStorageTankTemperature);
|
thing->setStateValue(alphaConnectSolarCollectorTemperatureStateTypeId, solarStorageTankTemperature);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(alphaConnectTcpConnection, &AlphaConnectModbusTcpConnection::externalEnergySourceTemperatureChanged, this, [thing](float externalEnergySourceTemperature){
|
connect(alphaConnectTcpConnection, &AlphaInnotecModbusTcpConnection::externalEnergySourceTemperatureChanged, this, [thing](float externalEnergySourceTemperature){
|
||||||
qCDebug(dcAlphaInnotec()) << thing << "external energy source temperature changed" << externalEnergySourceTemperature << "°C";
|
qCDebug(dcAlphaInnotec()) << thing << "external energy source temperature changed" << externalEnergySourceTemperature << "°C";
|
||||||
thing->setStateValue(alphaConnectExternalEnergySourceTemperatureStateTypeId, externalEnergySourceTemperature);
|
thing->setStateValue(alphaConnectExternalEnergySourceTemperatureStateTypeId, externalEnergySourceTemperature);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(alphaConnectTcpConnection, &AlphaConnectModbusTcpConnection::supplyAirTemperatureChanged, this, [thing](float supplyAirTemperature){
|
connect(alphaConnectTcpConnection, &AlphaInnotecModbusTcpConnection::supplyAirTemperatureChanged, this, [thing](float supplyAirTemperature){
|
||||||
qCDebug(dcAlphaInnotec()) << thing << "supply air temperature changed" << supplyAirTemperature << "°C";
|
qCDebug(dcAlphaInnotec()) << thing << "supply air temperature changed" << supplyAirTemperature << "°C";
|
||||||
thing->setStateValue(alphaConnectSupplyAirTemperatureStateTypeId, supplyAirTemperature);
|
thing->setStateValue(alphaConnectSupplyAirTemperatureStateTypeId, supplyAirTemperature);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(alphaConnectTcpConnection, &AlphaConnectModbusTcpConnection::externalAirTemperatureChanged, this, [thing](float externalAirTemperature){
|
connect(alphaConnectTcpConnection, &AlphaInnotecModbusTcpConnection::externalAirTemperatureChanged, this, [thing](float externalAirTemperature){
|
||||||
qCDebug(dcAlphaInnotec()) << thing << "external air temperature changed" << externalAirTemperature << "°C";
|
qCDebug(dcAlphaInnotec()) << thing << "external air temperature changed" << externalAirTemperature << "°C";
|
||||||
thing->setStateValue(alphaConnectExternalAirTemperatureStateTypeId, externalAirTemperature);
|
thing->setStateValue(alphaConnectExternalAirTemperatureStateTypeId, externalAirTemperature);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(alphaConnectTcpConnection, &AlphaConnectModbusTcpConnection::heatingPumpOperatingHoursChanged, this, [thing](quint16 heatingPumpOperatingHours){
|
connect(alphaConnectTcpConnection, &AlphaInnotecModbusTcpConnection::heatingPumpOperatingHoursChanged, this, [thing](quint16 heatingPumpOperatingHours){
|
||||||
qCDebug(dcAlphaInnotec()) << thing << "heating pump operating hours changed" << heatingPumpOperatingHours;
|
qCDebug(dcAlphaInnotec()) << thing << "heating pump operating hours changed" << heatingPumpOperatingHours;
|
||||||
thing->setStateValue(alphaConnectHeatingPumpOperatingHoursStateTypeId, heatingPumpOperatingHours);
|
thing->setStateValue(alphaConnectHeatingPumpOperatingHoursStateTypeId, heatingPumpOperatingHours);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(alphaConnectTcpConnection, &AlphaConnectModbusTcpConnection::systemStatusChanged, this, [thing](AlphaConnectModbusTcpConnection::SystemStatus systemStatus){
|
connect(alphaConnectTcpConnection, &AlphaInnotecModbusTcpConnection::systemStatusChanged, this, [thing](AlphaInnotecModbusTcpConnection::SystemStatus systemStatus){
|
||||||
qCDebug(dcAlphaInnotec()) << thing << "system status changed" << systemStatus;
|
qCDebug(dcAlphaInnotec()) << thing << "system status changed" << systemStatus;
|
||||||
switch (systemStatus) {
|
switch (systemStatus) {
|
||||||
case AlphaConnectModbusTcpConnection::SystemStatusHeatingMode:
|
case AlphaInnotecModbusTcpConnection::SystemStatusHeatingMode:
|
||||||
thing->setStateValue(alphaConnectSystemStatusStateTypeId, "Heating mode");
|
thing->setStateValue(alphaConnectSystemStatusStateTypeId, "Heating mode");
|
||||||
break;
|
break;
|
||||||
case AlphaConnectModbusTcpConnection::SystemStatusDomesticHotWater:
|
case AlphaInnotecModbusTcpConnection::SystemStatusDomesticHotWater:
|
||||||
thing->setStateValue(alphaConnectSystemStatusStateTypeId, "Domestic hot water");
|
thing->setStateValue(alphaConnectSystemStatusStateTypeId, "Domestic hot water");
|
||||||
break;
|
break;
|
||||||
case AlphaConnectModbusTcpConnection::SystemStatusSwimmingPool:
|
case AlphaInnotecModbusTcpConnection::SystemStatusSwimmingPool:
|
||||||
thing->setStateValue(alphaConnectSystemStatusStateTypeId, "Swimming pool");
|
thing->setStateValue(alphaConnectSystemStatusStateTypeId, "Swimming pool");
|
||||||
break;
|
break;
|
||||||
case AlphaConnectModbusTcpConnection::SystemStatusEVUOff:
|
case AlphaInnotecModbusTcpConnection::SystemStatusEVUOff:
|
||||||
thing->setStateValue(alphaConnectSystemStatusStateTypeId, "EUV off");
|
thing->setStateValue(alphaConnectSystemStatusStateTypeId, "EUV off");
|
||||||
break;
|
break;
|
||||||
case AlphaConnectModbusTcpConnection::SystemStatusDefrost:
|
case AlphaInnotecModbusTcpConnection::SystemStatusDefrost:
|
||||||
thing->setStateValue(alphaConnectSystemStatusStateTypeId, "Defrost");
|
thing->setStateValue(alphaConnectSystemStatusStateTypeId, "Defrost");
|
||||||
break;
|
break;
|
||||||
case AlphaConnectModbusTcpConnection::SystemStatusOff:
|
case AlphaInnotecModbusTcpConnection::SystemStatusOff:
|
||||||
thing->setStateValue(alphaConnectSystemStatusStateTypeId, "Off");
|
thing->setStateValue(alphaConnectSystemStatusStateTypeId, "Off");
|
||||||
break;
|
break;
|
||||||
case AlphaConnectModbusTcpConnection::SystemStatusExternalEnergySource:
|
case AlphaInnotecModbusTcpConnection::SystemStatusExternalEnergySource:
|
||||||
thing->setStateValue(alphaConnectSystemStatusStateTypeId, "External energy source");
|
thing->setStateValue(alphaConnectSystemStatusStateTypeId, "External energy source");
|
||||||
break;
|
break;
|
||||||
case AlphaConnectModbusTcpConnection::SystemStatusCoolingMode:
|
case AlphaInnotecModbusTcpConnection::SystemStatusCoolingMode:
|
||||||
thing->setStateValue(alphaConnectSystemStatusStateTypeId, "Cooling mode");
|
thing->setStateValue(alphaConnectSystemStatusStateTypeId, "Cooling mode");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set heating and cooling states according to the system state
|
// Set heating and cooling states according to the system state
|
||||||
thing->setStateValue(alphaConnectHeatingOnStateTypeId, systemStatus == AlphaConnectModbusTcpConnection::SystemStatusHeatingMode);
|
thing->setStateValue(alphaConnectHeatingOnStateTypeId, systemStatus == AlphaInnotecModbusTcpConnection::SystemStatusHeatingMode);
|
||||||
thing->setStateValue(alphaConnectCoolingOnStateTypeId, systemStatus == AlphaConnectModbusTcpConnection::SystemStatusCoolingMode);
|
thing->setStateValue(alphaConnectCoolingOnStateTypeId, systemStatus == AlphaInnotecModbusTcpConnection::SystemStatusCoolingMode);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Energy
|
// Energy
|
||||||
connect(alphaConnectTcpConnection, &AlphaConnectModbusTcpConnection::totalHeatEnergyChanged, this, [thing](float totalHeatEnergy){
|
connect(alphaConnectTcpConnection, &AlphaInnotecModbusTcpConnection::totalHeatEnergyChanged, this, [thing](float totalHeatEnergy){
|
||||||
qCDebug(dcAlphaInnotec()) << thing << "total heating energy changed" << totalHeatEnergy << "kWh";
|
qCDebug(dcAlphaInnotec()) << thing << "total heating energy changed" << totalHeatEnergy << "kWh";
|
||||||
thing->setStateValue(alphaConnectTotalEnergyStateTypeId, totalHeatEnergy);
|
thing->setStateValue(alphaConnectTotalEnergyStateTypeId, totalHeatEnergy);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(alphaConnectTcpConnection, &AlphaConnectModbusTcpConnection::heatingEnergyChanged, this, [thing](float heatingEnergy){
|
connect(alphaConnectTcpConnection, &AlphaInnotecModbusTcpConnection::heatingEnergyChanged, this, [thing](float heatingEnergy){
|
||||||
qCDebug(dcAlphaInnotec()) << thing << "heating energy changed" << heatingEnergy << "kWh";
|
qCDebug(dcAlphaInnotec()) << thing << "heating energy changed" << heatingEnergy << "kWh";
|
||||||
thing->setStateValue(alphaConnectHeatingEnergyStateTypeId, heatingEnergy);
|
thing->setStateValue(alphaConnectHeatingEnergyStateTypeId, heatingEnergy);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(alphaConnectTcpConnection, &AlphaConnectModbusTcpConnection::waterHeatEnergyChanged, this, [thing](float waterHeatEnergy){
|
connect(alphaConnectTcpConnection, &AlphaInnotecModbusTcpConnection::waterHeatEnergyChanged, this, [thing](float waterHeatEnergy){
|
||||||
qCDebug(dcAlphaInnotec()) << thing << "water heat energy changed" << waterHeatEnergy << "kWh";
|
qCDebug(dcAlphaInnotec()) << thing << "water heat energy changed" << waterHeatEnergy << "kWh";
|
||||||
thing->setStateValue(alphaConnectHotWaterEnergyStateTypeId, waterHeatEnergy);
|
thing->setStateValue(alphaConnectHotWaterEnergyStateTypeId, waterHeatEnergy);
|
||||||
});
|
});
|
||||||
|
|
||||||
// connect(alphaConnectTcpConnection, &AlphaConnectModbusTcpConnection::swimmingPoolHeatEnergyChanged, this, [thing](float swimmingPoolHeatEnergy){
|
// connect(alphaConnectTcpConnection, &AlphaInnotecModbusTcpConnection::swimmingPoolHeatEnergyChanged, this, [thing](float swimmingPoolHeatEnergy){
|
||||||
// qCDebug(dcAlphaInnotec()) << thing << "swimming pool heat energy changed" << swimmingPoolHeatEnergy << "kWh";
|
// qCDebug(dcAlphaInnotec()) << thing << "swimming pool heat energy changed" << swimmingPoolHeatEnergy << "kWh";
|
||||||
// thing->setStateValue(alphaConnectSwimmingPoolEnergyStateTypeId, swimmingPoolHeatEnergy);
|
// thing->setStateValue(alphaConnectSwimmingPoolEnergyStateTypeId, swimmingPoolHeatEnergy);
|
||||||
// });
|
// });
|
||||||
|
|
||||||
// Holding registers
|
// Holding registers
|
||||||
connect(alphaConnectTcpConnection, &AlphaConnectModbusTcpConnection::outdoorTemperatureChanged, this, [thing](float outdoorTemperature){
|
connect(alphaConnectTcpConnection, &AlphaInnotecModbusTcpConnection::outdoorTemperatureChanged, this, [thing](float outdoorTemperature){
|
||||||
qCDebug(dcAlphaInnotec()) << thing << "outdoor temperature changed" << outdoorTemperature << "°C";
|
qCDebug(dcAlphaInnotec()) << thing << "outdoor temperature changed" << outdoorTemperature << "°C";
|
||||||
thing->setStateValue(alphaConnectOutdoorTemperatureStateTypeId, outdoorTemperature);
|
thing->setStateValue(alphaConnectOutdoorTemperatureStateTypeId, outdoorTemperature);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(alphaConnectTcpConnection, &AlphaConnectModbusTcpConnection::returnSetpointTemperatureChanged, this, [thing](float returnSetpointTemperature){
|
connect(alphaConnectTcpConnection, &AlphaInnotecModbusTcpConnection::returnSetpointTemperatureChanged, this, [thing](float returnSetpointTemperature){
|
||||||
qCDebug(dcAlphaInnotec()) << thing << "return setpoint temperature changed" << returnSetpointTemperature << "°C";
|
qCDebug(dcAlphaInnotec()) << thing << "return setpoint temperature changed" << returnSetpointTemperature << "°C";
|
||||||
thing->setStateValue(alphaConnectReturnSetpointTemperatureStateTypeId, returnSetpointTemperature);
|
thing->setStateValue(alphaConnectReturnSetpointTemperatureStateTypeId, returnSetpointTemperature);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(alphaConnectTcpConnection, &AlphaConnectModbusTcpConnection::hotWaterSetpointTemperatureChanged, this, [thing](float hotWaterSetpointTemperature){
|
connect(alphaConnectTcpConnection, &AlphaInnotecModbusTcpConnection::hotWaterSetpointTemperatureChanged, this, [thing](float hotWaterSetpointTemperature){
|
||||||
qCDebug(dcAlphaInnotec()) << thing << "hot water setpoint temperature changed" << hotWaterSetpointTemperature << "°C";
|
qCDebug(dcAlphaInnotec()) << thing << "hot water setpoint temperature changed" << hotWaterSetpointTemperature << "°C";
|
||||||
thing->setStateValue(alphaConnectHotWaterSetpointTemperatureStateTypeId, hotWaterSetpointTemperature);
|
thing->setStateValue(alphaConnectHotWaterSetpointTemperatureStateTypeId, hotWaterSetpointTemperature);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(alphaConnectTcpConnection, &AlphaConnectModbusTcpConnection::smartGridChanged, this, [thing](AlphaConnectModbusTcpConnection::SmartGridState smartGridState){
|
connect(alphaConnectTcpConnection, &AlphaInnotecModbusTcpConnection::smartGridChanged, this, [thing](AlphaInnotecModbusTcpConnection::SmartGridState smartGridState){
|
||||||
qCDebug(dcAlphaInnotec()) << thing << "smart grid state changed" << smartGridState;
|
qCDebug(dcAlphaInnotec()) << thing << "smart grid state changed" << smartGridState;
|
||||||
switch (smartGridState) {
|
switch (smartGridState) {
|
||||||
case AlphaConnectModbusTcpConnection::SmartGridStateOff:
|
case AlphaInnotecModbusTcpConnection::SmartGridStateOff:
|
||||||
thing->setStateValue(alphaConnectSgReadyModeStateTypeId, "Off");
|
thing->setStateValue(alphaConnectSgReadyModeStateTypeId, "Off");
|
||||||
break;
|
break;
|
||||||
case AlphaConnectModbusTcpConnection::SmartGridStateLow:
|
case AlphaInnotecModbusTcpConnection::SmartGridStateLow:
|
||||||
thing->setStateValue(alphaConnectSgReadyModeStateTypeId, "Low");
|
thing->setStateValue(alphaConnectSgReadyModeStateTypeId, "Low");
|
||||||
break;
|
break;
|
||||||
case AlphaConnectModbusTcpConnection::SmartGridStateStandard:
|
case AlphaInnotecModbusTcpConnection::SmartGridStateStandard:
|
||||||
thing->setStateValue(alphaConnectSgReadyModeStateTypeId, "Standard");
|
thing->setStateValue(alphaConnectSgReadyModeStateTypeId, "Standard");
|
||||||
break;
|
break;
|
||||||
case AlphaConnectModbusTcpConnection::SmartGridStateHigh:
|
case AlphaInnotecModbusTcpConnection::SmartGridStateHigh:
|
||||||
thing->setStateValue(alphaConnectSgReadyModeStateTypeId, "High");
|
thing->setStateValue(alphaConnectSgReadyModeStateTypeId, "High");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
m_alpaConnectTcpThings.insert(thing, alphaConnectTcpConnection);
|
m_connections.insert(thing, alphaConnectTcpConnection);
|
||||||
alphaConnectTcpConnection->connectDevice();
|
alphaConnectTcpConnection->connectDevice();
|
||||||
|
|
||||||
// FIXME: make async and check if this is really an alpha connect
|
// FIXME: make async and check if this is really an alpha connect
|
||||||
@ -308,7 +308,7 @@ void IntegrationPluginAlphaInnotec::postSetupThing(Thing *thing)
|
|||||||
qCDebug(dcAlphaInnotec()) << "Starting plugin timer...";
|
qCDebug(dcAlphaInnotec()) << "Starting plugin timer...";
|
||||||
m_pluginTimer = hardwareManager()->pluginTimerManager()->registerTimer(10);
|
m_pluginTimer = hardwareManager()->pluginTimerManager()->registerTimer(10);
|
||||||
connect(m_pluginTimer, &PluginTimer::timeout, this, [this] {
|
connect(m_pluginTimer, &PluginTimer::timeout, this, [this] {
|
||||||
foreach (AlphaConnectModbusTcpConnection *connection, m_alpaConnectTcpThings) {
|
foreach (AlphaInnotecModbusTcpConnection *connection, m_connections) {
|
||||||
if (connection->connected()) {
|
if (connection->connected()) {
|
||||||
connection->update();
|
connection->update();
|
||||||
}
|
}
|
||||||
@ -322,8 +322,8 @@ void IntegrationPluginAlphaInnotec::postSetupThing(Thing *thing)
|
|||||||
|
|
||||||
void IntegrationPluginAlphaInnotec::thingRemoved(Thing *thing)
|
void IntegrationPluginAlphaInnotec::thingRemoved(Thing *thing)
|
||||||
{
|
{
|
||||||
if (thing->thingClassId() == alphaConnectThingClassId && m_alpaConnectTcpThings.contains(thing)) {
|
if (thing->thingClassId() == alphaConnectThingClassId && m_connections.contains(thing)) {
|
||||||
AlphaConnectModbusTcpConnection *connection = m_alpaConnectTcpThings.take(thing);
|
AlphaInnotecModbusTcpConnection *connection = m_connections.take(thing);
|
||||||
delete connection;
|
delete connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -336,7 +336,7 @@ void IntegrationPluginAlphaInnotec::thingRemoved(Thing *thing)
|
|||||||
void IntegrationPluginAlphaInnotec::executeAction(ThingActionInfo *info)
|
void IntegrationPluginAlphaInnotec::executeAction(ThingActionInfo *info)
|
||||||
{
|
{
|
||||||
Thing *thing = info->thing();
|
Thing *thing = info->thing();
|
||||||
AlphaConnectModbusTcpConnection *connection = m_alpaConnectTcpThings.value(thing);
|
AlphaInnotecModbusTcpConnection *connection = m_connections.value(thing);
|
||||||
|
|
||||||
if (!connection->connected()) {
|
if (!connection->connected()) {
|
||||||
qCWarning(dcAlphaInnotec()) << "Could not execute action. The modbus connection is currently not available.";
|
qCWarning(dcAlphaInnotec()) << "Could not execute action. The modbus connection is currently not available.";
|
||||||
@ -430,15 +430,15 @@ void IntegrationPluginAlphaInnotec::executeAction(ThingActionInfo *info)
|
|||||||
} else if (info->action().actionTypeId() == alphaConnectSgReadyModeActionTypeId) {
|
} else if (info->action().actionTypeId() == alphaConnectSgReadyModeActionTypeId) {
|
||||||
QString sgReadyModeString = info->action().paramValue(alphaConnectSgReadyModeActionSgReadyModeParamTypeId).toString();
|
QString sgReadyModeString = info->action().paramValue(alphaConnectSgReadyModeActionSgReadyModeParamTypeId).toString();
|
||||||
qCDebug(dcAlphaInnotec()) << "Execute action" << info->action().actionTypeId().toString() << info->action().params();
|
qCDebug(dcAlphaInnotec()) << "Execute action" << info->action().actionTypeId().toString() << info->action().params();
|
||||||
AlphaConnectModbusTcpConnection::SmartGridState sgReadyState;
|
AlphaInnotecModbusTcpConnection::SmartGridState sgReadyState;
|
||||||
if (sgReadyModeString == "Off") {
|
if (sgReadyModeString == "Off") {
|
||||||
sgReadyState = AlphaConnectModbusTcpConnection::SmartGridStateOff;
|
sgReadyState = AlphaInnotecModbusTcpConnection::SmartGridStateOff;
|
||||||
} else if (sgReadyModeString == "Low") {
|
} else if (sgReadyModeString == "Low") {
|
||||||
sgReadyState = AlphaConnectModbusTcpConnection::SmartGridStateLow;
|
sgReadyState = AlphaInnotecModbusTcpConnection::SmartGridStateLow;
|
||||||
} else if (sgReadyModeString == "High") {
|
} else if (sgReadyModeString == "High") {
|
||||||
sgReadyState = AlphaConnectModbusTcpConnection::SmartGridStateHigh;
|
sgReadyState = AlphaInnotecModbusTcpConnection::SmartGridStateHigh;
|
||||||
} else {
|
} else {
|
||||||
sgReadyState = AlphaConnectModbusTcpConnection::SmartGridStateStandard;
|
sgReadyState = AlphaInnotecModbusTcpConnection::SmartGridStateStandard;
|
||||||
}
|
}
|
||||||
|
|
||||||
QModbusReply *reply = connection->setSmartGrid(sgReadyState);
|
QModbusReply *reply = connection->setSmartGrid(sgReadyState);
|
||||||
|
|||||||
@ -32,7 +32,7 @@
|
|||||||
#define INTEGRATIONPLUGINALPHAINNOTEC_H
|
#define INTEGRATIONPLUGINALPHAINNOTEC_H
|
||||||
|
|
||||||
#include "plugintimer.h"
|
#include "plugintimer.h"
|
||||||
#include "alphaconnectmodbustcpconnection.h"
|
#include "alphainnotecmodbustcpconnection.h"
|
||||||
#include "integrations/integrationplugin.h"
|
#include "integrations/integrationplugin.h"
|
||||||
|
|
||||||
class IntegrationPluginAlphaInnotec: public IntegrationPlugin
|
class IntegrationPluginAlphaInnotec: public IntegrationPlugin
|
||||||
@ -54,7 +54,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
PluginTimer *m_pluginTimer = nullptr;
|
PluginTimer *m_pluginTimer = nullptr;
|
||||||
QHash<Thing *, AlphaConnectModbusTcpConnection *> m_alpaConnectTcpThings;
|
QHash<Thing *, AlphaInnotecModbusTcpConnection *> m_connections;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INTEGRATIONPLUGINALPHAINNOTEC_H
|
#endif // INTEGRATIONPLUGINALPHAINNOTEC_H
|
||||||
|
|||||||
Reference in New Issue
Block a user