From 3d234c1efb884ae933b0f6736dca9c9673694c05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Wed, 23 Feb 2022 07:16:36 +0100 Subject: [PATCH] SunSpec: Remove Kostal sunspec connection in favor of custom modbus implementation --- sunspec/integrationpluginsunspec.cpp | 51 ++---------------------- sunspec/integrationpluginsunspec.json | 56 --------------------------- 2 files changed, 3 insertions(+), 104 deletions(-) diff --git a/sunspec/integrationpluginsunspec.cpp b/sunspec/integrationpluginsunspec.cpp index a6e2c0a..9eaea1d 100644 --- a/sunspec/integrationpluginsunspec.cpp +++ b/sunspec/integrationpluginsunspec.cpp @@ -70,25 +70,20 @@ void IntegrationPluginSunSpec::init() // SunSpec connection params m_connectionIpParamTypeIds.insert(sunspecConnectionThingClassId, sunspecConnectionThingIpAddressParamTypeId); m_connectionIpParamTypeIds.insert(solarEdgeConnectionThingClassId, solarEdgeConnectionThingIpAddressParamTypeId); - m_connectionIpParamTypeIds.insert(kostalConnectionThingClassId, kostalConnectionThingIpAddressParamTypeId); m_connectionPortParamTypeIds.insert(sunspecConnectionThingClassId, sunspecConnectionThingPortParamTypeId); m_connectionPortParamTypeIds.insert(solarEdgeConnectionThingClassId, solarEdgeConnectionThingPortParamTypeId); - m_connectionPortParamTypeIds.insert(kostalConnectionThingClassId, kostalConnectionThingPortParamTypeId); m_connectionMacAddressParamTypeIds.insert(sunspecConnectionThingClassId, sunspecConnectionThingMacAddressParamTypeId); m_connectionMacAddressParamTypeIds.insert(solarEdgeConnectionThingClassId, solarEdgeConnectionThingMacAddressParamTypeId); - m_connectionMacAddressParamTypeIds.insert(kostalConnectionThingClassId, kostalConnectionThingMacAddressParamTypeId); m_connectionSlaveIdParamTypeIds.insert(sunspecConnectionThingClassId, sunspecConnectionThingSlaveIdParamTypeId); m_connectionSlaveIdParamTypeIds.insert(solarEdgeConnectionThingClassId, solarEdgeConnectionThingSlaveIdParamTypeId); - m_connectionSlaveIdParamTypeIds.insert(kostalConnectionThingClassId, kostalConnectionThingSlaveIdParamTypeId); // Connected state for all things m_connectedStateTypeIds.insert(sunspecConnectionThingClassId, sunspecConnectionConnectedStateTypeId); m_connectedStateTypeIds.insert(solarEdgeConnectionThingClassId, solarEdgeConnectionConnectedStateTypeId); m_connectedStateTypeIds.insert(solarEdgeBatteryThingClassId, solarEdgeBatteryConnectedStateTypeId); - m_connectedStateTypeIds.insert(kostalConnectionThingClassId, kostalConnectionConnectedStateTypeId); // Child things m_connectedStateTypeIds.insert(sunspecStorageThingClassId, sunspecStorageConnectedStateTypeId); @@ -173,7 +168,6 @@ void IntegrationPluginSunSpec::discoverThings(ThingDiscoveryInfo *info) } } else { // Generic or not discoverable sunspec connection, show all network results - // - Kostal does not provide any usefull information for filtering in the discovery if (networkDeviceInfo.hostName().isEmpty()) { title += networkDeviceInfo.address().toString(); } else { @@ -218,8 +212,7 @@ void IntegrationPluginSunSpec::setupThing(ThingSetupInfo *info) qCDebug(dcSunSpec()) << thing->params(); if (thing->thingClassId() == sunspecConnectionThingClassId - || thing->thingClassId() == solarEdgeConnectionThingClassId - || thing->thingClassId() == kostalConnectionThingClassId) { + || thing->thingClassId() == solarEdgeConnectionThingClassId) { setupConnection(info); } else if (thing->thingClassId() == sunspecThreePhaseInverterThingClassId @@ -455,46 +448,8 @@ void IntegrationPluginSunSpec::processDiscoveryResult(Thing *thing, SunSpecConne { qCDebug(dcSunSpec()) << "Processing discovery result from" << thing->name() << connection; - // Note: from kostal devices is known, that they add inverter - // as normal and float version, but we need only one. - // Lets filter the duplicated information for kostal connections - if (thing->thingClassId() == kostalConnectionThingClassId) { - QHash filteredModels; - foreach (SunSpecModel *model, connection->models()) { - switch (model->modelId()) { - case SunSpecModelFactory::ModelIdInverterSinglePhaseFloat: - if (filteredModels.contains(SunSpecModelFactory::ModelIdInverterSinglePhase)) { - qCDebug(dcSunSpec()) << "Kostal: Filter out" << model; - } else { - filteredModels.insert(model->modelId(), model); - } - break; - case SunSpecModelFactory::ModelIdInverterSplitPhaseFloat: - if (filteredModels.contains(SunSpecModelFactory::ModelIdInverterSplitPhase)) { - qCDebug(dcSunSpec()) << "Kostal: Filter out" << model; - } else { - filteredModels.insert(model->modelId(), model); - } - break; - case SunSpecModelFactory::ModelIdInverterThreePhaseFloat: - if (filteredModels.contains(SunSpecModelFactory::ModelIdInverterThreePhase)) { - qCDebug(dcSunSpec()) << "Kostal: Filter out" << model; - } else { - filteredModels.insert(model->modelId(), model); - } - break; - default: - filteredModels.insert(model->modelId(), model); - break; - } - } - - // Process the filtered list - checkAutoSetupModels(thing, filteredModels.values()); - } else { - // Process all models - checkAutoSetupModels(thing, connection->models()); - } + // Process all models + checkAutoSetupModels(thing, connection->models()); } void IntegrationPluginSunSpec::checkAutoSetupModels(Thing *connectionThing, QList models) diff --git a/sunspec/integrationpluginsunspec.json b/sunspec/integrationpluginsunspec.json index e1d94e6..7da61c0 100644 --- a/sunspec/integrationpluginsunspec.json +++ b/sunspec/integrationpluginsunspec.json @@ -1674,62 +1674,6 @@ ] } ] - }, - { - "name": "kostal", - "displayName": "KOSTAL Solar Electric", - "id": "862d1ebf-cb78-4c55-89b2-819fddfd9acd", - "thingClasses": [ - { - "name": "kostalConnection", - "displayName": "Kostal SunSpec", - "id": "0cad2dca-66ac-489c-8443-074e32aa27a0", - "createMethods": [ "User", "Discovery" ], - "interfaces": ["gateway"], - "providedInterfaces": ["solarinverter", "energystorage"], - "paramTypes": [ - { - "id": "9fe10047-b2fd-460b-88ad-7f00977efc57", - "name":"ipAddress", - "displayName": "IP address", - "type": "QString", - "defaultValue": "127.0.0.1" - }, - { - "id": "047b048d-2e93-4129-80df-231688436da4", - "name":"macAddress", - "displayName": "MAC address", - "type": "QString", - "defaultValue": "00:00:00:00:00:00" - }, - { - "id": "bf87f540-ce2e-4c35-af62-942da7be2f80", - "name":"port", - "displayName": "Port", - "type": "int", - "defaultValue": 1502 - }, - { - "id": "48b133da-cce3-47f3-9c7c-470026af7829", - "name":"slaveId", - "displayName": "Slave ID", - "type": "int", - "defaultValue": 71 - } - ], - "stateTypes":[ - { - "id": "b9c52ae8-cb9b-4742-8e9a-450dce3a009f", - "name": "connected", - "displayName": "Connected", - "displayNameEvent": "Connected changed", - "type": "bool", - "defaultValue": false, - "cached": false - } - ] - } - ] } ] }