Added registers and Thing states and connects
This commit is contained in:
parent
92163a92dd
commit
eac316e6f8
@ -1,128 +1,357 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
*
|
||||
* Copyright 2013 - 2021, nymea GmbH
|
||||
* Contact: contact@nymea.io
|
||||
*
|
||||
* This file 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
|
||||
*
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
*
|
||||
* Copyright 2013 - 2021, nymea GmbH
|
||||
* Contact: contact@nymea.io
|
||||
*
|
||||
* This file 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
|
||||
*
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#include "integrationpluginstiebeleltron.h"
|
||||
|
||||
#include "network/networkdevicediscovery.h"
|
||||
#include "hardwaremanager.h"
|
||||
#include "network/networkdevicediscovery.h"
|
||||
#include "plugininfo.h"
|
||||
|
||||
IntegrationPluginStiebelEltron::IntegrationPluginStiebelEltron()
|
||||
{
|
||||
IntegrationPluginStiebelEltron::IntegrationPluginStiebelEltron() {}
|
||||
|
||||
}
|
||||
|
||||
void IntegrationPluginStiebelEltron::discoverThings(ThingDiscoveryInfo *info)
|
||||
{
|
||||
void IntegrationPluginStiebelEltron::discoverThings(ThingDiscoveryInfo *info) {
|
||||
if (!hardwareManager()->networkDeviceDiscovery()->available()) {
|
||||
qCWarning(dcStiebelEltron()) << "The network discovery is not available on this platform.";
|
||||
info->finish(Thing::ThingErrorUnsupportedFeature, QT_TR_NOOP("The network device discovery is not available."));
|
||||
qCWarning(dcStiebelEltron())
|
||||
<< "The network discovery is not available on this platform.";
|
||||
info->finish(
|
||||
Thing::ThingErrorUnsupportedFeature,
|
||||
QT_TR_NOOP("The network device discovery is not available."));
|
||||
return;
|
||||
}
|
||||
|
||||
NetworkDeviceDiscoveryReply *discoveryReply = hardwareManager()->networkDeviceDiscovery()->discover();
|
||||
connect(discoveryReply, &NetworkDeviceDiscoveryReply::finished, this, [=](){
|
||||
foreach (const NetworkDeviceInfo &networkDeviceInfo, discoveryReply->networkDeviceInfos()) {
|
||||
NetworkDeviceDiscoveryReply *discoveryReply =
|
||||
hardwareManager()->networkDeviceDiscovery()->discover();
|
||||
connect(
|
||||
discoveryReply, &NetworkDeviceDiscoveryReply::finished, this, [=]() {
|
||||
foreach (const NetworkDeviceInfo &networkDeviceInfo,
|
||||
discoveryReply->networkDeviceInfos()) {
|
||||
qCDebug(dcStiebelEltron()) << "Found" << networkDeviceInfo;
|
||||
|
||||
qCDebug(dcStiebelEltron()) << "Found" << networkDeviceInfo;
|
||||
QString title;
|
||||
if (networkDeviceInfo.hostName().isEmpty()) {
|
||||
title = networkDeviceInfo.address().toString();
|
||||
} else {
|
||||
title = networkDeviceInfo.hostName() + " (" +
|
||||
networkDeviceInfo.address().toString() + ")";
|
||||
}
|
||||
|
||||
QString title;
|
||||
if (networkDeviceInfo.hostName().isEmpty()) {
|
||||
title = networkDeviceInfo.address().toString();
|
||||
} else {
|
||||
title = networkDeviceInfo.hostName() + " (" + networkDeviceInfo.address().toString() + ")";
|
||||
QString description;
|
||||
if (networkDeviceInfo.macAddressManufacturer().isEmpty()) {
|
||||
description = networkDeviceInfo.macAddress();
|
||||
} else {
|
||||
description = networkDeviceInfo.macAddress() + " (" +
|
||||
networkDeviceInfo.macAddressManufacturer() +
|
||||
")";
|
||||
}
|
||||
|
||||
ThingDescriptor descriptor(stiebelEltronThingClassId, title,
|
||||
description);
|
||||
ParamList params;
|
||||
params << Param(stiebelEltronThingIpAddressParamTypeId,
|
||||
networkDeviceInfo.address().toString());
|
||||
params << Param(stiebelEltronThingMacAddressParamTypeId,
|
||||
networkDeviceInfo.macAddress());
|
||||
descriptor.setParams(params);
|
||||
|
||||
// Check if we already have set up this device
|
||||
Things existingThings = myThings().filterByParam(
|
||||
stiebelEltronThingMacAddressParamTypeId,
|
||||
networkDeviceInfo.macAddress());
|
||||
if (existingThings.count() == 1) {
|
||||
qCDebug(dcStiebelEltron())
|
||||
<< "This connection already exists in the system:"
|
||||
<< networkDeviceInfo;
|
||||
descriptor.setThingId(existingThings.first()->id());
|
||||
}
|
||||
|
||||
info->addThingDescriptor(descriptor);
|
||||
}
|
||||
|
||||
QString description;
|
||||
if (networkDeviceInfo.macAddressManufacturer().isEmpty()) {
|
||||
description = networkDeviceInfo.macAddress();
|
||||
} else {
|
||||
description = networkDeviceInfo.macAddress() + " (" + networkDeviceInfo.macAddressManufacturer() + ")";
|
||||
}
|
||||
|
||||
ThingDescriptor descriptor(stiebelEltronThingClassId, title, description);
|
||||
ParamList params;
|
||||
params << Param(stiebelEltronThingIpAddressParamTypeId, networkDeviceInfo.address().toString());
|
||||
params << Param(stiebelEltronThingMacAddressParamTypeId, networkDeviceInfo.macAddress());
|
||||
descriptor.setParams(params);
|
||||
|
||||
// Check if we already have set up this device
|
||||
Things existingThings = myThings().filterByParam(stiebelEltronThingMacAddressParamTypeId, networkDeviceInfo.macAddress());
|
||||
if (existingThings.count() == 1) {
|
||||
qCDebug(dcStiebelEltron()) << "This connection already exists in the system:" << networkDeviceInfo;
|
||||
descriptor.setThingId(existingThings.first()->id());
|
||||
}
|
||||
|
||||
info->addThingDescriptor(descriptor);
|
||||
}
|
||||
|
||||
info->finish(Thing::ThingErrorNoError);
|
||||
});
|
||||
info->finish(Thing::ThingErrorNoError);
|
||||
});
|
||||
}
|
||||
|
||||
void IntegrationPluginStiebelEltron::startMonitoringAutoThings()
|
||||
{
|
||||
void IntegrationPluginStiebelEltron::startMonitoringAutoThings() {}
|
||||
|
||||
}
|
||||
|
||||
void IntegrationPluginStiebelEltron::setupThing(ThingSetupInfo *info)
|
||||
{
|
||||
void IntegrationPluginStiebelEltron::setupThing(ThingSetupInfo *info) {
|
||||
Thing *thing = info->thing();
|
||||
qCDebug(dcStiebelEltron()) << "Setup" << thing << thing->params();
|
||||
|
||||
if (thing->thingClassId() == stiebelEltronThingClassId) {
|
||||
QHostAddress address(
|
||||
thing->paramValue(stiebelEltronThingIpAddressParamTypeId)
|
||||
.toString());
|
||||
quint16 port =
|
||||
thing->paramValue(stiebelEltronThingPortParamTypeId).toUInt();
|
||||
quint16 slaveId =
|
||||
thing->paramValue(stiebelEltronThingSlaveIdParamTypeId).toUInt();
|
||||
|
||||
QHostAddress address(thing->paramValue(stiebelEltronThingIpAddressParamTypeId).toString());
|
||||
quint16 port = thing->paramValue(stiebelEltronThingPortParamTypeId).toUInt();
|
||||
quint16 slaveId = thing->paramValue(stiebelEltronThingSlaveIdParamTypeId).toUInt();
|
||||
StiebelEltronModbusConnection *connection =
|
||||
new StiebelEltronModbusConnection(address, port, slaveId, this);
|
||||
|
||||
StiebelEltronModbusConnection *connection = new StiebelEltronModbusConnection(address, port, slaveId, this);
|
||||
connect(
|
||||
connection, &StiebelEltronModbusConnection::connectionStateChanged,
|
||||
this, [thing, connection](bool status) {
|
||||
qCDebug(dcStiebelEltron())
|
||||
<< "Connected changed to" << status << "for" << thing;
|
||||
if (status) {
|
||||
connection->update();
|
||||
}
|
||||
|
||||
connection->connectDevice();
|
||||
thing->setStateValue(stiebelEltronConnectedStateTypeId, status);
|
||||
});
|
||||
|
||||
connect(connection,
|
||||
&StiebelEltronModbusConnection::outdoorTemperatureChanged, this,
|
||||
[thing](float outdoorTemperature) {
|
||||
qCDebug(dcStiebelEltron())
|
||||
<< thing << "outdoor temperature changed"
|
||||
<< outdoorTemperature << "°C";
|
||||
thing->setStateValue(
|
||||
stiebelEltronOutdoorTemperatureStateTypeId,
|
||||
outdoorTemperature);
|
||||
});
|
||||
|
||||
connect(
|
||||
connection, &StiebelEltronModbusConnection::flowTemperatureChanged,
|
||||
this, [thing](float flowTemperature) {
|
||||
qCDebug(dcStiebelEltron())
|
||||
<< thing << "flow temperature changed" << flowTemperature
|
||||
<< "°C";
|
||||
thing->setStateValue(stiebelEltronFlowTemperatureStateTypeId,
|
||||
flowTemperature);
|
||||
});
|
||||
|
||||
connect(connection,
|
||||
&StiebelEltronModbusConnection::hotWaterTemperatureChanged,
|
||||
this, [thing](float hotWaterTemperature) {
|
||||
qCDebug(dcStiebelEltron())
|
||||
<< thing << "hot water temperature changed"
|
||||
<< hotWaterTemperature << "°C";
|
||||
thing->setStateValue(
|
||||
stiebelEltronHotWaterTemperatureStateTypeId,
|
||||
hotWaterTemperature);
|
||||
});
|
||||
connect(connection,
|
||||
&StiebelEltronModbusConnection::storageTankTemperatureChanged,
|
||||
this, [thing](float storageTankTemperature) {
|
||||
qCDebug(dcStiebelEltron())
|
||||
<< thing << "Storage tank temperature changed"
|
||||
<< storageTankTemperature << "°C";
|
||||
thing->setStateValue(
|
||||
stiebelEltronStorageTankTemperatureStateTypeId,
|
||||
storageTankTemperature);
|
||||
});
|
||||
connect(connection,
|
||||
&StiebelEltronModbusConnection::returnTemperatureChanged, this,
|
||||
[thing](float returnTemperature) {
|
||||
qCDebug(dcStiebelEltron())
|
||||
<< thing << "return temperature changed"
|
||||
<< returnTemperature << "°C";
|
||||
thing->setStateValue(
|
||||
stiebelEltronReturnTemperatureStateTypeId,
|
||||
returnTemperature);
|
||||
});
|
||||
connect(
|
||||
connection, &StiebelEltronModbusConnection::heatingEnergyChanged,
|
||||
this, [thing](quint32 heatingEnergy) {
|
||||
// kWh and MWh of energy are stored in two registers an read as
|
||||
// an uint32. The following arithmetic splits the uint32 into
|
||||
// two uint16 and sums up the MWh and kWh values.
|
||||
quint32 correctedEnergy =
|
||||
(heatingEnergy >> 16) + (heatingEnergy & 0xFFFF) * 1000;
|
||||
qCDebug(dcStiebelEltron()) << thing << "Heating energy changed"
|
||||
<< correctedEnergy << "kWh";
|
||||
thing->setStateValue(stiebelEltronHeatingEnergyStateTypeId,
|
||||
correctedEnergy);
|
||||
});
|
||||
connect(connection,
|
||||
&StiebelEltronModbusConnection::hotWaterEnergyChanged, this,
|
||||
[thing](quint32 hotWaterEnergy) {
|
||||
// see comment in heatingEnergyChanged
|
||||
quint32 correctedEnergy = (hotWaterEnergy >> 16) +
|
||||
(hotWaterEnergy & 0xFFFF) * 1000;
|
||||
qCDebug(dcStiebelEltron())
|
||||
<< thing << "Hot Water energy changed"
|
||||
<< correctedEnergy << "kWh";
|
||||
thing->setStateValue(stiebelEltronHotWaterEnergyStateTypeId,
|
||||
correctedEnergy);
|
||||
});
|
||||
connect(connection,
|
||||
&StiebelEltronModbusConnection::consumedEnergyHeatingChanged,
|
||||
this, [thing](quint32 consumedEnergyHeatingEnergy) {
|
||||
// see comment in heatingEnergyChanged
|
||||
quint32 correctedEnergy =
|
||||
(consumedEnergyHeatingEnergy >> 16) +
|
||||
(consumedEnergyHeatingEnergy & 0xFFFF) * 1000;
|
||||
qCDebug(dcStiebelEltron())
|
||||
<< thing << "Consumed energy Heating changed"
|
||||
<< correctedEnergy << "kWh";
|
||||
thing->setStateValue(
|
||||
stiebelEltronConsumedEnergyHeatingStateTypeId,
|
||||
correctedEnergy);
|
||||
});
|
||||
connect(connection,
|
||||
&StiebelEltronModbusConnection::consumedEnergyHotWaterChanged,
|
||||
this, [thing](quint32 consumedEnergyHotWaterEnergy) {
|
||||
// see comment in heatingEnergyChanged
|
||||
quint32 correctedEnergy =
|
||||
(consumedEnergyHotWaterEnergy >> 16) +
|
||||
(consumedEnergyHotWaterEnergy & 0xFFFF) * 1000;
|
||||
qCDebug(dcStiebelEltron())
|
||||
<< thing << "Consumed energy hot water changed"
|
||||
<< correctedEnergy << "kWh";
|
||||
thing->setStateValue(
|
||||
stiebelEltronConsumedEnergyHotWaterStateTypeId,
|
||||
correctedEnergy);
|
||||
});
|
||||
|
||||
connect(
|
||||
connection, &StiebelEltronModbusConnection::operatingModeChanged,
|
||||
this,
|
||||
[thing](
|
||||
StiebelEltronModbusConnection::OperatingMode operatingMode) {
|
||||
qCDebug(dcStiebelEltron())
|
||||
<< thing << "operating mode changed " << operatingMode;
|
||||
switch (operatingMode) {
|
||||
case StiebelEltronModbusConnection::OperatingModeEmergency:
|
||||
thing->setStateValue(
|
||||
stiebelEltronOperatingModeStateTypeId, "Emergency");
|
||||
break;
|
||||
case StiebelEltronModbusConnection::OperatingModeStandby:
|
||||
thing->setStateValue(
|
||||
stiebelEltronOperatingModeStateTypeId, "Standby");
|
||||
break;
|
||||
case StiebelEltronModbusConnection::OperatingModeProgram:
|
||||
thing->setStateValue(
|
||||
stiebelEltronOperatingModeStateTypeId, "Program");
|
||||
break;
|
||||
case StiebelEltronModbusConnection::OperatingModeComfort:
|
||||
thing->setStateValue(
|
||||
stiebelEltronOperatingModeStateTypeId, "Comfort");
|
||||
break;
|
||||
case StiebelEltronModbusConnection::OperatingModeEco:
|
||||
thing->setStateValue(
|
||||
stiebelEltronOperatingModeStateTypeId, "Eco");
|
||||
break;
|
||||
case StiebelEltronModbusConnection::OperatingModeHotWater:
|
||||
thing->setStateValue(
|
||||
stiebelEltronOperatingModeStateTypeId, "Hot water");
|
||||
break;
|
||||
}
|
||||
});
|
||||
connect(connection, &StiebelEltronModbusConnection::systemStatusChanged,
|
||||
this, [thing](uint16_t systemStatus) {
|
||||
qCDebug(dcStiebelEltron())
|
||||
<< thing << "System status changed " << systemStatus;
|
||||
|
||||
thing->setStateValue(stiebelEltronPumpOneStateTypeId,
|
||||
systemStatus & (1 << 0));
|
||||
|
||||
thing->setStateValue(stiebelEltronPumpTwoStateTypeId,
|
||||
systemStatus & (1 << 1));
|
||||
thing->setStateValue(stiebelEltronHeatingUpStateTypeId,
|
||||
systemStatus & (1 << 2));
|
||||
|
||||
thing->setStateValue(stiebelEltronAuxHeatingStateTypeId,
|
||||
systemStatus & (1 << 3));
|
||||
thing->setStateValue(stiebelEltronHeatingStateTypeId,
|
||||
systemStatus & (1 << 4));
|
||||
thing->setStateValue(stiebelEltronHotWaterStateTypeId,
|
||||
systemStatus & (1 << 5));
|
||||
thing->setStateValue(stiebelEltronCompressorStateTypeId,
|
||||
systemStatus & (1 << 6));
|
||||
thing->setStateValue(stiebelEltronSummerModeStateTypeId,
|
||||
systemStatus & (1 << 7));
|
||||
thing->setStateValue(stiebelEltronCoolingModeStateTypeId,
|
||||
systemStatus & (1 << 8));
|
||||
thing->setStateValue(stiebelEltronDefrostingStateTypeId,
|
||||
systemStatus & (1 << 9));
|
||||
thing->setStateValue(stiebelEltronSilentModeStateTypeId,
|
||||
systemStatus & (1 << 10));
|
||||
thing->setStateValue(stiebelEltronPowerStateTypeId,
|
||||
systemStatus & (1 << 11));
|
||||
});
|
||||
|
||||
connect(
|
||||
connection, &StiebelEltronModbusConnection::sgReadyStateChanged,
|
||||
this,
|
||||
[thing](StiebelEltronModbusConnection::SmartGridState
|
||||
smartGridState) {
|
||||
qCDebug(dcStiebelEltron())
|
||||
<< thing << "SG Ready activation changed" << smartGridState;
|
||||
switch (smartGridState) {
|
||||
case StiebelEltronModbusConnection::SmartGridStateModeOne:
|
||||
thing->setStateValue(
|
||||
stiebelEltronSgReadyModeStateTypeId, "Mode 1");
|
||||
break;
|
||||
case StiebelEltronModbusConnection::SmartGridStateModeTwo:
|
||||
thing->setStateValue(
|
||||
stiebelEltronSgReadyModeStateTypeId, "Mode 2");
|
||||
break;
|
||||
case StiebelEltronModbusConnection::SmartGridStateModeThree:
|
||||
thing->setStateValue(
|
||||
stiebelEltronSgReadyModeStateTypeId, "Mode 3");
|
||||
break;
|
||||
case StiebelEltronModbusConnection::SmartGridStateModeFour:
|
||||
thing->setStateValue(
|
||||
stiebelEltronSgReadyModeStateTypeId, "Mode 4");
|
||||
break;
|
||||
}
|
||||
});
|
||||
connect(connection,
|
||||
&StiebelEltronModbusConnection::sgReadyActiveChanged, this,
|
||||
[thing](bool smartGridActive) {
|
||||
qCDebug(dcStiebelEltron())
|
||||
<< thing << "SG Ready activation changed"
|
||||
<< smartGridActive;
|
||||
thing->setStateValue(stiebelEltronSgReadyActiveStateTypeId,
|
||||
smartGridActive);
|
||||
});
|
||||
|
||||
m_connections.insert(thing, connection);
|
||||
connection->connectDevice();
|
||||
|
||||
info->finish(Thing::ThingErrorNoError);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void IntegrationPluginStiebelEltron::postSetupThing(Thing *thing)
|
||||
{
|
||||
void IntegrationPluginStiebelEltron::postSetupThing(Thing *thing) {
|
||||
if (thing->thingClassId() == stiebelEltronThingClassId) {
|
||||
if (!m_pluginTimer) {
|
||||
qCDebug(dcStiebelEltron()) << "Starting plugin timer...";
|
||||
m_pluginTimer = hardwareManager()->pluginTimerManager()->registerTimer(10);
|
||||
m_pluginTimer =
|
||||
hardwareManager()->pluginTimerManager()->registerTimer(10);
|
||||
connect(m_pluginTimer, &PluginTimer::timeout, this, [this] {
|
||||
foreach (StiebelEltronModbusConnection *connection, m_connections) {
|
||||
foreach (StiebelEltronModbusConnection *connection,
|
||||
m_connections) {
|
||||
if (connection->connected()) {
|
||||
connection->update();
|
||||
}
|
||||
@ -134,9 +363,9 @@ void IntegrationPluginStiebelEltron::postSetupThing(Thing *thing)
|
||||
}
|
||||
}
|
||||
|
||||
void IntegrationPluginStiebelEltron::thingRemoved(Thing *thing)
|
||||
{
|
||||
if (thing->thingClassId() == stiebelEltronThingClassId && m_connections.contains(thing)) {
|
||||
void IntegrationPluginStiebelEltron::thingRemoved(Thing *thing) {
|
||||
if (thing->thingClassId() == stiebelEltronThingClassId &&
|
||||
m_connections.contains(thing)) {
|
||||
m_connections.take(thing)->deleteLater();
|
||||
}
|
||||
|
||||
@ -146,9 +375,56 @@ void IntegrationPluginStiebelEltron::thingRemoved(Thing *thing)
|
||||
}
|
||||
}
|
||||
|
||||
void IntegrationPluginStiebelEltron::executeAction(ThingActionInfo *info)
|
||||
{
|
||||
info->finish(Thing::ThingErrorNoError);
|
||||
void IntegrationPluginStiebelEltron::executeAction(ThingActionInfo *info) {
|
||||
Thing *thing = info->thing();
|
||||
StiebelEltronModbusConnection *connection = m_connections.value(thing);
|
||||
|
||||
|
||||
|
||||
if (!connection->connected()) {
|
||||
qCWarning(dcStiebelEltron()) << "Could not execute action. The modbus connection is currently not available.";
|
||||
info->finish(Thing::ThingErrorHardwareNotAvailable);
|
||||
return;
|
||||
}
|
||||
|
||||
// Got this from StiebelEltron plugin, not sure if necessary
|
||||
if (thing->thingClassId() != stiebelEltronThingClassId) {
|
||||
info->finish(Thing::ThingErrorNoError);
|
||||
}
|
||||
|
||||
if (info->action().actionTypeId() == stiebelEltronSgReadyActiveActionTypeId) {
|
||||
bool sgReadyActiveBool = info->action().paramValue(stiebelEltronSgReadyActiveActionSgReadyActiveParamTypeId).toBool();
|
||||
qCDebug(dcStiebelEltron()) << "Execute action" << info->action().actionTypeId().toString() << info->action().params();
|
||||
qCDebug(dcStiebelEltron()) << "Value: " << sgReadyActiveBool;
|
||||
|
||||
QModbusReply *reply = connection->setSgReadyActive(sgReadyActiveBool);
|
||||
if (!reply) {
|
||||
qCWarning(dcStiebelEltron()) << "Execute action failed because the reply could not be created.";
|
||||
info->finish(Thing::ThingErrorHardwareFailure);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
connect(reply, &QModbusReply::finished, reply, &QModbusReply::deleteLater);
|
||||
connect(reply, &QModbusReply::finished, info, [info, reply, sgReadyActiveBool]{
|
||||
if (reply->error() != QModbusDevice::NoError) {
|
||||
qCWarning(dcStiebelEltron()) << "Set SG ready activation finished with error" << reply->errorString();
|
||||
info->finish(Thing::ThingErrorHardwareFailure);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
qCDebug(dcStiebelEltron()) << "Execute action finished successfully" << info->action().actionTypeId().toString() << info->action().params();
|
||||
info->thing()->setStateValue(stiebelEltronSgReadyActiveStateTypeId, sgReadyActiveBool);
|
||||
info->finish(Thing::ThingErrorNoError);
|
||||
});
|
||||
|
||||
connect(reply, &QModbusReply::errorOccurred, this, [reply] (QModbusDevice::Error error){
|
||||
qCWarning(dcStiebelEltron()) << "Modbus reply error occurred while execute action" << error << reply->errorString();
|
||||
emit reply->finished(); // To make sure it will be deleted
|
||||
});
|
||||
}
|
||||
|
||||
info->finish(Thing::ThingErrorNoError);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
"cached": false
|
||||
},
|
||||
{
|
||||
"id": "d6475acb-3a15-401b-8bad-8610eb056bf7",
|
||||
"id": "1ec958c8-7bf1-469e-b35e-b71fa2099e91",
|
||||
"name": "flowTemperature",
|
||||
"displayName": "Flow temperature",
|
||||
"displayNameEvent": "Flow temperature changed",
|
||||
@ -76,32 +76,261 @@
|
||||
"defaultValue": 0,
|
||||
"suggestLogging": true
|
||||
},
|
||||
|
||||
{
|
||||
"id": "7d474fb5-aa37-4f21-8166-b20f5bf84fb4",
|
||||
"name": "sgReadyMode",
|
||||
"displayName": "Smart grid mode",
|
||||
"displayNameEvent": "Smart grid mode changed",
|
||||
"displayNameAction": "Set smart grid mode",
|
||||
"type": "QString",
|
||||
"possibleValues": [
|
||||
"Off",
|
||||
"Low",
|
||||
"Standard",
|
||||
"High"
|
||||
],
|
||||
"writable": true,
|
||||
"defaultValue": "Standard",
|
||||
"id": "e86cbac5-c2c3-4fcf-8caa-dbfc0df2584d",
|
||||
"name": "outdoorTemperature",
|
||||
"displayName": "Outdoor temperature",
|
||||
"displayNameEvent": "Outdoor temperature changed",
|
||||
"unit": "DegreeCelsius",
|
||||
"type": "double",
|
||||
"defaultValue": 0,
|
||||
"suggestLogging": true
|
||||
},
|
||||
{
|
||||
"id": "f4abbd8d-14d6-4294-9b63-411a9721f946",
|
||||
"name": "totalEnergy",
|
||||
"displayName": "Total energy",
|
||||
"displayNameEvent": "Total energy changed",
|
||||
"id": "27c56897-75f1-45af-9a14-b0620053d2d2",
|
||||
"name": "hotWaterTemperature",
|
||||
"displayName": "Hot water temperature",
|
||||
"displayNameEvent": "Hot water changed",
|
||||
"unit": "DegreeCelsius",
|
||||
"type": "double",
|
||||
"unit": "KiloWattHour",
|
||||
"defaultValue": 0,
|
||||
"suggestLogging": true
|
||||
},
|
||||
{
|
||||
"id": "5833ceb6-5e7c-437b-a44a-e9f5eb42b6ac",
|
||||
"name": "sourceTemperature",
|
||||
"displayName": "Source temperature",
|
||||
"displayNameEvent": "Source temperature changed",
|
||||
"unit": "DegreeCelsius",
|
||||
"type": "double",
|
||||
"defaultValue": 0,
|
||||
"suggestLogging": true
|
||||
},
|
||||
{
|
||||
"id": "d1959819-9e56-47f7-b619-a393ce50738a",
|
||||
"name": "roomTemperature1",
|
||||
"displayName": "Room temperature 1",
|
||||
"displayNameEvent": "Room temperature 1 changed",
|
||||
"unit": "DegreeCelsius",
|
||||
"type": "double",
|
||||
"defaultValue": 0,
|
||||
"suggestLogging": true
|
||||
},
|
||||
{
|
||||
"id": "04ac741c-5277-4806-be73-576a164ecb46",
|
||||
"name": "roomTemperature2",
|
||||
"displayName": "Room temperature 1",
|
||||
"displayNameEvent": "Room temperature changed",
|
||||
"unit": "DegreeCelsius",
|
||||
"type": "double",
|
||||
"defaultValue": 0,
|
||||
"suggestLogging": true
|
||||
},
|
||||
{
|
||||
"id": "43dd25b3-8782-4faa-a9e0-2fb10892fa0c",
|
||||
"name": "storageTankTemperature",
|
||||
"displayName": "Storage tank temperature",
|
||||
"displayNameEvent": "Storage tank temperature changed",
|
||||
"unit": "DegreeCelsius",
|
||||
"type": "double",
|
||||
"defaultValue": 0,
|
||||
"suggestLogging": true
|
||||
},
|
||||
{
|
||||
"id": "d0597f21-2c0e-4db6-92e0-4a3b66474f87",
|
||||
"name": "heatingEnergy",
|
||||
"displayName": "Heating energy",
|
||||
"displayNameEvent": "Heating energy changed",
|
||||
"unit": "KiloWattHour",
|
||||
"type": "uint",
|
||||
"defaultValue": 0,
|
||||
"suggestLogging": true
|
||||
},
|
||||
{
|
||||
"id": "9761060e-f364-466e-8661-d28f01b862fc",
|
||||
"name": "hotWaterEnergy",
|
||||
"displayName": "Hot water energy",
|
||||
"displayNameEvent": "Hot water energy changed",
|
||||
"unit": "KiloWattHour",
|
||||
"type": "uint",
|
||||
"defaultValue": 0,
|
||||
"suggestLogging": true
|
||||
},
|
||||
{
|
||||
"id": "11f91606-d550-4918-9fca-69e3303389c8",
|
||||
"name": "consumedEnergyHotWater",
|
||||
"displayName": "Consumed energy hot water",
|
||||
"displayNameEvent": "Consumed energy hot water changed",
|
||||
"unit": "KiloWattHour",
|
||||
"type": "uint",
|
||||
"defaultValue": 0,
|
||||
"suggestLogging": true
|
||||
},
|
||||
{
|
||||
"id": "6816dfef-3f54-4bf1-b0d5-641f06785991",
|
||||
"name": "consumedEnergyHeating",
|
||||
"displayName": "Consumed energy heating",
|
||||
"displayNameEvent": "Consumed energy heating changed",
|
||||
"unit": "KiloWattHour",
|
||||
"type": "uint",
|
||||
"defaultValue": 0,
|
||||
"suggestLogging": true
|
||||
},
|
||||
{
|
||||
"id": "932cc41e-53ae-48ae-baa2-6f385f5aa791",
|
||||
"name": "operatingMode",
|
||||
"displayName": "Operating mode",
|
||||
"displayNameEvent": "Operating mode changed",
|
||||
"displayNameAction": "Set operating mode",
|
||||
"type": "QString",
|
||||
"possibleValues": [
|
||||
"Emergency",
|
||||
"Standby",
|
||||
"Program",
|
||||
"Comfort",
|
||||
"Eco",
|
||||
"Hot water"
|
||||
],
|
||||
"writable": false,
|
||||
"defaultValue": "Standby",
|
||||
"suggestLogging": true
|
||||
},
|
||||
{
|
||||
"id": "0ad36f3e-96ff-49d0-8b12-b8c6fed1bf4b",
|
||||
"name": "pumpOne",
|
||||
"displayName": "Pump 1",
|
||||
"displayNameEvent": "Pump 1 status changed",
|
||||
"type": "bool",
|
||||
"defaultValue": false,
|
||||
"suggestLogging": true
|
||||
},
|
||||
{
|
||||
"id": "1c211fb2-da78-41ad-b7d0-e404141a3dd5",
|
||||
"name": "pumpTwo",
|
||||
"displayName": "Pump 2",
|
||||
"displayNameEvent": "Pump 2 status changed",
|
||||
"type": "bool",
|
||||
"defaultValue": false,
|
||||
"suggestLogging": true
|
||||
},
|
||||
{
|
||||
"id": "ad0b8df8-1eaa-409d-b5e2-a76d7c17c2b9",
|
||||
"name": "heatingUp",
|
||||
"displayName": "Heating up",
|
||||
"displayNameEvent": "Heating up status changed",
|
||||
"type": "bool",
|
||||
"defaultValue": false,
|
||||
"suggestLogging": true
|
||||
},
|
||||
{
|
||||
"id": "44d5f18b-0389-4a7d-9cb8-f760ce06814e",
|
||||
"name": "auxHeating",
|
||||
"displayName": "Electric auxiliary heating",
|
||||
"displayNameEvent": "Electric auxiliary heating status changed",
|
||||
"type": "bool",
|
||||
"defaultValue": false,
|
||||
"suggestLogging": true
|
||||
},
|
||||
{
|
||||
"id": "3e44e580-f515-47ae-984b-109b507a5db2",
|
||||
"name": "heating",
|
||||
"displayName": "Heating mode",
|
||||
"displayNameEvent": "Heating mode status changed",
|
||||
"type": "bool",
|
||||
"defaultValue": false,
|
||||
"suggestLogging": true
|
||||
},
|
||||
{
|
||||
"id": "b6338cdb-863e-4191-adc4-bc6da5a67351",
|
||||
"name": "hotWater",
|
||||
"displayName": "Hot water mode",
|
||||
"displayNameEvent": "Hot water mode status changed",
|
||||
"type": "bool",
|
||||
"defaultValue": false,
|
||||
"suggestLogging": true
|
||||
},
|
||||
{
|
||||
"id": "c957cef8-b3a7-4626-ab95-db5439fbdf7f",
|
||||
"name": "compressor",
|
||||
"displayName": "Compressor",
|
||||
"displayNameEvent": "Compressor status changed",
|
||||
"type": "bool",
|
||||
"defaultValue": false,
|
||||
"suggestLogging": true
|
||||
},
|
||||
{
|
||||
"id": "7a287cfb-9088-4aad-a991-3e43714dc64e",
|
||||
"name": "summerMode",
|
||||
"displayName": "Summer mode",
|
||||
"displayNameEvent": "Sommer mode status changed",
|
||||
"type": "bool",
|
||||
"defaultValue": false,
|
||||
"suggestLogging": true
|
||||
},
|
||||
{
|
||||
"id": "1bfd99ee-1477-4f70-8717-a3a2930b137f",
|
||||
"name": "coolingMode",
|
||||
"displayName": "Cooling mode",
|
||||
"displayNameEvent": "Cooling mode status changed",
|
||||
"type": "bool",
|
||||
"defaultValue": false,
|
||||
"suggestLogging": true
|
||||
},
|
||||
{
|
||||
"id": "5c47d9bb-66de-48aa-b90e-caa3ca8d44a5",
|
||||
"name": "defrosting",
|
||||
"displayName": "Defrosting mode",
|
||||
"displayNameEvent": "Defrosting mode status changed",
|
||||
"type": "bool",
|
||||
"defaultValue": false,
|
||||
"suggestLogging": true
|
||||
},
|
||||
{
|
||||
"id": "047fcb7d-9080-4b45-9a6e-5060fa43f7c2",
|
||||
"name": "silentMode",
|
||||
"displayName": "Silent mode",
|
||||
"displayNameEvent": "Silent mode status changed",
|
||||
"type": "bool",
|
||||
"defaultValue": false,
|
||||
"suggestLogging": true
|
||||
},
|
||||
{
|
||||
"id": "d77a30d9-98f7-40ec-bc55-77c547f24145",
|
||||
"name": "power",
|
||||
"displayName": "Power",
|
||||
"displayNameEvent": "Power status changed",
|
||||
"type": "bool",
|
||||
"defaultValue": false,
|
||||
"suggestLogging": true
|
||||
},
|
||||
{
|
||||
"id": "798458bb-d38e-4028-880a-6dcba409a2f5",
|
||||
"name": "sgReadyActive",
|
||||
"displayName": "SG Ready enabled",
|
||||
"displayNameEvent": "SG Ready activation changed",
|
||||
"displayNameAction": "Switch SG Ready on/off",
|
||||
"type": "bool",
|
||||
"writable": true,
|
||||
"defaultValue": false,
|
||||
"suggestLogging": true
|
||||
},
|
||||
{
|
||||
"id": "7d474fb5-aa37-4f21-8166-b20f5bf84fb4",
|
||||
"name": "sgReadyMode",
|
||||
"displayName": "SG Ready mode",
|
||||
"displayNameEvent": "SG Ready mode changed",
|
||||
"displayNameAction": "Set SG Ready mode",
|
||||
"type": "QString",
|
||||
"possibleValues": [
|
||||
"Mode 1",
|
||||
"Mode 2",
|
||||
"Mode 3",
|
||||
"Mode 4"
|
||||
],
|
||||
"writable": true,
|
||||
"defaultValue": "Mode 3",
|
||||
"suggestLogging": true
|
||||
}
|
||||
],
|
||||
"actionTypes": [ ]
|
||||
|
||||
@ -1,19 +1,331 @@
|
||||
{
|
||||
"protocol": "TCP",
|
||||
"endianness": "BigEndian",
|
||||
"enums": [
|
||||
{
|
||||
"name": "OperatingMode",
|
||||
"values": [
|
||||
{
|
||||
"key": "Emergency",
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"key": "Standby",
|
||||
"value": 1
|
||||
},
|
||||
{
|
||||
"key": "Program",
|
||||
"value": 2
|
||||
},
|
||||
{
|
||||
"key": "Comfort",
|
||||
"value": 3
|
||||
},
|
||||
{
|
||||
"key": "Eco",
|
||||
"value": 4
|
||||
},
|
||||
{
|
||||
"key": "HotWater",
|
||||
"value": 5
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "SmartGridState",
|
||||
"values": [
|
||||
{
|
||||
"key": "ModeOne",
|
||||
"value": 1
|
||||
},
|
||||
{
|
||||
"key": "ModeTwo",
|
||||
"value": 2
|
||||
},
|
||||
{
|
||||
"key": "ModeThree",
|
||||
"value": 3
|
||||
},
|
||||
{
|
||||
"key": "ModeFour",
|
||||
"value": 4
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"registers": [
|
||||
{
|
||||
"id": "outdoorTemperature",
|
||||
"address": 507,
|
||||
"address": 506,
|
||||
"size": 1,
|
||||
"type": "int16",
|
||||
"registerType": "inputRegister",
|
||||
"readSchedule": "update",
|
||||
"description": "Outdoor temperature",
|
||||
"staticScaleFactor": -1,
|
||||
"defaultValue": 0,
|
||||
"unit": "°C",
|
||||
"access": "RO"
|
||||
},
|
||||
{
|
||||
"id": "flowTemperature",
|
||||
"address": 514,
|
||||
"size": 1,
|
||||
"type": "int16",
|
||||
"registerType": "inputRegister",
|
||||
"readSchedule": "update",
|
||||
"description": "Flow temperature",
|
||||
"staticScaleFactor": -1,
|
||||
"defaultValue": 0,
|
||||
"unit": "°C",
|
||||
"access": "RO"
|
||||
},
|
||||
{
|
||||
"id": "hotWaterTemperature",
|
||||
"address": 521,
|
||||
"size": 1,
|
||||
"type": "uint16",
|
||||
"registerType": "inputRegister",
|
||||
"readSchedule": "update",
|
||||
"description": "Hot water temperature",
|
||||
"staticScaleFactor": -1,
|
||||
"defaultValue": "0",
|
||||
"unit": "°C",
|
||||
"access": "RO"
|
||||
},
|
||||
{
|
||||
"id": "hotGasTemperature1",
|
||||
"address": 543,
|
||||
"size": 1,
|
||||
"type": "uint16",
|
||||
"registerType": "inputRegister",
|
||||
"readSchedule": "update",
|
||||
"description": "Hot gas temperature HP 1",
|
||||
"staticScaleFactor": -1,
|
||||
"defaultValue": "0",
|
||||
"unit": "°C",
|
||||
"access": "RO"
|
||||
},
|
||||
{
|
||||
"id": "hotGasTemperature2",
|
||||
"address": 550,
|
||||
"size": 1,
|
||||
"type": "uint16",
|
||||
"registerType": "inputRegister",
|
||||
"readSchedule": "update",
|
||||
"description": "Hot gas temperature HP 2",
|
||||
"staticScaleFactor": -1,
|
||||
"defaultValue": "0",
|
||||
"unit": "°C",
|
||||
"access": "RO"
|
||||
},
|
||||
{
|
||||
"id": "SourceTemperature",
|
||||
"address": 562,
|
||||
"size": 1,
|
||||
"type": "uint16",
|
||||
"registerType": "inputRegister",
|
||||
"readSchedule": "update",
|
||||
"description": "Source temperature",
|
||||
"staticScaleFactor": -1,
|
||||
"defaultValue": "0",
|
||||
"unit": "°C",
|
||||
"access": "RO"
|
||||
},
|
||||
{
|
||||
"id": "roomTemperatureFEK",
|
||||
"address": 502,
|
||||
"size": 1,
|
||||
"type": "uint16",
|
||||
"registerType": "inputRegister",
|
||||
"readSchedule": "update",
|
||||
"description": "Room temperature FEK",
|
||||
"staticScaleFactor": -1,
|
||||
"defaultValue": "0",
|
||||
"unit": "°C",
|
||||
"access": "RO"
|
||||
},
|
||||
{
|
||||
"id": "returnTemperature",
|
||||
"address": 515,
|
||||
"size": 1,
|
||||
"type": "int16",
|
||||
"registerType": "inputRegister",
|
||||
"readSchedule": "update",
|
||||
"description": "Return temperature",
|
||||
"staticScaleFactor": -1,
|
||||
"defaultValue": 0,
|
||||
"unit": "°C",
|
||||
"access": "RO"
|
||||
},
|
||||
{
|
||||
"id": "solarCollectorTemperature",
|
||||
"address": 527,
|
||||
"size": 1,
|
||||
"type": "uint16",
|
||||
"registerType": "inputRegister",
|
||||
"readSchedule": "update",
|
||||
"description": "Solar collector temperature",
|
||||
"staticScaleFactor": -1,
|
||||
"defaultValue": "0",
|
||||
"unit": "°C",
|
||||
"access": "RO"
|
||||
},
|
||||
{
|
||||
"id": "solarStorageTankTemperature",
|
||||
"address": 528,
|
||||
"size": 1,
|
||||
"type": "uint16",
|
||||
"registerType": "inputRegister",
|
||||
"readSchedule": "update",
|
||||
"description": "Solar storage tank temperature",
|
||||
"staticScaleFactor": -1,
|
||||
"defaultValue": "0",
|
||||
"unit": "°C",
|
||||
"access": "RO"
|
||||
},
|
||||
{
|
||||
"id": "storageTankTemperature",
|
||||
"address": 517,
|
||||
"size": 1,
|
||||
"type": "uint16",
|
||||
"registerType": "inputRegister",
|
||||
"readSchedule": "update",
|
||||
"description": "Storage tank temperature",
|
||||
"staticScaleFactor": -1,
|
||||
"defaultValue": "0",
|
||||
"unit": "°C",
|
||||
"access": "RO"
|
||||
},
|
||||
{
|
||||
"id": "externalHeatSourceTemperature",
|
||||
"address": 530,
|
||||
"size": 1,
|
||||
"type": "uint16",
|
||||
"registerType": "inputRegister",
|
||||
"readSchedule": "update",
|
||||
"description": "External heat source temperature",
|
||||
"staticScaleFactor": -1,
|
||||
"defaultValue": "0",
|
||||
"unit": "°C",
|
||||
"access": "RO"
|
||||
},
|
||||
{
|
||||
"id": "heatingEnergy",
|
||||
"address": 3501,
|
||||
"size": 2,
|
||||
"type": "uint32",
|
||||
"registerType": "inputRegister",
|
||||
"readSchedule": "update",
|
||||
"defaultValue": "0",
|
||||
"unit": "kWh",
|
||||
"description": "Heating energy",
|
||||
"access": "RO"
|
||||
},
|
||||
{
|
||||
"id": "hotWaterEnergy",
|
||||
"address": 3504,
|
||||
"size": 2,
|
||||
"type": "uint32",
|
||||
"registerType": "inputRegister",
|
||||
"readSchedule": "update",
|
||||
"defaultValue": "0",
|
||||
"unit": "kWh",
|
||||
"description": "Hot water energy",
|
||||
"access": "RO"
|
||||
},
|
||||
{
|
||||
"id": "consumedEnergyHeating",
|
||||
"address": 3511,
|
||||
"size": 2,
|
||||
"type": "uint32",
|
||||
"registerType": "inputRegister",
|
||||
"readSchedule": "update",
|
||||
"defaultValue": "0",
|
||||
"unit": "kWh",
|
||||
"description": "Consumed energy heating",
|
||||
"access": "RO"
|
||||
},
|
||||
{
|
||||
"id": "consumedEnergyHotWater",
|
||||
"address": 3514,
|
||||
"size": 2,
|
||||
"type": "uint32",
|
||||
"registerType": "inputRegister",
|
||||
"readSchedule": "update",
|
||||
"defaultValue": "0",
|
||||
"unit": "kWh",
|
||||
"description": "Consumed energy hot water",
|
||||
"access": "RO"
|
||||
},
|
||||
{
|
||||
"id": "operatingMode",
|
||||
"address": 1500,
|
||||
"size": 1,
|
||||
"type": "uint16",
|
||||
"enum": "OperatingMode",
|
||||
"registerType": "holdingRegister",
|
||||
"readSchedule": "update",
|
||||
"description": "Operating mode",
|
||||
"defaultValue": "OperatingModeStandby",
|
||||
"access": "RO"
|
||||
},
|
||||
{
|
||||
"id": "systemStatus",
|
||||
"address": 2500,
|
||||
"size": 1,
|
||||
"type": "uint16",
|
||||
"registerType": "inputRegister",
|
||||
"readSchedule": "update",
|
||||
"description": "System status",
|
||||
"defaultValue": 0,
|
||||
"access": "RO"
|
||||
},
|
||||
{
|
||||
"id": "sgReadyState",
|
||||
"address": 5000,
|
||||
"size": 1,
|
||||
"type": "uint16",
|
||||
"enum": "SmartGridState",
|
||||
"registerType": "inputRegister",
|
||||
"readSchedule": "update",
|
||||
"description": "Smart grid status",
|
||||
"defaultValue": "SmartGridStateModeTwo",
|
||||
"access": "RO"
|
||||
},
|
||||
{
|
||||
"id": "sgReadyActive",
|
||||
"address": 4000,
|
||||
"size": 1,
|
||||
"type": "uint16",
|
||||
"registerType": "holdingRegister",
|
||||
"readSchedule": "update",
|
||||
"description": "SG ready active",
|
||||
"defaultValue": 0,
|
||||
"access": "RW"
|
||||
},
|
||||
{
|
||||
"id": "sgReadyInputOne",
|
||||
"address": 4001,
|
||||
"size": 1,
|
||||
"type": "uint16",
|
||||
"registerType": "holdingRegister",
|
||||
"readSchedule": "update",
|
||||
"description": "SG Ready Input 1",
|
||||
"defaultValue": 0,
|
||||
"access": "RW"
|
||||
},
|
||||
{
|
||||
"id": "sgReadyInputTwo",
|
||||
"address": 4002,
|
||||
"size": 1,
|
||||
"type": "uint16",
|
||||
"registerType": "holdingRegister",
|
||||
"readSchedule": "update",
|
||||
"description": "SG Read Input 2",
|
||||
"defaultValue": 0,
|
||||
"access": "RW"
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -41,30 +41,219 @@ class StiebelEltronModbusConnection : public ModbusTCPMaster
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Registers {
|
||||
RegisterOutdoorTemperature = 507
|
||||
RegisterRoomTemperatureFEK = 502,
|
||||
RegisterOutdoorTemperature = 506,
|
||||
RegisterFlowTemperature = 514,
|
||||
RegisterReturnTemperature = 515,
|
||||
RegisterStorageTankTemperature = 517,
|
||||
RegisterHotWaterTemperature = 521,
|
||||
RegisterSolarCollectorTemperature = 527,
|
||||
RegisterSolarStorageTankTemperature = 528,
|
||||
RegisterExternalHeatSourceTemperature = 530,
|
||||
RegisterHotGasTemperature1 = 543,
|
||||
RegisterHotGasTemperature2 = 550,
|
||||
RegisterSourceTemperature = 562,
|
||||
RegisterOperatingMode = 1500,
|
||||
RegisterSystemStatus = 2500,
|
||||
RegisterHeatingEnergy = 3501,
|
||||
RegisterHotWaterEnergy = 3504,
|
||||
RegisterConsumedEnergyHeating = 3511,
|
||||
RegisterConsumedEnergyHotWater = 3514,
|
||||
RegisterSgReadyActive = 4000,
|
||||
RegisterSgReadyInputOne = 4001,
|
||||
RegisterSgReadyInputTwo = 4002,
|
||||
RegisterSgReadyState = 5000
|
||||
};
|
||||
Q_ENUM(Registers)
|
||||
|
||||
enum OperatingMode {
|
||||
OperatingModeEmergency = 0,
|
||||
OperatingModeStandby = 1,
|
||||
OperatingModeProgram = 2,
|
||||
OperatingModeComfort = 3,
|
||||
OperatingModeEco = 4,
|
||||
OperatingModeHotWater = 5
|
||||
};
|
||||
Q_ENUM(OperatingMode)
|
||||
|
||||
enum SmartGridState {
|
||||
SmartGridStateModeOne = 1,
|
||||
SmartGridStateModeTwo = 2,
|
||||
SmartGridStateModeThree = 3,
|
||||
SmartGridStateModeFour = 4
|
||||
};
|
||||
Q_ENUM(SmartGridState)
|
||||
|
||||
explicit StiebelEltronModbusConnection(const QHostAddress &hostAddress, uint port, quint16 slaveId, QObject *parent = nullptr);
|
||||
~StiebelEltronModbusConnection() = default;
|
||||
|
||||
/* Flow [°C] - Address: 507, Size: 1 */
|
||||
/* Outdoor temperature [°C] - Address: 506, Size: 1 */
|
||||
float outdoorTemperature() const;
|
||||
|
||||
/* Flow temperature [°C] - Address: 514, Size: 1 */
|
||||
float flowTemperature() const;
|
||||
|
||||
/* Hot water temperature [°C] - Address: 521, Size: 1 */
|
||||
float hotWaterTemperature() const;
|
||||
|
||||
/* Hot gas temperature HP 1 [°C] - Address: 543, Size: 1 */
|
||||
float hotGasTemperature1() const;
|
||||
|
||||
/* Hot gas temperature HP 2 [°C] - Address: 550, Size: 1 */
|
||||
float hotGasTemperature2() const;
|
||||
|
||||
/* Source temperature [°C] - Address: 562, Size: 1 */
|
||||
float SourceTemperature() const;
|
||||
|
||||
/* Room temperature FEK [°C] - Address: 502, Size: 1 */
|
||||
float roomTemperatureFEK() const;
|
||||
|
||||
/* Return temperature [°C] - Address: 515, Size: 1 */
|
||||
float returnTemperature() const;
|
||||
|
||||
/* Solar collector temperature [°C] - Address: 527, Size: 1 */
|
||||
float solarCollectorTemperature() const;
|
||||
|
||||
/* Solar storage tank temperature [°C] - Address: 528, Size: 1 */
|
||||
float solarStorageTankTemperature() const;
|
||||
|
||||
/* Storage tank temperature [°C] - Address: 517, Size: 1 */
|
||||
float storageTankTemperature() const;
|
||||
|
||||
/* External heat source temperature [°C] - Address: 530, Size: 1 */
|
||||
float externalHeatSourceTemperature() const;
|
||||
|
||||
/* Heating energy [kWh] - Address: 3501, Size: 2 */
|
||||
quint32 heatingEnergy() const;
|
||||
|
||||
/* Hot water energy [kWh] - Address: 3504, Size: 2 */
|
||||
quint32 hotWaterEnergy() const;
|
||||
|
||||
/* Consumed energy heating [kWh] - Address: 3511, Size: 2 */
|
||||
quint32 consumedEnergyHeating() const;
|
||||
|
||||
/* Consumed energy hot water [kWh] - Address: 3514, Size: 2 */
|
||||
quint32 consumedEnergyHotWater() const;
|
||||
|
||||
/* Operating mode - Address: 1500, Size: 1 */
|
||||
OperatingMode operatingMode() const;
|
||||
|
||||
/* System status - Address: 2500, Size: 1 */
|
||||
quint16 systemStatus() const;
|
||||
|
||||
/* Smart grid status - Address: 5000, Size: 1 */
|
||||
SmartGridState sgReadyState() const;
|
||||
|
||||
/* SG ready active - Address: 4000, Size: 1 */
|
||||
quint16 sgReadyActive() const;
|
||||
QModbusReply *setSgReadyActive(quint16 sgReadyActive);
|
||||
|
||||
/* SG Ready Input 1 - Address: 4001, Size: 1 */
|
||||
quint16 sgReadyInputOne() const;
|
||||
QModbusReply *setSgReadyInputOne(quint16 sgReadyInputOne);
|
||||
|
||||
/* SG Read Input 2 - Address: 4002, Size: 1 */
|
||||
quint16 sgReadyInputTwo() const;
|
||||
QModbusReply *setSgReadyInputTwo(quint16 sgReadyInputTwo);
|
||||
|
||||
virtual void initialize();
|
||||
virtual void update();
|
||||
|
||||
void updateOutdoorTemperature();
|
||||
void updateFlowTemperature();
|
||||
void updateHotWaterTemperature();
|
||||
void updateHotGasTemperature1();
|
||||
void updateHotGasTemperature2();
|
||||
void updateSourceTemperature();
|
||||
void updateRoomTemperatureFEK();
|
||||
void updateReturnTemperature();
|
||||
void updateSolarCollectorTemperature();
|
||||
void updateSolarStorageTankTemperature();
|
||||
void updateStorageTankTemperature();
|
||||
void updateExternalHeatSourceTemperature();
|
||||
void updateHeatingEnergy();
|
||||
void updateHotWaterEnergy();
|
||||
void updateConsumedEnergyHeating();
|
||||
void updateConsumedEnergyHotWater();
|
||||
void updateOperatingMode();
|
||||
void updateSystemStatus();
|
||||
void updateSgReadyState();
|
||||
void updateSgReadyActive();
|
||||
void updateSgReadyInputOne();
|
||||
void updateSgReadyInputTwo();
|
||||
|
||||
signals:
|
||||
void initializationFinished();
|
||||
|
||||
void outdoorTemperatureChanged(float outdoorTemperature);
|
||||
void flowTemperatureChanged(float flowTemperature);
|
||||
void hotWaterTemperatureChanged(float hotWaterTemperature);
|
||||
void hotGasTemperature1Changed(float hotGasTemperature1);
|
||||
void hotGasTemperature2Changed(float hotGasTemperature2);
|
||||
void SourceTemperatureChanged(float SourceTemperature);
|
||||
void roomTemperatureFEKChanged(float roomTemperatureFEK);
|
||||
void returnTemperatureChanged(float returnTemperature);
|
||||
void solarCollectorTemperatureChanged(float solarCollectorTemperature);
|
||||
void solarStorageTankTemperatureChanged(float solarStorageTankTemperature);
|
||||
void storageTankTemperatureChanged(float storageTankTemperature);
|
||||
void externalHeatSourceTemperatureChanged(float externalHeatSourceTemperature);
|
||||
void heatingEnergyChanged(quint32 heatingEnergy);
|
||||
void hotWaterEnergyChanged(quint32 hotWaterEnergy);
|
||||
void consumedEnergyHeatingChanged(quint32 consumedEnergyHeating);
|
||||
void consumedEnergyHotWaterChanged(quint32 consumedEnergyHotWater);
|
||||
void operatingModeChanged(OperatingMode operatingMode);
|
||||
void systemStatusChanged(quint16 systemStatus);
|
||||
void sgReadyStateChanged(SmartGridState sgReadyState);
|
||||
void sgReadyActiveChanged(quint16 sgReadyActive);
|
||||
void sgReadyInputOneChanged(quint16 sgReadyInputOne);
|
||||
void sgReadyInputTwoChanged(quint16 sgReadyInputTwo);
|
||||
|
||||
protected:
|
||||
QModbusReply *readOutdoorTemperature();
|
||||
QModbusReply *readFlowTemperature();
|
||||
QModbusReply *readHotWaterTemperature();
|
||||
QModbusReply *readHotGasTemperature1();
|
||||
QModbusReply *readHotGasTemperature2();
|
||||
QModbusReply *readSourceTemperature();
|
||||
QModbusReply *readRoomTemperatureFEK();
|
||||
QModbusReply *readReturnTemperature();
|
||||
QModbusReply *readSolarCollectorTemperature();
|
||||
QModbusReply *readSolarStorageTankTemperature();
|
||||
QModbusReply *readStorageTankTemperature();
|
||||
QModbusReply *readExternalHeatSourceTemperature();
|
||||
QModbusReply *readHeatingEnergy();
|
||||
QModbusReply *readHotWaterEnergy();
|
||||
QModbusReply *readConsumedEnergyHeating();
|
||||
QModbusReply *readConsumedEnergyHotWater();
|
||||
QModbusReply *readOperatingMode();
|
||||
QModbusReply *readSystemStatus();
|
||||
QModbusReply *readSgReadyState();
|
||||
QModbusReply *readSgReadyActive();
|
||||
QModbusReply *readSgReadyInputOne();
|
||||
QModbusReply *readSgReadyInputTwo();
|
||||
|
||||
float m_outdoorTemperature = 0;
|
||||
float m_flowTemperature = 0;
|
||||
float m_hotWaterTemperature = 0;
|
||||
float m_hotGasTemperature1 = 0;
|
||||
float m_hotGasTemperature2 = 0;
|
||||
float m_SourceTemperature = 0;
|
||||
float m_roomTemperatureFEK = 0;
|
||||
float m_returnTemperature = 0;
|
||||
float m_solarCollectorTemperature = 0;
|
||||
float m_solarStorageTankTemperature = 0;
|
||||
float m_storageTankTemperature = 0;
|
||||
float m_externalHeatSourceTemperature = 0;
|
||||
quint32 m_heatingEnergy = 0;
|
||||
quint32 m_hotWaterEnergy = 0;
|
||||
quint32 m_consumedEnergyHeating = 0;
|
||||
quint32 m_consumedEnergyHotWater = 0;
|
||||
OperatingMode m_operatingMode = OperatingModeStandby;
|
||||
quint16 m_systemStatus = 0;
|
||||
SmartGridState m_sgReadyState = SmartGridStateModeTwo;
|
||||
quint16 m_sgReadyActive = 0;
|
||||
quint16 m_sgReadyInputOne = 0;
|
||||
quint16 m_sgReadyInputTwo = 0;
|
||||
|
||||
private:
|
||||
quint16 m_slaveId = 1;
|
||||
@ -72,6 +261,7 @@ private:
|
||||
|
||||
void verifyInitFinished();
|
||||
|
||||
|
||||
};
|
||||
|
||||
QDebug operator<<(QDebug debug, StiebelEltronModbusConnection *stiebelEltronModbusConnection);
|
||||
|
||||
Reference in New Issue
Block a user