diff --git a/idm/README.md b/idm/README.md index 74a43f4..19b4cb2 100644 --- a/idm/README.md +++ b/idm/README.md @@ -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). - diff --git a/idm/integrationpluginidm.cpp b/idm/integrationpluginidm.cpp index 0fa74dc..b0efe1f 100644 --- a/idm/integrationpluginidm.cpp +++ b/idm/integrationpluginidm.cpp @@ -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) { diff --git a/idm/integrationpluginidm.h b/idm/integrationpluginidm.h index 6ce157e..e44f29d 100644 --- a/idm/integrationpluginidm.h +++ b/idm/integrationpluginidm.h @@ -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; diff --git a/idm/integrationpluginidm.json b/idm/integrationpluginidm.json index 0b68065..79617ff 100644 --- a/idm/integrationpluginidm.json +++ b/idm/integrationpluginidm.json @@ -12,7 +12,7 @@ "name": "navigator2", "displayName": "Navigator 2.0", "id": "1c95ac91-4eca-4cbf-b0f4-d60d35d069ed", - "createMethods": ["User"], + "createMethods": ["user"], "interfaces": ["temperaturesensor", "connectable"], "paramTypes": [ {