Removed discovery, fixed setup bug

pull/7/head
Boernsman 2021-02-02 15:43:42 +01:00 committed by Michael Zanetti
parent d78cf182a6
commit b36f91e34e
4 changed files with 17 additions and 31 deletions

View File

@ -1,15 +1,18 @@
# iDM
Connect nymea to iDM heat pumps.
## Supported Things
* Navigator 2.0 based heat pump models
## Requirements
* The package 'nymea-plugin-idm' must be installed
* Navigator 2.0 settings
* "Modbus TCP" must be selected in the "Building Management System" menu?
* Both devices must be in the same local area network.
## More
https://www.idm-energie.at/en/
** Modbus TCP communication not working **
* Is "Modbus TCP" selected in the "Building Management System" menu?
* Is the Modbus TCP device and the heat pump in the same network?
* Is there an IP address conflict?
* Has the heat pump set the IP address manually? IP address should be set manually, because with "DHCP" the IP address can change (e.g. after a power failure).
* Was the connection made via a switch, possibly blocking this communication? If so, integrate the Modbus TCP device directly (without a switch).

View File

@ -36,26 +36,6 @@ IntegrationPluginIdm::IntegrationPluginIdm()
}
void IntegrationPluginIdm::discoverThings(ThingDiscoveryInfo *info)
{
qCDebug(dcIdm()) << "discoverThings called";
if (info->thingClassId() == navigator2ThingClassId) {
// TODO Is a discovery method actually possible?
// The plugin has a parameter for the IP address
QString description = "Navigator 2";
ThingDescriptor descriptor(info->thingClassId(), "Idm", description);
info->addThingDescriptor(descriptor);
// Just report no error for now, until the above question
// is clarified
info->finish(Thing::ThingErrorNoError);
} else {
Q_ASSERT_X(false, "discoverThings", QString("Unhandled thingClassId: %1").arg(info->thingClassId().toString()).toUtf8());
}
}
void IntegrationPluginIdm::setupThing(ThingSetupInfo *info)
{
Thing *thing = info->thing();
@ -80,7 +60,6 @@ void IntegrationPluginIdm::setupThing(ThingSetupInfo *info)
/* Check, if address is already in use for another device */
Q_FOREACH (Idm *idm, m_idmConnections) {
if (hostAddress.isEqual(idm->getIdmAddress())) {
qCWarning(dcIdm()) << "Address already in use";
info->finish(Thing::ThingErrorSetupFailed, "IP address already in use");
return;
@ -90,6 +69,11 @@ void IntegrationPluginIdm::setupThing(ThingSetupInfo *info)
qCDebug(dcIdm()) << "Creating Idm object";
/* Create new Idm object and store it in hash table */
Idm *idm = new Idm(hostAddress, this);
if (idm->connectDevice()) {
qCWarning(dcIdm()) << "Could not connect to thing";
info->finish(Thing::ThingErrorHardwareNotAvailable);
return;
}
m_idmConnections.insert(thing, idm);
connect(idm, &Idm::statusUpdated, info, [info] (IdmInfo *idmInfo) {
if (idmInfo->connected) {

View File

@ -51,7 +51,6 @@ public:
/** Constructor */
explicit IntegrationPluginIdm();
void discoverThings(ThingDiscoveryInfo *info) override;
void setupThing(ThingSetupInfo *info) override;
void postSetupThing(Thing *thing) override;
void thingRemoved(Thing *thing) override;

View File

@ -12,7 +12,7 @@
"name": "navigator2",
"displayName": "Navigator 2.0",
"id": "1c95ac91-4eca-4cbf-b0f4-d60d35d069ed",
"createMethods": ["User"],
"createMethods": ["user"],
"interfaces": ["temperaturesensor", "connectable"],
"paramTypes": [
{