From b6865030c780c03484899f0ccd3a240bbfe721aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96rjan=20Backsell?= Date: Thu, 10 Oct 2024 11:51:43 +0200 Subject: [PATCH 01/16] [ferroamp] Binding for Ferroamp 20241010 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is the binding for local connection to the Ferroamp Energy System Signed-off-by: Örjan Backsell --- CODEOWNERS | 1 + bom/openhab-addons/pom.xml | 5 + bundles/org.openhab.binding.ferroamp/NOTICE | 13 + .../org.openhab.binding.ferroamp/README.md | 239 +++++ bundles/org.openhab.binding.ferroamp/pom.xml | 26 + .../src/main/feature/feature.xml | 16 + .../binding/ferroamp/dto/GetGeneralLx.java | 51 ++ .../ferroamp/dto/GetGeneralValues.java | 42 + .../openhab/binding/ferroamp/dto/GetUdc.java | 42 + .../ferroamp/internal/EhubJsonElements.java | 80 ++ .../ferroamp/internal/EhubParameters.java | 63 ++ .../ferroamp/internal/EsmJsonElements.java | 47 + .../ferroamp/internal/EsmParameters.java | 41 + .../ferroamp/internal/EsoJsonElements.java | 51 ++ .../ferroamp/internal/EsoParameters.java | 42 + .../internal/FerroampBindingConstants.java | 208 +++++ .../FerroampChannelConfiguration.java | 367 ++++++++ .../internal/FerroampConfiguration.java | 36 + .../ferroamp/internal/FerroampHandler.java | 278 ++++++ .../internal/FerroampHandlerFactory.java | 57 ++ .../internal/FerroampMqttCommunication.java | 821 ++++++++++++++++++ .../ferroamp/internal/SsoJsonElements.java | 49 ++ .../ferroamp/internal/SsoParameters.java | 49 ++ .../src/main/resources/OH-INF/addon/addon.xml | 11 + .../resources/OH-INF/i18n/ferroamp.properties | 459 ++++++++++ .../main/resources/OH-INF/thing/channels.xml | 101 +++ .../main/resources/OH-INF/thing/ferroamp.xml | 449 ++++++++++ .../resources/OH-INF/thing/thing-types.xml | 57 ++ bundles/pom.xml | 16 +- 29 files changed, 3703 insertions(+), 14 deletions(-) create mode 100644 bundles/org.openhab.binding.ferroamp/NOTICE create mode 100644 bundles/org.openhab.binding.ferroamp/README.md create mode 100644 bundles/org.openhab.binding.ferroamp/pom.xml create mode 100644 bundles/org.openhab.binding.ferroamp/src/main/feature/feature.xml create mode 100644 bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/dto/GetGeneralLx.java create mode 100644 bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/dto/GetGeneralValues.java create mode 100644 bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/dto/GetUdc.java create mode 100644 bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EhubJsonElements.java create mode 100644 bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EhubParameters.java create mode 100644 bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EsmJsonElements.java create mode 100644 bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EsmParameters.java create mode 100644 bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EsoJsonElements.java create mode 100644 bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EsoParameters.java create mode 100644 bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampBindingConstants.java create mode 100644 bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampChannelConfiguration.java create mode 100644 bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampConfiguration.java create mode 100644 bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java create mode 100644 bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandlerFactory.java create mode 100644 bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampMqttCommunication.java create mode 100644 bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/SsoJsonElements.java create mode 100644 bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/SsoParameters.java create mode 100644 bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/addon/addon.xml create mode 100644 bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/i18n/ferroamp.properties create mode 100644 bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/channels.xml create mode 100644 bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/ferroamp.xml create mode 100644 bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/thing-types.xml diff --git a/CODEOWNERS b/CODEOWNERS index ae0d5d1a3c958..375fc6affc81f 100755 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -114,6 +114,7 @@ /bundles/org.openhab.binding.feed/ @openhab/add-ons-maintainers /bundles/org.openhab.binding.feican/ @Hilbrand /bundles/org.openhab.binding.fenecon/ @nixoso +/bundles/org.openhab.binding.ferroamp/ @basse04 /bundles/org.openhab.binding.fineoffsetweatherstation/ @Andy2003 /bundles/org.openhab.binding.flicbutton/ @pfink /bundles/org.openhab.binding.fmiweather/ @ssalonen diff --git a/bom/openhab-addons/pom.xml b/bom/openhab-addons/pom.xml index 22b4e2b1f2f89..1a227395abdc1 100644 --- a/bom/openhab-addons/pom.xml +++ b/bom/openhab-addons/pom.xml @@ -556,6 +556,11 @@ org.openhab.binding.fenecon ${project.version} + + org.openhab.addons.bundles + org.openhab.binding.ferroamp + ${project.version} + org.openhab.addons.bundles org.openhab.binding.fineoffsetweatherstation diff --git a/bundles/org.openhab.binding.ferroamp/NOTICE b/bundles/org.openhab.binding.ferroamp/NOTICE new file mode 100644 index 0000000000000..38d625e349232 --- /dev/null +++ b/bundles/org.openhab.binding.ferroamp/NOTICE @@ -0,0 +1,13 @@ +This content is produced and maintained by the openHAB project. + +* Project home: https://www.openhab.org + +== Declared Project Licenses + +This program and the accompanying materials are made available under the terms +of the Eclipse Public License 2.0 which is available at +https://www.eclipse.org/legal/epl-2.0/. + +== Source Code + +https://github.com/openhab/openhab-addons diff --git a/bundles/org.openhab.binding.ferroamp/README.md b/bundles/org.openhab.binding.ferroamp/README.md new file mode 100644 index 0000000000000..396fb075e0f58 --- /dev/null +++ b/bundles/org.openhab.binding.ferroamp/README.md @@ -0,0 +1,239 @@ +## Ferroamp Binding + +The Ferroamp binding is used to get live data from Ferroamp EnergyHub + +The Ferroamp binding is compatible with EnergyHub Wall and EnergyHub XL, and use connection to your local EnergyHub via LAN or similar. +Data and commands are received/sent using MQTT where the user connects to the MQTT broker residing on the EnergyHub. + +Contact Ferroamp support to enable MQTT in the EnergyHub and to get the Username and Password: + +https://ferroamp.com/om-ferroamp/ + +## Supported Things + +The binding retrieves data from the different parts of the Ferroamp EnergyHub such as: + +- `Ehub`: EnergyHub Wall and EnergyHub XL. +- `Sso`: Solar string optimizer. +- `Eso`: Bidirectional DC/DC converter for connection of battery. +- `Esm`: Energy Storage Module. + +## Discovery + +Discovery is not supported. + +## Thing Configuration + +The following configuration-parameters are available. + +| Name | Type | Description | Default | Required | Advanced | +|-----------------|---------|------------------------------------------|---------|----------|----------| +| hostName | text | Hostname or IP address of the device | N/A | yes | no | +| userName | text | Username to access the device | N/A | yes | no | +| password | text | Password to access the device | N/A | yes | no | +| hasBattery | boolean | Is there a battery connected or not? | N/A | no | yes | +| ssoS0 | boolean | Is there a first SSO unit connected? | N/A | no | no | +| ssoS1 | boolean | Is there a second SSO unit connected? | N/A | no | no | +| ssoS2 | boolean | Is there a third SSO unit connected? | N/A | no | no | +| ssoS3 | boolean | Is there a fourth SSO unit connected? | N/A | no | no | + +| The unique serial number is marked on the side of the SSO unit. Ex. PS00990-A04-S20120476 + +## Channels + +| Channel Type ID | Item Type | Read/Write | Label | Description +|---------------------------------------------------------------------------------------------------------------------------------------------- +| grid-frequency | Number:Frequency | R | Estimated Grid Frequency | Estimated Grid Frequency | +| ace-current-l1 | Number:ElectricCurrent | R | ACE Current L1 | ACE equalization current set-points in Arms | +| ace-current-l2 | Number:ElectricCurrent | R | ACE Current L2 | ACE equalization current set-points in Arms | +| ace-current-l3 | Number:ElectricCurrent | R | ACE Current L3 | ACE equalization current set-points in Arms | +| external-voltage-l1 | Number:ElectricPotential | R | External Voltage L1 | External voltage | +| external-voltage-l2 | Number:ElectricPotential | R | External Voltage L2 | External voltage | +| external-voltage-l3 | Number:ElectricPotential | R | External Voltage L3 | External voltage | +| inverter-rms-current-l1 | Number:ElectricCurrent | R | Inverter RMS Current L1 | Inverter RMS current | +| inverter-rms-current-l2 | Number:ElectricCurrent | R | Inverter RMS Current L2 | Inverter RMS current | +| inverter-rms-current-l3 | Number:ElectricCurrent | R | Inverter RMS Current L3 | Inverter RMS current | +| inverter-current-reactive-l1 | Number:ElectricCurrent | R | Inverter Current Reactive L1 | Inverter reactive current | +| inverter-current-reactive-l2 | Number:ElectricCurrent | R | Inverter Current Reactive L2 | Inverter reactive current | +| inverter-current-reactive-l3 | Number:ElectricCurrent | R | Inverter Current Reactive L3 | Inverter reactive current | +| inverter-current-active-l1 | Number:ElectricCurrent | R | Inverter Active current L1 | Inverter active current | +| inverter-current-active-l2 | Number:ElectricCurrent | R | Inverter Active current L1 | Inverter active current | +| inverter-current-active-l3 | Number:ElectricCurrent | R | Inverter Active current L1 | Inverter active current | +| grid-current-l1 | Number:ElectricCurrent | R | Grid Current L1 | External/grid RMS current | +| grid-current-l2 | Number:ElectricCurrent | R | Grid Current L2 | External/grid RMS current | +| grid-current-l3 | Number:ElectricCurrent | R | Grid Current L3 | External/grid RMS current | +| grid-current-reactive-l1 | Number:ElectricCurrent | R | Grid Current Reactive L1 | External/grid current reactive | +| grid-current-reactive-l2 | Number:ElectricCurrent | R | Grid Current Reactive L2 | External/grid current reactive | +| grid-current-reactive-l3 | Number:ElectricCurrent | R | Grid Current Reactive L3 | External/grid current reactive | +| grid-current-active-l1 | Number:ElectricCurrent | R | Grid Current Active L1 | External/grid current active | +| grid-current-active-l2 | Number:ElectricCurrent | R | Grid Current Active L2 | External/grid current active | +| grid-current-active-l3 | Number:ElectricCurrent | R | Grid Current Active L3 | External/grid current active | +| inverter-reactive-current-l1 | Number:ElectricCurrent | R | Inverter Reactive Current L1 | +| inverter-reactive-current-l2 | Number:ElectricCurrent | R | Inverter Reactive Current L2 | +| inverter-reactive-current-l3 | Number:ElectricCurrent | R | Inverter Reactive Current L3 | +| inverter-load-l1 | Number:ElectricCurrent | R | Inverter Load L1 | +| inverter-load-l2 | Number:ElectricCurrent | R | Inverter Load L2 | +| inverter-load-l3 | Number:ElectricCurrent | R | Inverter Load L3 | +| apparent-power | Number:Energy | R | Apparent Power | Apparent power +| grid-power-active-l1 | Number:Power | R | Grid Power Active L1 | External/grid power, active | +| grid-power-active-l2 | Number:Power | R | Grid Power Active L2 | External/grid power, active | +| grid-power-active-l3 | Number:Power | R | Grid Power Active L3 | External/grid power, active | +| grid-power-reactive-l1 | Number:Power | R | Grid Power Reactive L1 | External/grid power, reactive | +| grid-power-reactive-l2 | Number:Power | R | Grid Power Reactive L2 | External/grid power, reactive | +| grid-power-reactive-l3 | Number:Power | R | Grid Power Reactive L3 | External/grid power, reactive | +| inverter-power-active-l1 | Number:Power | R | Inverter Power Active L1 | Inverter power, active | +| inverter-power-active-l2 | Number:Power | R | Inverter Power Active L2 | Inverter power, active | +| inverter-power-active-l3 | Number:Power | R | Inverter Power Active L3 | Inverter power, active | +| inverter-power-reactive-l1 | Number:Power | R | Inverter Power Reactive L1 | Inverter power, reactive | +| inverter-power-reactive-l1 | Number:Power | R | Inverter Power Reactive L2 | Inverter power, reactive | +| inverter-power-reactive-l1 | Number:Power | R | Inverter Power Reactive L3 | Inverter power, reactive | +| consumption-power-l1 | Number:Power | R | Consumption Power L1 | +| consumption-power-l2 | Number:Power | R | Consumption Power L2 | +| consumption-power-l3 | Number:Power | R | Consumption Power L3 | +| consumption-power-reactive-l1 | Number:Power | R | Consumption Power Reactive L1 | +| consumption-power-reactive-l2 | Number:Power | R | Consumption Power Reactive L2 | +| consumption-power-reactive-l3 | Number:Power | R | Consumption Power Reactive L3 | +| solar-pv | Number:Power | R | Solar Power | Only sent when system has PV | +| positive-dc-link-voltage | Number:ElectricPotential | R | Positiv DC Link Voltage | Positiv DC link voltage | +| negative-dc-link-voltage | Number:ElectricPotential | R | Negative DC Link Voltage | Negative DC link voltage | +| external-energy-produced-l1 | Number:Energy | R | External Energy Produced L1 | +| external-energy-produced-l2 | Number:Energy | R | External Energy Produced L2 | +| external-energy-produced-l3 | Number:Energy | R | External Energy Produced L3 | +| external-energy-consumed-l1 | Number:Energy | R | External Energy Consumed L1 | +| external-energy-consumed-l2 | Number:Energy | R | External Energy Consumed L2 | +| external-energy-consumed-l3 | Number:Energy | R | External Energy Consumed L3 | +| inverter-energy-produced-l1 | Number:Energy | R | Inverter Energy Produced L1 | +| inverter-energy-produced-l2 | Number:Energy | R | Inverter Energy Produced L2 | +| inverter-energy-produced-l3 | Number:Energy | R | Inverter Energy Produced L3 | +| inverter-energy-consumed-l1 | Number:ElectricCurrent | R | Inverter Energy Consumed L1 | +| inverter-energy-consumed-l2 | Number:ElectricCurrent | R | Inverter Energy Consumed L2 | +| inverter-energy-consumed-l3 | Number:ElectricCurrent | R | Inverter Energy Consumed L3 | +| load-energy-produced-l1 | Number:Energy | R | Load Energy Produced L1 | +| load-energy-produced-l2 | Number:Energy | R | Load Energy Produced L2 | +| load-energy-produced-l3 | Number:Energy | R | Load Energy Produced L3 | +| load-energy-consumed-l1 | Number:Energy | R | Load Energy Consumed L1 | +| load-energy-consumed-l2 | Number:Energy | R | Load Energy Consumed L2 | +| load-energy-consumed-l3 | Number:Energy | R | Load Energy Consumed L3 | +| external-energy-produced-3p | Number:Energy | R | External Energy Produced 3P | +| external-energy-consumed-3p | Number:Energy | R | External Energy Consumed 3P | +| inverter-energy-produced-3p | Number:Energy | R | Inverter Energy Produced 3P | +| inverter-energy-consumed-3p | Number:Energy | R | Inverter Energy Consumed 3P | +| load-energy-produced-3p | Number:Energy | R | Load Energy Produced 3P | +| load-energy-consumed-3p | Number:Energy | R | Load Energy Consumed 3P | +| total-solar-energy | Number:Energy | R | Total Solar Energy | Only sent when system has PV | +| state | String | R | State of the System | +| timestamp | DateTime | R | Time Stamp When Message was Published | Time stamp when message was published | +| battery-energy-produced | Number:Energy | R | Battery Energy Produced | Only sent when system has batteries | +| battery-energy-consumed | Number:Energy | R | Battery Energy Consumed | Only sent when system has batteries | +| soc | Number:Dimensionless | R | System State of Check | State of the system | +| soh | Number:Dimensionless | R | System State of Health | +| power-battery | Number:Power | R | Battery Power | Only sent when system has batteries | +| total-rated-capacity-all-batteries | Number:Energy | R | Total Rated Capacity of All Batteries | + +| s0-id | String | R | S0 ID | Unique identifier of SSO-0 | +| s0-measured-voltage-on-pv-string-side | Number:ElectricPotential | R | S0 Measured Voltage on PV String Side | Measured on PV string side | +| s0-measured-current-on-pv-string-side | Number:ElectricCurrent | R | S0 Measured Current on PV String Side | Measured on PV string side | +| s0-total-solar-energy | Number:Energy | R | S0 Total Solar Energy | Total energy produced by SSO-0 | +| s0-relay-status | String | R | S0 Relay Status | 0 = relay closed (i.e running power), 1 = relay open/disconnected, 2 = precharge | +| s0-temperature | Number:Temperature | R | S0 Temperature Measured on PCB | Temperature Measured on PCB | +| s0-fault-code | String | R | S0 FaultCode | 0x00 = OK. For all other values Please contact Ferroamp support | +| s0-dc-link-voltage | Number:ElectricPotential | R | S0 DC Link Voltage | DC link voltage as measured by SSO-0 | +| s0-timestamp | DateTime | R | S0 Time Stamp When Message was Published | Time stamp when message was published | + | +| s1-id | String | R | S1 ID | Unique identifier of SSO-1 | +| s1-measured-voltage-on-pv-string-side | Number:ElectricPotential | R | S1 easured Voltage on PV String Side | Measured on PV string side | +| s1-measured-current-on-pv-string-side | Number:ElectricCurrent | R | S1 Measured Current on PV String Side | Measured on PV string side | +| s1-total-solar-energy | Number:Energy | R | S1 Total Solar Energy | Total energy produced by SSO-1 | +| s1-relay-status | String | R | S1 Relay Status | 0 = relay closed (i.e running power), 1 = relay open/disconnected, 2 = precharge | +| s1-temperature | Number:Temperature | R | S1 Temperature Measured on PCB | Temperature Measured on PCB | +| s1-fault-code | String | R | S1 FaultCode | 0x00 = OK. For all other values Please contact Ferroamp support | +| s1-dc-link-voltage | Number:ElectricPotential | R | S1 DC Link Voltage | DC link voltage as measured by SSO-1 | +| s1-timestamp | DateTime | R | S1 Time Stamp When Message was Published | Time stamp when message was published | + | + +| s2-id | String | R | S2 ID | Unique identifier of SSO-2 | +| s2-measured-voltage-on-pv-string-side | Number:ElectricPotential | R | S2 Measured Voltage on PV String Side | Measured on PV string side | +| s2-measured-current-on-pv-string-side | Number:ElectricCurrent | R | S2 Measured Current on PV String Side | Measured on PV string side | +| s2-total-solar-energy | Number:Energy | R | S2 Total Solar Energy | Total energy produced by SSO-2 | +| s2-relay-status | String | R | S2 Relay Status | 0 = relay closed (i.e running power), 1 = relay open/disconnected, 2 = precharge | +| s2-temperature | Number:Temperature | R | S2 Temperature Measured on PCB | Temperature Measured on PCB | +| s2-fault-code | String | R | S2 FaultCode | 0x00 = OK. For all other values Please contact Ferroamp support | +| s2-dc-link-voltage | Number:ElectricPotential | R | S2 DC Link Voltage | DC link voltage as measured by SSO-2 | +| s2-timestamp | DateTime | R | S2 Time Stamp When Message was Published | Time stamp when message was published | + | + +| s3-id | String | R | S3 ID | Unique identifier of SSO-3 | +| s3-measured-voltage-on-pv-string-side | Number:ElectricPotential | R | S3 Measured Voltage on PV String Side | Measured on PV string side | +| s3-measured-current-on-pv-string-side | Number:ElectricCurrent | R | S3 Measured Current on PV String Side | Measured on PV string side | +| s3-total-solar-energy | Number:Energy | R | S3 Total Solar Energy | Total energy produced by SSO-3 | +| s3-relay-status | String | R | S3 Relay Status | 0 = relay closed (i.e running power), 1 = relay open/disconnected, 2 = precharge | +| s3-temperature | Number:Temperature | R | S3 Temperature Measured on PCB | Temperature Measured on PCB | +| s3-fault-code | String | R | S3 FaultCode | 0x00 = OK. For all other values Please contact Ferroamp support | +| s3-dc-link-voltage | Number:ElectricPotential | R | S3 DC Link Voltage | DC link voltage as measured by SSO-3 | +| s3-timestamp | DateTime | R | S3 Time Stamp When Message was Published | Time stamp when message was published | + | + +| eso-unique-identifier | String | R | Eso Unique Identifier | Unique identifier | +| measured-voltage-battery | Number:ElectricPotential | R | Eso Voltage Measured on Battery Side | Measured on battery side | +| measured-current-battery | Number:ElectricCurrent | R | Eso Current Measured on Battery Side | Measured on battery side | +| eso-battery-energy-produced | Number:Energy | R | Eso Battery Energy Produced | Total energy produced by ESO, i.e total energy charged | +| eso-battery-energy-consumed | Number:Energy | R | Eso Battery Energy Consumed | Total energy consumed by ESO, i.e total energy discharged | +| eso-soc | Number:Dimensionless | R | Eso State of Charge | State of Charge for ESO | +| eso-relay-status | String | R | Eso Relay Status | 0 = relay closed, 1 = relay open | +| eso-temperature | Number:Temperature | R | Eso Temperature Measured on PCB | Measured inside ESO | +| eso-fault-code | String | R | Eso FaultCode | See section 4.1.3.1 in Ferroamp-External-API-specifikation | +| eso-battery-energy-produced | Number:Energy | R | Eso Battery Energy Produced | Total energy produced by ESO, i.e total energy charged | +| eso-dc-link-voltage | Number:ElectricPotential | R | Eso Dc Link Voltage | DC link voltage as measured by ESO | +| eso-timestamp | DateTime | R | Eso Time Stamp When Message was Published| Time stamp when message was published | + + +| esm-unique-identifier | String | R | Esm Unique Identifier | Unique identifier of battery. If available, this will be the unique id that the battery reports.| +| esm-soh | Number:Dimensionless | R | Esm System State of Health | State of Health for ESM | +| esm-soc | Number:Dimensionless | R | Esm System State of Charge | State of Charge for ESM | +| esm-total-rated-capacity-all-batteries | Number:Energy | R | Esm Rated Capacity | Rated capacity of battery | +| esm-rated-power-battery | Number:Power | R | Esm Rated power of battery | Rated power of battery | +| esm-status | String | R | Esm Status | Dependent on battery manufacturer | +| esm-timestamp | DateTime | R | Esm Time Stamp When Message was Published| Time stamp when message was published | + +The following channels are available for `Ferroamp` EnergyHub configuration. Please, see Ferroamp documentation for more details. + +| Channel Type ID | Item Type | Read/Write | Description | +|---------------------------------------------------|------------|------------------------------------------| +| request-charge | String | W | Set charge power, value in Watt | +| request-discharge | String | W | Set discharge power, value in Watt | +| request-auto | String | W | Set auto power. Returning control of batteries to system, value as auto.| + +# Full Example + +## Thing + +```java +Thing ferroamp:energyhub:myenergyhub [ hostName="energyhub-ip", userName="myUserName", password="myPassword", hasBattery=false ] +``` + +## Items + +```java +Number:Energy Ferroamp "Load Energy Consumed L1" { channel="ferroamp:energyhub:myenergyhub:load-energy-consumed-l1" } +String Ferroamp "RequestCharge" { channel="ferroamp:energyhub:myenergyhub:request-charge" } +``` + +## Rules + +Ex. Set Charging with 5000W with cron trigger: + +```yaml +triggers: + id: "1" + configuration: + cronExpression: 0 0/2 * * * ? * + type: timer.GenericCronTrigger +conditions: [] +actions: + inputs: {} + id: "2" + configuration: + type: application/vnd.openhab.dsl.rule + script: ChargingWith5000W.sendCommand("5000") + type: script.ScriptAction +``` diff --git a/bundles/org.openhab.binding.ferroamp/pom.xml b/bundles/org.openhab.binding.ferroamp/pom.xml new file mode 100644 index 0000000000000..e1c48f50acee8 --- /dev/null +++ b/bundles/org.openhab.binding.ferroamp/pom.xml @@ -0,0 +1,26 @@ + + + + 4.0.0 + + + org.openhab.addons.bundles + org.openhab.addons.reactor.bundles + 4.3.0-SNAPSHOT + + + org.openhab.binding.ferroamp + + openHAB Add-ons :: Bundles :: Ferroamp Binding + + + + org.openhab.addons.bundles + org.openhab.binding.mqtt + ${project.version} + provided + + + + diff --git a/bundles/org.openhab.binding.ferroamp/src/main/feature/feature.xml b/bundles/org.openhab.binding.ferroamp/src/main/feature/feature.xml new file mode 100644 index 0000000000000..bca67f9098228 --- /dev/null +++ b/bundles/org.openhab.binding.ferroamp/src/main/feature/feature.xml @@ -0,0 +1,16 @@ + + + mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${ohc.version}/xml/features + + + openhab-runtime-base + openhab-transport-mqtt + mvn:org.openhab.addons.bundles/org.openhab.binding.mqtt/${project.version} + + mvn:org.openhab.addons.bundles/org.openhab.binding.mqtt/${project.version} + mvn:org.openhab.addons.bundles/org.openhab.binding.ferroamp/${project.version} + + + + + diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/dto/GetGeneralLx.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/dto/GetGeneralLx.java new file mode 100644 index 0000000000000..f7fee0bf438a7 --- /dev/null +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/dto/GetGeneralLx.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) 2010-2024 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ + +package org.openhab.binding.ferroamp.dto; + +/** + * The {@link GetGeneralLx} is responsible for parsing of Lx parts of received MQTT messages. + * + * @author Örjan Backsell - Initial contribution + * + */ + +public class GetGeneralLx { + private String L1; + private String L2; + private String L3; + + public void setL1(String L1) { + this.L1 = L1; + } + + public String getL1() { + return L1; + } + + public void setL2(String L2) { + this.L2 = L2; + } + + public String getL2() { + return L2; + } + + public void setL3(String L3) { + this.L3 = L3; + } + + public String getL3() { + return L3; + } +} diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/dto/GetGeneralValues.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/dto/GetGeneralValues.java new file mode 100644 index 0000000000000..0b87f3d4e21a3 --- /dev/null +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/dto/GetGeneralValues.java @@ -0,0 +1,42 @@ +/** + * Copyright (c) 2010-2024 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ + +package org.openhab.binding.ferroamp.dto; + +/** + * The {@link GetGeneralValLx} is responsible for parsing of value parts of received MQTT messages. + * + * @author Örjan Backsell - Initial contribution + * + */ + +public class GetGeneralValues { + private String name; + private String val; + + public void setName(String name) { + this.name = name; + } + + public void setVal(String val) { + this.val = val; + } + + public String getName() { + return name; + } + + public String getVal() { + return val; + } +} diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/dto/GetUdc.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/dto/GetUdc.java new file mode 100644 index 0000000000000..150419411495f --- /dev/null +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/dto/GetUdc.java @@ -0,0 +1,42 @@ +/** + * Copyright (c) 2010-2024 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ + +package org.openhab.binding.ferroamp.dto; + +/** + * The {@link GetUdc} is responsible for parsing of Udc part of received MQTT messages. + * + * @author Örjan Backsell - Initial contribution + * + */ + +public class GetUdc { + private String pos; + private String neg; + + public void setPos(String pos) { + this.pos = pos; + } + + public String getPos() { + return pos; + } + + public void setNeg(String neg) { + this.neg = neg; + } + + public String getNeg() { + return neg; + } +} \ No newline at end of file diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EhubJsonElements.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EhubJsonElements.java new file mode 100644 index 0000000000000..d3cb78daf4fef --- /dev/null +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EhubJsonElements.java @@ -0,0 +1,80 @@ +/** + * Copyright (c) 2010-2024 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.ferroamp.internal; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.jdt.annotation.NonNullByDefault; + +/** + * The {@link EhubParameters} is responsible for all parameters regarded to EHUB + * + * @author Örjan Backsell - Initial contribution + * + */ + +@NonNullByDefault +public class EhubJsonElements { + public String ehubJsonElements; + + public EhubJsonElements(String ehubJsonElements) { + this.ehubJsonElements = ehubJsonElements; + } + + public static List getJsonElementsEhub() { + final List jsonElementsEhub = new ArrayList<>(); + jsonElementsEhub.add(new String("gridfreq")); + jsonElementsEhub.add(new String("iace")); + jsonElementsEhub.add(new String("ul")); + jsonElementsEhub.add(new String("il")); + jsonElementsEhub.add(new String("ild")); + jsonElementsEhub.add(new String("ilq")); + jsonElementsEhub.add(new String("iext")); + jsonElementsEhub.add(new String("iextd")); + jsonElementsEhub.add(new String("iextq")); + jsonElementsEhub.add(new String("iloadd")); + jsonElementsEhub.add(new String("iloadq")); + jsonElementsEhub.add(new String("sext")); + jsonElementsEhub.add(new String("pext")); + jsonElementsEhub.add(new String("pextreactive")); + jsonElementsEhub.add(new String("pinv")); + jsonElementsEhub.add(new String("pinvreactive")); + jsonElementsEhub.add(new String("pload")); + jsonElementsEhub.add(new String("ploadreactive")); + jsonElementsEhub.add(new String("ppv")); + jsonElementsEhub.add(new String("udc")); + jsonElementsEhub.add(new String("wextprodq")); + jsonElementsEhub.add(new String("wextconsq")); + jsonElementsEhub.add(new String("winvprodq")); + jsonElementsEhub.add(new String("winvconsq")); + jsonElementsEhub.add(new String("wloadprodq")); + jsonElementsEhub.add(new String("wloadconsq")); + jsonElementsEhub.add(new String("wextprodq_3p")); + jsonElementsEhub.add(new String("wextconsq_3p")); + jsonElementsEhub.add(new String("winvprodq_3p")); + jsonElementsEhub.add(new String("winvconsq_3p")); + jsonElementsEhub.add(new String("wloadprodq_3p")); + jsonElementsEhub.add(new String("wloadconsq_3p")); + jsonElementsEhub.add(new String("wpv")); + jsonElementsEhub.add(new String("state")); + jsonElementsEhub.add(new String("ts")); + jsonElementsEhub.add(new String("wbatprod")); + jsonElementsEhub.add(new String("wpbatcons")); + jsonElementsEhub.add(new String("soc")); + jsonElementsEhub.add(new String("soh")); + jsonElementsEhub.add(new String("pbat")); + jsonElementsEhub.add(new String("ratedcap")); + return jsonElementsEhub; + } +} diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EhubParameters.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EhubParameters.java new file mode 100644 index 0000000000000..cfe5d30251833 --- /dev/null +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EhubParameters.java @@ -0,0 +1,63 @@ +/** + * Copyright (c) 2010-2024 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.ferroamp.internal; + +import java.util.Arrays; +import java.util.List; + +import org.eclipse.jdt.annotation.NonNullByDefault; + +/** + * The {@link EhubParameters} is responsible for all parameters regarded to EHUB + * + * @author Örjan Backsell - Initial contribution + * + */ + +@NonNullByDefault +public class EhubParameters { + public String jsonPostEhub; + + public EhubParameters(String jsonPostEhub) { + this.jsonPostEhub = jsonPostEhub; + } + + public static List getChannelParametersEhub() { + final List channelParametersEhub = Arrays.asList("grid-frequency", "ace-current-l1", "ace-current-l2", + "ace-current-l3", "external-voltage-l1", "external-voltage-l2", "external-voltage-l3", + "inverter-rms-current-l1", "inverter-rms-current-l2", "inverter-rms-current-l3", + "inverter-current-reactive-l1", "inverter-current-reactive-l2", "inverter-current-reactive-l3", + "inverter-current-active-l1", "inverter-current-active-l2", "inverter-current-active-l3", + "grid-current-l1", "grid-current-l2", "grid-current-l3", "grid-current-reactive-l1", + "grid-current-reactive-l2", "grid-current-reactive-l3", "grid-current-active-l1", + "grid-current-active-l2", "grid-current-active-l3", "inverter-load-l1", "inverter-load-l2", + "inverter-load-l3", "apparent-power", "grid-power-active-l1", "grid-power-active-l2", + "grid-power-active-l3", "grid-power-reactive-l1", "grid-power-reactive-l2", "grid-power-reactive-l3", + "inverter-power-active-l1", "inverter-power-active-l2", "inverter-power-active-l3", + "inverter-power-reactive-l1", "inverter-power-reactive-l2", "inverter-power-reactive-l3", + "consumption-power-l1", "consumption-power-l2", "consumption-power-l3", "consumption-power-reactive-l1", + "consumption-power-reactive-l2", "consumption-power-reactive-l3", "solar-pv", + "positive-dc-link-voltage", "negative-dc-link-voltage", "external-energy-produced-l1", + "external-energy-produced-l2", "external-energy-produced-l3", "external-energy-consumed-l1", + "external-energy-consumed-l2", "external-energy-consumed-l3", "inverter-energy-produced-l1", + "inverter-energy-produced-l2", "inverter-energy-produced-l3", "inverter-energy-consumed-l1", + "inverter-energy-consumed-l2", "inverter-energy-consumed-l3", "load-energy-produced-l1", + "load-energy-produced-l2", "load-energy-produced-l3", "load-energy-consumed-l1", + "load-energy-consumed-l2", "load-energy-consumed-l3", "external-energy-produced-3p", + "external-energy-consumed-3p", "inverter-energy-produced-3p", "inverter-energy-consumed-3p", + "load-energy-produced-3p", "load-energy-consumed-3p", "total-solar-energy", "state", "timestamp", + "battery-energy-produced", "battery-energy-consumed", "soc", "soh", "power-battery", + "total-rated-capacity-all-batteries"); + return channelParametersEhub; + } +} diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EsmJsonElements.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EsmJsonElements.java new file mode 100644 index 0000000000000..7cf27958f81f4 --- /dev/null +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EsmJsonElements.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) 2010-2024 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ + +package org.openhab.binding.ferroamp.internal; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.jdt.annotation.NonNullByDefault; + +/** + * The {@link EhubParameters} is responsible for all parameters regarded to EHUB + * + * @author Örjan Backsell - Initial contribution + * + */ + +@NonNullByDefault +public class EsmJsonElements { + public String esmJsonElements; + + public EsmJsonElements(String esmJsonElements) { + this.esmJsonElements = esmJsonElements; + } + + public static List getJsonElementsEsm() { + final List jsonElementsEsm = new ArrayList<>(); + jsonElementsEsm.add(new String("id")); + jsonElementsEsm.add(new String("soh")); + jsonElementsEsm.add(new String("soc")); + jsonElementsEsm.add(new String("ratedcapacity")); + jsonElementsEsm.add(new String("ratedpower")); + jsonElementsEsm.add(new String("status")); + jsonElementsEsm.add(new String("ts")); + return jsonElementsEsm; + } +} \ No newline at end of file diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EsmParameters.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EsmParameters.java new file mode 100644 index 0000000000000..ac2b60587312d --- /dev/null +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EsmParameters.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) 2010-2024 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ + +package org.openhab.binding.ferroamp.internal; + +import java.util.Arrays; +import java.util.List; + +import org.eclipse.jdt.annotation.NonNullByDefault; + +/** + * The {@link EsmParameters} is responsible for all parameters regarded to ESM + * + * @author Örjan Backsell - Initial contribution + * + */ + +@NonNullByDefault +public class EsmParameters { + public String jsonPostEsm; + + public EsmParameters(String jsonPostEsm) { + this.jsonPostEsm = jsonPostEsm; + } + + public static List getChannelParametersEsm() { + final List channelParametersEsm = Arrays.asList("esm-unique-identifier", "esm-soh", "esm-soc", + "esm-total-rated-capacity-all-batteries", "esm-rated-power-battery", "esm-status", "esm-timestamp"); + return channelParametersEsm; + } +} diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EsoJsonElements.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EsoJsonElements.java new file mode 100644 index 0000000000000..6468f8bc7c831 --- /dev/null +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EsoJsonElements.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) 2010-2024 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.ferroamp.internal; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.jdt.annotation.NonNullByDefault; + +/** + * The {@link EhubParameters} is responsible for all parameters regarded to EHUB + * + * @author Örjan Backsell - Initial contribution + * + */ + +@NonNullByDefault +public class EsoJsonElements { + public String esoJsonElements; + + public EsoJsonElements(String esoJsonElements) { + this.esoJsonElements = esoJsonElements; + } + + public static List getJsonElementsEso() { + final List jsonElementsEso = new ArrayList<>(); + jsonElementsEso.add(new String("id")); + jsonElementsEso.add(new String("ubat")); + jsonElementsEso.add(new String("ibat")); + jsonElementsEso.add(new String("wbatprod")); + jsonElementsEso.add(new String("wbatcons")); + jsonElementsEso.add(new String("soc")); + jsonElementsEso.add(new String("relaystatus")); + jsonElementsEso.add(new String("temp")); + jsonElementsEso.add(new String("faultcode")); + jsonElementsEso.add(new String("udc")); + jsonElementsEso.add(new String("ts")); + + return jsonElementsEso; + } +} diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EsoParameters.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EsoParameters.java new file mode 100644 index 0000000000000..844b67f7b447d --- /dev/null +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EsoParameters.java @@ -0,0 +1,42 @@ +/** + * Copyright (c) 2010-2024 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ + +package org.openhab.binding.ferroamp.internal; + +import java.util.Arrays; +import java.util.List; + +import org.eclipse.jdt.annotation.NonNullByDefault; + +/** + * The {@link EsoParameters} is responsible for all parameters regarded to ESO + * + * @author Örjan Backsell - Initial contribution + * + */ + +@NonNullByDefault +public class EsoParameters { + public String jsonPostEso; + + public EsoParameters(String jsonPostEso) { + this.jsonPostEso = jsonPostEso; + } + + public static List getChannelParametersEso() { + final List channelParametersEso = Arrays.asList("eso-unique-identifier", "eso-measured-voltage-battery", + "eso-measured-current-battery", "eso-battery-energy-produced", "eso-battery-energy-consumed", "eso-soc", + "eso-relay-status", "eso-temperature", "eso-fault-code", "eso-dc-link-voltage", "eso-timestamp"); + return channelParametersEso; + } +} diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampBindingConstants.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampBindingConstants.java new file mode 100644 index 0000000000000..3541879ff78c6 --- /dev/null +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampBindingConstants.java @@ -0,0 +1,208 @@ +/** + * Copyright (c) 2010-2024 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.ferroamp.internal; + +import java.util.Set; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.openhab.core.thing.ThingTypeUID; + +/** + * The {@link FerroampBindingConstants} class defines common constants, which are + * used across the whole binding. + * + * @author Örjan Backsell - Initial contribution + * + */ +@NonNullByDefault +public class FerroampBindingConstants { + + public static final String BINDING_ID = "ferroamp"; + + // Broker (energyhub) port number + static final int BROKER_PORT = 1883; + + // Broker (energyhub) status + public static final String CONNECTED = "connected"; + + // Broker (energyhub) topics + public static final String EHUB_TOPIC = "extapi/data/ehub"; + public static final String SSO_TOPIC = "extapi/data/sso"; + public static final String ESO_TOPIC = "extapi/data/eso"; + public static final String ESM_TOPIC = "extapi/data/esm"; + public static final String REQUEST_TOPIC = "extapi/control/request"; + + // Broker (energyhub) QOS level + public static final String QOS = "2"; + + // List of all Thing Type UIDs + public static final ThingTypeUID THING_TYPE_ENERGYHUB = new ThingTypeUID(BINDING_ID, "energyhub"); + + // List of EHUB Channel ids + public static final String CHANNEL_GRIDFREQUENCY = "grid-frequency"; + public static final String CHANNEL_ACECURRENTL1 = "ace-current-l1"; + public static final String CHANNEL_ACECURRENTL2 = "ace-current-l2"; + public static final String CHANNEL_ACECURRENTL3 = "ace-current-l3"; + public static final String CHANNEL_EXTERNALVOLTAGEL1 = "external-voltage-l1"; + public static final String CHANNEL_EXTERNALVOLTAGEL2 = "external-voltage-l2"; + public static final String CHANNEL_EXTERNALVOLTAGEL3 = "external-voltage-l3"; + public static final String CHANNEL_INVERTERRMSCURRENTL1 = "inverter-rms-current-l1"; + public static final String CHANNEL_INVERTERRMSCURRENTL2 = "inverter-rms-current-l2"; + public static final String CHANNEL_INVERTERRMSCURRENTL3 = "inverter-rms-current-l3"; + public static final String CHANNEL_INVERTERCURRENTREACTIVEL1 = "inverter-current-reactive-l1"; + public static final String CHANNEL_INVERTERCURRENTREACTIVEL2 = "inverter-current-reactive-l2"; + public static final String CHANNEL_INVERTERCURRENTREACTIVEL3 = "inverter-current-reactive-l3"; + public static final String CHANNEL_INVERTERCURRENTACTIVEL1 = "inverter-current-active-l1"; + public static final String CHANNEL_INVERTERCURRENTACTIVEL2 = "inverter-current-active-l2"; + public static final String CHANNEL_INVERTERCURRENTACTIVEL3 = "inverter-current-active-l3"; + public static final String CHANNEL_GRIDCURRENTL1 = "grid-current-l1"; + public static final String CHANNEL_GRIDCURRENTL2 = "grid-current-l2"; + public static final String CHANNEL_GRIDCURRENTL3 = "grid-current-l3"; + public static final String CHANNEL_GRIDCURRENTREACTIVEL1 = "grid-current-reactive-l1"; + public static final String CHANNEL_GRIDCURRENTREACTIVEL2 = "grid-current-reactive-l2"; + public static final String CHANNEL_GRIDCURRENTREACTIVEL3 = "grid-current-reactive-l3"; + public static final String CHANNEL_GRIDCURRENTACTIVEL1 = "grid-current-active-l1"; + public static final String CHANNEL_GRIDCURRENTACTIVEL2 = "grid-current-active-l2"; + public static final String CHANNEL_GRIDCURRENTACTIVEL3 = "grid-current-active-l3"; + public static final String CHANNEL_INVERTERREACTIVECURRENTL1 = "inverter-reactive-current-l1"; + public static final String CHANNEL_INVERTERREACTIVECURRENTL2 = "inverter-reactive-current-l2"; + public static final String CHANNEL_INVERTERREACTIVECURRENTL3 = "inverter-reactive-current-l3"; + public static final String CHANNEL_INVERTERLOADL1 = "inverter-load-l1"; + public static final String CHANNEL_INVERTERLOADL2 = "inverter-load-l2"; + public static final String CHANNEL_INVERTERLOADL3 = "inverter-load-l3"; + public static final String CHANNEL_APPARENTPOWER = "apparent-power"; + public static final String CHANNEL_GRIDPOWERACTIVEL1 = "grid-power-active-l1"; + public static final String CHANNEL_GRIDPOWERACTIVEL2 = "grid-power-active-l2"; + public static final String CHANNEL_GRIDPOWERACTIVEL3 = "grid-power-active-l3"; + public static final String CHANNEL_GRIDPOWERREACTIVEL1 = "grid-power-reactive-l1"; + public static final String CHANNEL_GRIDPOWERREACTIVEL2 = "grid-power-reactive-l2"; + public static final String CHANNEL_GRIDPOWERREACTIVEL3 = "grid-power-reactive-l3"; + public static final String CHANNEL_INVERTERPOWERACTIVEL1 = "inverter-power-active-l1"; + public static final String CHANNEL_INVERTERPOWERACTIVEL2 = "inverter-power-active-l2"; + public static final String CHANNEL_INVERTERPOWERACTIVEL3 = "inverter-power-active-l3"; + public static final String CHANNEL_INVERTERPOWERREACTIVEL1 = "inverter-power-reactive-l1"; + public static final String CHANNEL_INVERTERPOWERREACTIVEL2 = "inverter-power-reactive-l2"; + public static final String CHANNEL_INVERTERPOWERREACTIVEL3 = "inverter-power-reactive-l3"; + public static final String CHANNEL_CONSUMPTIONPOWERL1 = "consumption-power-l1"; + public static final String CHANNEL_CONSUMPTIONPOWERL2 = "consumption-power-l2"; + public static final String CHANNEL_CONSUMPTIONPOWERL3 = "consumption-power-l3"; + public static final String CHANNEL_CONSUMPTIONPOWERREACTIVEL1 = "consumption-power-reactive-l1"; + public static final String CHANNEL_CONSUMPTIONPOWERREACTIVEL2 = "consumption-power-reactive-l2"; + public static final String CHANNEL_CONSUMPTIONPOWERREACTIVEL3 = "consumption-power-reactive-l3"; + public static final String CHANNEL_SOLARPV = "solar-pv"; + public static final String CHANNEL_POSITIVEDCLINKVOLTAGE = "positive-dc-link-voltage"; + public static final String CHANNEL_NEGATIVEDCLINKVOLTAGE = "negative-dc-link-voltage"; + public static final String CHANNEL_EXTERNALENERGYPRODUCEDL1 = "external-energy-produced-l1"; + public static final String CHANNEL_EXTERNALENERGYPRODUCEDL2 = "external-energy-produced-l2"; + public static final String CHANNEL_EXTERNALENERGYPRODUCEDL3 = "external-energy-produced-l3"; + public static final String CHANNEL_EXTERNALENERGYCONSUMEDL1 = "external-energy-consumed-l1"; + public static final String CHANNEL_EXTERNALENERGYCONSUMEDL2 = "external-energy-consumed-l2"; + public static final String CHANNEL_EXTERNALENERGYCONSUMEDL3 = "external-energy-consumed-l3"; + public static final String CHANNEL_INVERTERENERGYPRODUCEDL1 = "inverter-energy-produced-l1"; + public static final String CHANNEL_INVERTERENERGYPRODUCEDL2 = "inverter-energy-produced-l2"; + public static final String CHANNEL_INVERTERENERGYPRODUCEDL3 = "inverter-energy-produced-l3"; + public static final String CHANNEL_INVERTERENERGYCONSUMEDL1 = "inverter-energy-consumed-l1"; + public static final String CHANNEL_INVERTERENERGYCONSUMEDL2 = "inverter-energy-consumed-l2"; + public static final String CHANNEL_INVERTERENERGYCONSUMEDL3 = "inverter-energy-consumed-l3"; + public static final String CHANNEL_LOADENERGYPRODUCEDL1 = "load-energy-produced-l1"; + public static final String CHANNEL_LOADENERGYPRODUCEDL2 = "load-energy-produced-l2"; + public static final String CHANNEL_LOADENERGYPRODUCEDL3 = "load-energy-produced-l3"; + public static final String CHANNEL_LOADENERGYCONSUMEDL1 = "load-energy-consumed-l1"; + public static final String CHANNEL_LOADENERGYCONSUMEDL2 = "load-energy-consumed-l2"; + public static final String CHANNEL_LOADENERGYCONSUMEDL3 = "load-energy-consumed-l3"; + public static final String CHANNEL_EXTERNALENERGYPRODUCED3P = "external-energy-produced-3p"; + public static final String CHANNEL_EXTERNALENERGYCONSUMED3P = "external-energy-consumed-3p"; + public static final String CHANNEL_INVERTERENERGYPRODUCED3P = "inverter-energy-produced-3p"; + public static final String CHANNEL_INVERTERENERGYCONSUMED3P = "inverter-energy-consumed-3p"; + public static final String CHANNEL_LOADENERGYPRODUCED3P = "load-energy-produced-3p"; + public static final String CHANNEL_LOADENERGYCONSUMED3P = "load-energy-consumed-3p"; + public static final String CHANNEL_TOTALSOLARENERGY = "total-solar-energy"; + public static final String CHANNEL_STATE = "state"; + public static final String CHANNEL_TIMESTAMP = "timestamp"; + + // List of battery setup Channel ids + public static final String CHANNEL_BATTERYENERGYPRODUCED = "battery-energy-produced"; + public static final String CHANNEL_BATTERYENERGYCONSUMED = "battery-energy-consumed"; + public static final String CHANNEL_SOC = "soc"; + public static final String CHANNEL_SOH = "soh"; + public static final String CHANNEL_POWERBATTERY = "power-battery"; + public static final String CHANNEL_TOTALRATEDCAPACITYALLBATTERIES = "total-rated-capacity-all-batteries"; + + // List of SSO Channel ids + public static final String CHANNEL_S0ID = "s0-id"; + public static final String CHANNEL_S0MEASUREDVOLTAGEPVSTRING = "s0-measured-voltage-pv-string"; + public static final String CHANNEL_S0MEASUREDCURRENTPVSTRING = "s0-measured-current-pv-string"; + public static final String CHANNEL_S0TOTALSOLARENERGY = "s0-total-solar-energy"; + public static final String CHANNEL_S0RELAYSTATUS = "s0-relay-status"; + public static final String CHANNEL_S0TEMPERATURE = "s0-temperature"; + public static final String CHANNEL_S0FAULTCODE = "s0-fault-code"; + public static final String CHANNEL_S0DCLINKVOLTAGE = "s0-dc-link-voltage"; + public static final String CHANNEL_S0TIMESTAMP = "s0-timestamp"; + public static final String CHANNEL_S1ID = "s1-id"; + public static final String CHANNEL_S1MEASUREDVOLTAGEPVSTRING = "s1-measured-voltage-pv-string"; + public static final String CHANNEL_S1MEASUREDCURRENTPVSTRING = "s1-measured-current-pv-string"; + public static final String CHANNEL_S1TOTALSOLARENERGY = "s1-total-solar-energy"; + public static final String CHANNEL_S1RELAYSTATUS = "s1-relay-status"; + public static final String CHANNEL_S1TEMPERATURE = "s1-temperature"; + public static final String CHANNEL_S1FAULTCODE = "s1-fault-code"; + public static final String CHANNEL_S1DCLINKVOLTAGE = "s1-dc-link-voltage"; + public static final String CHANNEL_S1TIMESTAMP = "s1-timestamp"; + public static final String CHANNEL_S2ID = "s2-id"; + public static final String CHANNEL_S2MEASUREDVOLTAGEPVSTRING = "s2-measured-voltage-pv-string"; + public static final String CHANNEL_S2MEASUREDCURRENTPVSTRING = "s2-measured-current-pv-string"; + public static final String CHANNEL_S2TOTALSOLARENERGY = "s2-total-solar-energy"; + public static final String CHANNEL_S2RELAYSTATUS = "s2-relay-status"; + public static final String CHANNEL_S2TEMPERATURE = "s2-temperature"; + public static final String CHANNEL_S2FAULTCODE = "s2-fault-code"; + public static final String CHANNEL_S2DCLINKVOLTAGE = "s2-dc-link-voltage"; + public static final String CHANNEL_S2TIMESTAMP = "s2-timestamp"; + public static final String CHANNEL_S3ID = "s3-id"; + public static final String CHANNEL_S3MEASUREDVOLTAGEPVSTRING = "s3-measured-voltage-pv-string"; + public static final String CHANNEL_S3MEASUREDCURRENTPVSTRING = "s3-measured-current-pv-string"; + public static final String CHANNEL_S3TOTALSOLARENERGY = "s3-total-solar-energy"; + public static final String CHANNEL_S3RELAYSTATUS = "s3-relay-status"; + public static final String CHANNEL_S3TEMPERATURE = "s3-temperature"; + public static final String CHANNEL_S3FAULTCODE = "s3-fault-code"; + public static final String CHANNEL_S3DCLINKVOLTAGE = "s3-dc-link-voltage"; + public static final String CHANNEL_S3TIMESTAMP = "s3-timestamp"; + + // List of ESO Channel ids + public static final String CHANNEL_ESOUNIQUEIDENTIFIER = "eso-unique-identifier"; + public static final String CHANNEL_ESOMEASUREDVOLTAGEBATTERY = "eso-measured-voltage-battery"; + public static final String CHANNEL_ESOMEASUREDCURRENTBATTERY = "eso-measured-current-battery"; + public static final String CHANNEL_ESOBATTERYENERGYPRODUCED = "eso-battery-energy-produced"; + public static final String CHANNEL_ESOBATTERYENERGYCONSUMED = "eso-battery-energy-consumed"; + public static final String CHANNEL_ESOSOC = "eso-soc"; + public static final String CHANNEL_ESORELAYSTATUS = "eso-relay-status"; + public static final String CHANNEL_ESOTEMPERATURE = "eso-temperature"; + public static final String CHANNEL_ESOFAULTCODE = "eso-fault-code"; + public static final String CHANNEL_ESODCLINKVOLTAGE = "eso-dc-link-voltage"; + public static final String CHANNEL_ESOTIMESTAMP = "eso-timestamp"; + + // List of ESM Channel ids + public static final String CHANNEL_ESMUNIQUEIDENTIFIER = "esm-unique-identifier"; + public static final String CHANNEL_ESMSOH = "esm-soh"; + public static final String CHANNEL_ESMSOC = "esm-soc"; + public static final String CHANNEL_ESMTOTALRATEDCAPACITYALLBATTERIES = "esm-total-rated-capacity-all-batteries"; + public static final String CHANNEL_ESMRATEDPOWERBATTERY = "esm-rated-power-battery"; + public static final String CHANNEL_ESMSTATUS = "esm-status"; + public static final String CHANNEL_ESMTIMESTAMP = "esm-timestamp"; + + // List of all Channel ids for configuration + public static final String CHANNEL_REQUESTCHARGE = "request-charge"; + public static final String CHANNEL_REQUESTDISCHARGE = "request-discharge"; + public static final String CHANNEL_AUTO = "request-auto"; + public static final String CHANNEL_REQUESTEXTAPIVERSION = "request-extapi-version"; + + public static final Set SUPPORTED_THING_TYPES_UIDS = Set.of(THING_TYPE_ENERGYHUB); +} diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampChannelConfiguration.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampChannelConfiguration.java new file mode 100644 index 0000000000000..8513b3f53f58f --- /dev/null +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampChannelConfiguration.java @@ -0,0 +1,367 @@ +/** + * Copyright (c) 2010-2024 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.ferroamp.internal; + +import java.util.ArrayList; +import java.util.List; + +import javax.measure.Unit; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.openhab.core.library.unit.Units; + +/** + * The {@link FerroampChannelConfiguration} class defines methods, which set up channel configuration for the binding. + * + * @author Örjan Backsell - Initial contribution + * + */ + +@NonNullByDefault +public class FerroampChannelConfiguration { + public String id; + public Unit unit; + + public FerroampChannelConfiguration(String id, Unit unit) { + this.id = id; + this.unit = unit; + } + + public static List getChannelConfigurationEhub() { + final List channelConfigurationEhub = new ArrayList<>(); + channelConfigurationEhub + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_GRIDFREQUENCY, Units.HERTZ)); + channelConfigurationEhub + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_ACECURRENTL1, Units.AMPERE)); + channelConfigurationEhub + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_ACECURRENTL2, Units.AMPERE)); + channelConfigurationEhub + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_ACECURRENTL3, Units.AMPERE)); + channelConfigurationEhub + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_EXTERNALVOLTAGEL1, Units.VOLT)); + channelConfigurationEhub + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_EXTERNALVOLTAGEL2, Units.VOLT)); + channelConfigurationEhub + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_EXTERNALVOLTAGEL3, Units.VOLT)); + channelConfigurationEhub.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_INVERTERRMSCURRENTL1, Units.AMPERE)); + channelConfigurationEhub.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_INVERTERRMSCURRENTL2, Units.AMPERE)); + channelConfigurationEhub.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_INVERTERRMSCURRENTL3, Units.AMPERE)); + channelConfigurationEhub.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_INVERTERCURRENTREACTIVEL1, Units.AMPERE)); + channelConfigurationEhub.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_INVERTERCURRENTREACTIVEL2, Units.AMPERE)); + channelConfigurationEhub.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_INVERTERCURRENTREACTIVEL3, Units.AMPERE)); + channelConfigurationEhub.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_INVERTERCURRENTACTIVEL1, Units.AMPERE)); + channelConfigurationEhub.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_INVERTERCURRENTACTIVEL2, Units.AMPERE)); + channelConfigurationEhub.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_INVERTERCURRENTACTIVEL3, Units.AMPERE)); + channelConfigurationEhub + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_GRIDCURRENTL1, Units.AMPERE)); + channelConfigurationEhub + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_GRIDCURRENTL2, Units.AMPERE)); + channelConfigurationEhub + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_GRIDCURRENTL3, Units.AMPERE)); + channelConfigurationEhub.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_GRIDCURRENTREACTIVEL1, Units.AMPERE)); + channelConfigurationEhub.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_GRIDCURRENTREACTIVEL2, Units.AMPERE)); + channelConfigurationEhub.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_GRIDCURRENTREACTIVEL3, Units.AMPERE)); + channelConfigurationEhub.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_GRIDCURRENTACTIVEL1, Units.AMPERE)); + channelConfigurationEhub.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_GRIDCURRENTACTIVEL2, Units.AMPERE)); + channelConfigurationEhub.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_GRIDCURRENTACTIVEL3, Units.AMPERE)); + channelConfigurationEhub.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_INVERTERREACTIVECURRENTL1, Units.AMPERE)); + channelConfigurationEhub.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_INVERTERREACTIVECURRENTL2, Units.AMPERE)); + channelConfigurationEhub.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_INVERTERREACTIVECURRENTL3, Units.AMPERE)); + channelConfigurationEhub + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_INVERTERLOADL1, Units.AMPERE)); + channelConfigurationEhub + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_INVERTERLOADL2, Units.AMPERE)); + channelConfigurationEhub + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_INVERTERLOADL3, Units.AMPERE)); + channelConfigurationEhub.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_APPARENTPOWER, Units.VOLT_AMPERE)); + channelConfigurationEhub.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_GRIDPOWERACTIVEL1, Units.AMPERE)); + channelConfigurationEhub.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_GRIDPOWERACTIVEL2, Units.AMPERE)); + channelConfigurationEhub.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_GRIDPOWERACTIVEL3, Units.AMPERE)); + channelConfigurationEhub.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_GRIDPOWERREACTIVEL1, Units.WATT)); + channelConfigurationEhub.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_GRIDPOWERREACTIVEL2, Units.WATT)); + channelConfigurationEhub.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_GRIDPOWERREACTIVEL3, Units.WATT)); + channelConfigurationEhub.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_INVERTERPOWERACTIVEL1, Units.VOLT)); + channelConfigurationEhub.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_INVERTERPOWERACTIVEL2, Units.VOLT)); + channelConfigurationEhub.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_INVERTERPOWERACTIVEL3, Units.VOLT)); + channelConfigurationEhub.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_INVERTERPOWERREACTIVEL1, Units.VOLT)); + channelConfigurationEhub.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_INVERTERPOWERREACTIVEL2, Units.VOLT)); + channelConfigurationEhub.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_INVERTERPOWERREACTIVEL3, Units.VOLT)); + channelConfigurationEhub + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_CONSUMPTIONPOWERL1, Units.WATT)); + channelConfigurationEhub + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_CONSUMPTIONPOWERL2, Units.WATT)); + channelConfigurationEhub + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_CONSUMPTIONPOWERL3, Units.WATT)); + channelConfigurationEhub.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_CONSUMPTIONPOWERREACTIVEL1, Units.WATT)); + channelConfigurationEhub.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_CONSUMPTIONPOWERREACTIVEL2, Units.WATT)); + channelConfigurationEhub.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_CONSUMPTIONPOWERREACTIVEL3, Units.WATT)); + channelConfigurationEhub + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_SOLARPV, Units.WATT)); + channelConfigurationEhub.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_POSITIVEDCLINKVOLTAGE, Units.VOLT)); + channelConfigurationEhub.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_NEGATIVEDCLINKVOLTAGE, Units.VOLT)); + channelConfigurationEhub.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_EXTERNALENERGYPRODUCEDL1, Units.WATT)); + channelConfigurationEhub.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_EXTERNALENERGYPRODUCEDL2, Units.WATT)); + channelConfigurationEhub.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_EXTERNALENERGYPRODUCEDL3, Units.WATT)); + channelConfigurationEhub.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_EXTERNALENERGYCONSUMEDL1, Units.WATT)); + channelConfigurationEhub.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_EXTERNALENERGYCONSUMEDL2, Units.WATT)); + channelConfigurationEhub.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_EXTERNALENERGYCONSUMEDL3, Units.WATT)); + channelConfigurationEhub.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_INVERTERENERGYPRODUCEDL1, Units.WATT)); + channelConfigurationEhub.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_INVERTERENERGYPRODUCEDL2, Units.WATT)); + channelConfigurationEhub.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_INVERTERENERGYPRODUCEDL3, Units.WATT)); + channelConfigurationEhub.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_INVERTERENERGYCONSUMEDL1, Units.WATT)); + channelConfigurationEhub.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_INVERTERENERGYCONSUMEDL2, Units.WATT)); + channelConfigurationEhub.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_INVERTERENERGYCONSUMEDL3, Units.WATT)); + channelConfigurationEhub.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_LOADENERGYPRODUCEDL1, Units.WATT)); + channelConfigurationEhub.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_LOADENERGYPRODUCEDL2, Units.WATT)); + channelConfigurationEhub.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_LOADENERGYPRODUCEDL3, Units.WATT)); + channelConfigurationEhub.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_LOADENERGYCONSUMEDL1, Units.WATT)); + channelConfigurationEhub.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_LOADENERGYCONSUMEDL2, Units.WATT)); + channelConfigurationEhub.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_LOADENERGYCONSUMEDL3, Units.WATT)); + channelConfigurationEhub.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_EXTERNALENERGYPRODUCED3P, Units.WATT)); + channelConfigurationEhub.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_EXTERNALENERGYCONSUMED3P, Units.WATT)); + channelConfigurationEhub.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_INVERTERENERGYPRODUCED3P, Units.WATT)); + channelConfigurationEhub.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_INVERTERENERGYCONSUMED3P, Units.WATT)); + channelConfigurationEhub.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_LOADENERGYPRODUCED3P, Units.WATT)); + channelConfigurationEhub.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_LOADENERGYCONSUMED3P, Units.WATT)); + channelConfigurationEhub + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_TOTALSOLARENERGY, Units.WATT)); + channelConfigurationEhub + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_STATE, Units.ONE)); + channelConfigurationEhub + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_TIMESTAMP, Units.ONE)); + channelConfigurationEhub.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_BATTERYENERGYPRODUCED, Units.WATT)); + channelConfigurationEhub.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_BATTERYENERGYCONSUMED, Units.WATT)); + channelConfigurationEhub + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_SOC, Units.PERCENT)); + channelConfigurationEhub + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_SOH, Units.PERCENT)); + channelConfigurationEhub + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_POWERBATTERY, Units.WATT)); + channelConfigurationEhub.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_TOTALRATEDCAPACITYALLBATTERIES, Units.WATT_HOUR)); + return channelConfigurationEhub; + } + + public static List getChannelConfigurationSsoS0() { + final List channelConfigurationSsoS0 = new ArrayList<>(); + channelConfigurationSsoS0 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S0ID, Units.ONE)); + channelConfigurationSsoS0.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_S0MEASUREDVOLTAGEPVSTRING, Units.VOLT)); + channelConfigurationSsoS0.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_S0MEASUREDCURRENTPVSTRING, Units.AMPERE)); + channelConfigurationSsoS0 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S0TOTALSOLARENERGY, Units.WATT)); + channelConfigurationSsoS0 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S0RELAYSTATUS, Units.ONE)); + channelConfigurationSsoS0 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S0TEMPERATURE, Units.ONE)); + channelConfigurationSsoS0 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S0FAULTCODE, Units.ONE)); + channelConfigurationSsoS0 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S0DCLINKVOLTAGE, Units.VOLT)); + channelConfigurationSsoS0 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S0TIMESTAMP, Units.ONE)); + return channelConfigurationSsoS0; + } + + public static List getChannelConfigurationSsoS1() { + final List channelConfigurationSsoS1 = new ArrayList<>(); + channelConfigurationSsoS1 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S1ID, Units.ONE)); + channelConfigurationSsoS1.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_S1MEASUREDVOLTAGEPVSTRING, Units.VOLT)); + channelConfigurationSsoS1.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_S1MEASUREDCURRENTPVSTRING, Units.AMPERE)); + channelConfigurationSsoS1 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S1TOTALSOLARENERGY, Units.WATT)); + channelConfigurationSsoS1 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S1RELAYSTATUS, Units.ONE)); + channelConfigurationSsoS1 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S1TEMPERATURE, Units.ONE)); + channelConfigurationSsoS1 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S1FAULTCODE, Units.ONE)); + channelConfigurationSsoS1 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S1DCLINKVOLTAGE, Units.VOLT)); + channelConfigurationSsoS1 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S1TIMESTAMP, Units.ONE)); + return channelConfigurationSsoS1; + } + + public static List getChannelConfigurationSsoS2() { + final List channelConfigurationSsoS2 = new ArrayList<>(); + channelConfigurationSsoS2 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S2ID, Units.ONE)); + channelConfigurationSsoS2.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_S2MEASUREDVOLTAGEPVSTRING, Units.VOLT)); + channelConfigurationSsoS2.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_S2MEASUREDCURRENTPVSTRING, Units.AMPERE)); + channelConfigurationSsoS2 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S2TOTALSOLARENERGY, Units.WATT)); + channelConfigurationSsoS2 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S2RELAYSTATUS, Units.ONE)); + channelConfigurationSsoS2 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S2TEMPERATURE, Units.ONE)); + channelConfigurationSsoS2 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S2FAULTCODE, Units.ONE)); + channelConfigurationSsoS2 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S2DCLINKVOLTAGE, Units.VOLT)); + channelConfigurationSsoS2 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S2TIMESTAMP, Units.ONE)); + return channelConfigurationSsoS2; + } + + public static List getChannelConfigurationSsoS3() { + final List channelConfigurationSsoS3 = new ArrayList<>(); + channelConfigurationSsoS3 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S3ID, Units.ONE)); + channelConfigurationSsoS3.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_S3MEASUREDVOLTAGEPVSTRING, Units.VOLT)); + channelConfigurationSsoS3.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_S3MEASUREDCURRENTPVSTRING, Units.AMPERE)); + channelConfigurationSsoS3 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S3TOTALSOLARENERGY, Units.WATT)); + channelConfigurationSsoS3 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S3RELAYSTATUS, Units.ONE)); + channelConfigurationSsoS3 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S3TEMPERATURE, Units.ONE)); + channelConfigurationSsoS3 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S3FAULTCODE, Units.ONE)); + channelConfigurationSsoS3 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S3DCLINKVOLTAGE, Units.VOLT)); + channelConfigurationSsoS3 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S3TIMESTAMP, Units.ONE)); + return channelConfigurationSsoS3; + } + + public static List getChannelConfigurationEso() { + final List channelConfigurationEso = new ArrayList<>(); + channelConfigurationEso + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_ESOUNIQUEIDENTIFIER, Units.ONE)); + channelConfigurationEso.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_ESOMEASUREDVOLTAGEBATTERY, Units.VOLT)); + channelConfigurationEso.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_ESOMEASUREDCURRENTBATTERY, Units.AMPERE)); + channelConfigurationEso.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_ESOBATTERYENERGYPRODUCED, Units.WATT)); + channelConfigurationEso.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_ESOBATTERYENERGYCONSUMED, Units.WATT)); + channelConfigurationEso + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_ESOSOC, Units.PERCENT)); + channelConfigurationEso + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_ESORELAYSTATUS, Units.ONE)); + channelConfigurationEso + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_ESOTEMPERATURE, Units.ONE)); + channelConfigurationEso + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_ESOFAULTCODE, Units.ONE)); + channelConfigurationEso + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_ESODCLINKVOLTAGE, Units.VOLT)); + channelConfigurationEso + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_ESOTIMESTAMP, Units.ONE)); + return channelConfigurationEso; + } + + public static List getChannelConfigurationEsm() { + final List channelConfigurationEsm = new ArrayList<>(); + channelConfigurationEsm + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_ESMUNIQUEIDENTIFIER, Units.ONE)); + channelConfigurationEsm + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_ESMSOH, Units.PERCENT)); + channelConfigurationEsm + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_ESMSOC, Units.PERCENT)); + channelConfigurationEsm.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_ESMTOTALRATEDCAPACITYALLBATTERIES, Units.WATT_HOUR)); + channelConfigurationEsm.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_ESMRATEDPOWERBATTERY, Units.WATT)); + channelConfigurationEsm + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_ESMSTATUS, Units.ONE)); + channelConfigurationEsm + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_ESMTIMESTAMP, Units.ONE)); + return channelConfigurationEsm; + } + + public static List getChannelConfigurationRequest() { + final List channelConfigurationRequest = new ArrayList<>(); + channelConfigurationRequest + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_REQUESTCHARGE, Units.ONE)); + channelConfigurationRequest + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_REQUESTDISCHARGE, Units.ONE)); + channelConfigurationRequest + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_AUTO, Units.ONE)); + channelConfigurationRequest.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_REQUESTEXTAPIVERSION, Units.ONE)); + return channelConfigurationRequest; + } +} \ No newline at end of file diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampConfiguration.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampConfiguration.java new file mode 100644 index 0000000000000..ccc15d1d3dc46 --- /dev/null +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampConfiguration.java @@ -0,0 +1,36 @@ +/** + * Copyright (c) 2010-2024 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.ferroamp.internal; + +import org.eclipse.jdt.annotation.NonNullByDefault; + +/** + * The {@link FerroampConfiguration} class contains fields mapping thing configuration parameters. + * + * @author Örjan Backsell - Initial contribution + * + */ + +@NonNullByDefault +public class FerroampConfiguration { + public String hostName = ""; + public String userName = ""; + public String password = ""; + public boolean hasBattery; + public boolean ssoS0; + public boolean ssoS1; + public boolean ssoS2; + public boolean ssoS3; + public boolean eso; + public boolean esm; +} diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java new file mode 100644 index 0000000000000..e43e276bfe899 --- /dev/null +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java @@ -0,0 +1,278 @@ +/** + * Copyright (c) 2010-2024 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.ferroamp.internal; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import java.util.concurrent.TimeUnit; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; +import org.openhab.core.io.transport.mqtt.MqttBrokerConnection; +import org.openhab.core.io.transport.mqtt.MqttMessageSubscriber; +import org.openhab.core.library.types.StringType; +import org.openhab.core.thing.ChannelUID; +import org.openhab.core.thing.Thing; +import org.openhab.core.thing.ThingStatus; +import org.openhab.core.thing.ThingStatusDetail; +import org.openhab.core.thing.binding.BaseThingHandler; +import org.openhab.core.types.Command; +import org.openhab.core.types.State; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The {@link FerroampHandler} is responsible for handling of the values sent to and from the binding. + * + * @author Örjan Backsell - Initial contribution + * + */ +@NonNullByDefault +public class FerroampHandler extends BaseThingHandler implements MqttMessageSubscriber { + private final static Logger logger = LoggerFactory.getLogger(FerroampHandler.class); + + private static @Nullable FerroampConfiguration ferroampConfig; + private @Nullable static MqttBrokerConnection ferroampConnection; + FerroampMqttCommunication ferroampMqttCommunication = new FerroampMqttCommunication(thing); + + private List channelConfigEhub = new ArrayList<>(); + private static List channelConfigSsoS0 = new ArrayList<>(); + private static List channelConfigSsoS1 = new ArrayList<>(); + private static List channelConfigSsoS2 = new ArrayList<>(); + private static List channelConfigSsoS3 = new ArrayList<>(); + private static List channelConfigEso = new ArrayList<>(); + private static List channelConfigEsm = new ArrayList<>(); + + long refreshInterval = 30; + static boolean isEsoAvailable = false; + static boolean isEsmAvailable = false; + + public FerroampHandler(Thing thing) { + super(thing); + } + + @Override + public void handleCommand(ChannelUID channelUID, Command command) { + String transId = UUID.randomUUID().toString(); + String valueConfiguration = command.toString(); + + if (FerroampBindingConstants.CHANNEL_REQUESTCHARGE.equals(channelUID.getId())) { + String requestCmdJsonCharge = "{\"" + "transId" + "\":\"" + transId + + "\",\"cmd\":{\"name\":\"charge\",\"arg\":\"" + valueConfiguration + "\"}}"; + sendMQTT(requestCmdJsonCharge); + } + if (FerroampBindingConstants.CHANNEL_REQUESTDISCHARGE.equals(channelUID.getId())) { + String requestCmdJsonDisCharge = "{\"" + "transId" + "\":\"" + transId + + "\",\"cmd\":{\"name\":\"discharge\",\"arg\":\"" + valueConfiguration + "\"}}"; + sendMQTT(requestCmdJsonDisCharge); + } + if (FerroampBindingConstants.CHANNEL_AUTO.equals(channelUID.getId())) { + String requestCmdJsonAuto = "{\"" + "transId" + "\":\"" + transId + "\",\"cmd\":{\"name\":\"auto\"}}"; + sendMQTT(requestCmdJsonAuto); + } + } + + @Override + public void initialize() { + // Set channel configuration parameters + channelConfigEhub = FerroampChannelConfiguration.getChannelConfigurationEhub(); + channelConfigSsoS0 = FerroampChannelConfiguration.getChannelConfigurationSsoS0(); + channelConfigSsoS1 = FerroampChannelConfiguration.getChannelConfigurationSsoS1(); + channelConfigSsoS2 = FerroampChannelConfiguration.getChannelConfigurationSsoS2(); + channelConfigSsoS3 = FerroampChannelConfiguration.getChannelConfigurationSsoS3(); + channelConfigEso = FerroampChannelConfiguration.getChannelConfigurationEso(); + channelConfigEsm = FerroampChannelConfiguration.getChannelConfigurationEsm(); + + ferroampConfig = getConfigAs(FerroampConfiguration.class); + + @SuppressWarnings("null") + final MqttBrokerConnection ferroampConnection = new MqttBrokerConnection(ferroampConfig.hostName, + FerroampBindingConstants.BROKER_PORT, false, false, ferroampConfig.userName); + + updateStatus(ThingStatus.UNKNOWN); + + scheduler.execute(() -> { + boolean thingReachable = true; + + if (thingReachable) { + updateStatus(ThingStatus.ONLINE); + try { + startMqttConnection(); + } catch (InterruptedException e) { + logger.debug("Connection to MqttBroker disturbed during configuration"); + } + } else { + updateStatus(ThingStatus.OFFLINE); + } + }); + + // Start channel-update as configured + scheduler.scheduleWithFixedDelay(() -> { + try { + channelUpdate(); + } catch (RuntimeException scheduleWithFixedDelayException) { + updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, + scheduleWithFixedDelayException.getClass().getName() + ":" + + scheduleWithFixedDelayException.getMessage()); + } + }, 60, refreshInterval, TimeUnit.SECONDS); + + this.setFerroampConnection(ferroampConnection); + } + + private void startMqttConnection() throws InterruptedException { + try { + TimeUnit.SECONDS.sleep(10); + } catch (InterruptedException e) { + logger.debug("Connection to MqttBroker disturbed during startup of MqttConnection"); + } + ferroampMqttCommunication.getMQTT("ehubTopic", ferroampConfig); + ferroampMqttCommunication.getMQTT("ssoTopic", ferroampConfig); + ferroampMqttCommunication.getMQTT("esoTopic", ferroampConfig); + ferroampMqttCommunication.getMQTT("esmTopic", ferroampConfig); + } + + @SuppressWarnings("null") + private void channelUpdate() { + String[] ehubUpdateChannels; + ehubUpdateChannels = FerroampMqttCommunication.getEhubChannelUpdateValues(); + int channelValuesCounterEhub = 0; + for (FerroampChannelConfiguration cConfig : channelConfigEhub) { + String ehubChannel = cConfig.id; + State ehubState = StringType.valueOf(ehubUpdateChannels[channelValuesCounterEhub]); + updateState(ehubChannel, ehubState); + channelValuesCounterEhub++; + } + + if (ferroampConfig.ssoS0 == true) { + String[] ssoS0UpdateChannels = new String[9]; + ssoS0UpdateChannels = FerroampMqttCommunication.getSsoS0ChannelUpdateValues(); + int channelValuesCounterSsoS0 = 0; + if (ssoS0UpdateChannels.length <= 9) { + for (FerroampChannelConfiguration cConfig : channelConfigSsoS0) { + String ssoS0Channel = cConfig.id; + State ssoS0State = StringType.valueOf(ssoS0UpdateChannels[channelValuesCounterSsoS0]); + updateState(ssoS0Channel, ssoS0State); + channelValuesCounterSsoS0++; + } + } + } + + if (ferroampConfig.ssoS1 == true) { + String[] ssoS1UpdateChannels = new String[9]; + ssoS1UpdateChannels = FerroampMqttCommunication.getSsoS1ChannelUpdateValues(); + int channelValuesCounterSsoS1 = 0; + if (ssoS1UpdateChannels.length <= 9) { + for (FerroampChannelConfiguration cConfig : channelConfigSsoS1) { + String ssoS1Channel = cConfig.id; + State ssoS1State = StringType.valueOf(ssoS1UpdateChannels[channelValuesCounterSsoS1]); + updateState(ssoS1Channel, ssoS1State); + channelValuesCounterSsoS1++; + } + } + } + + if (ferroampConfig.ssoS2 == true) { + String[] ssoS2UpdateChannels = new String[9]; + ssoS2UpdateChannels = FerroampMqttCommunication.getSsoS2ChannelUpdateValues(); + int channelValuesCounterSsoS2 = 0; + if (ssoS2UpdateChannels.length <= 9) { + for (FerroampChannelConfiguration cConfig : channelConfigSsoS2) { + String ssoS2Channel = cConfig.id; + State ssoS2State = StringType.valueOf(ssoS2UpdateChannels[channelValuesCounterSsoS2]); + updateState(ssoS2Channel, ssoS2State); + channelValuesCounterSsoS2++; + } + } + } + + if (ferroampConfig.ssoS3 == true) { + String[] ssoS3UpdateChannels = new String[9]; + ssoS3UpdateChannels = FerroampMqttCommunication.getSsoS3ChannelUpdateValues(); + int channelValuesCounterSsoS3 = 0; + if (ssoS3UpdateChannels.length <= 9) { + for (FerroampChannelConfiguration cConfig : channelConfigSsoS3) { + String ssoS3Channel = cConfig.id; + State ssoS3State = StringType.valueOf(ssoS3UpdateChannels[channelValuesCounterSsoS3]); + updateState(ssoS3Channel, ssoS3State); + channelValuesCounterSsoS3++; + } + } + } + + if (ferroampConfig.eso == true) { + String[] esoUpdateChannels; + esoUpdateChannels = FerroampMqttCommunication.getEsoChannelUpdateValues(); + int channelValuesCounterEso = 0; + for (FerroampChannelConfiguration cConfig : channelConfigEso) { + String esoChannel = cConfig.id; + State esoState = StringType.valueOf(esoUpdateChannels[channelValuesCounterEso]); + updateState(esoChannel, esoState); + channelValuesCounterEso++; + } + } + + if (ferroampConfig.esm == true) { + String[] esmUpdateChannels; + esmUpdateChannels = FerroampMqttCommunication.getEsmChannelUpdateValues(); + int channelValuesCounterEsm = 0; + for (FerroampChannelConfiguration cConfig : channelConfigEsm) { + String esmChannel = cConfig.id; + State esmState = StringType.valueOf(esmUpdateChannels[channelValuesCounterEsm]); + updateState(esmChannel, esmState); + channelValuesCounterEsm++; + } + } + } + + // Handles request topic + @SuppressWarnings("null") + private void sendMQTT(String payload) { + MqttBrokerConnection localConfigurationConnection = getFerroampConnection(); + localConfigurationConnection.start(); + localConfigurationConnection.setCredentials(ferroampConfig.userName, ferroampConfig.password); + + if (localConfigurationConnection != null) { + localConfigurationConnection.publish(FerroampBindingConstants.REQUEST_TOPIC, payload.getBytes(), 1, false); + } + } + + // Capture actual Json-topic message + @Override + public void processMessage(String topic, byte[] payload) { + } + + public @Nullable static MqttBrokerConnection getFerroampConnection() { + try { + return ferroampConnection; + } catch (Exception e) { + logger.debug("Connection to MqttBroker disturbed during startup of MqttConnection"); + } + return ferroampConnection; + } + + public void setFerroampConnection(@Nullable MqttBrokerConnection ferroampConnection) { + FerroampHandler.ferroampConnection = ferroampConnection; + } + + @SuppressWarnings({ "null" }) + public static boolean gethasBattery() { + try { + return ferroampConfig.hasBattery; + } catch (Exception e) { + logger.debug("Failed at check of configuration-parameter, hasBattery"); + } + return ferroampConfig.hasBattery; + } +} \ No newline at end of file diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandlerFactory.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandlerFactory.java new file mode 100644 index 0000000000000..4c5561246cade --- /dev/null +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandlerFactory.java @@ -0,0 +1,57 @@ +/** + /** + * Copyright (c) 2010-2024 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.ferroamp.internal; + +import static org.openhab.binding.ferroamp.internal.FerroampBindingConstants.THING_TYPE_ENERGYHUB; + +import java.util.Set; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; +import org.openhab.core.thing.Thing; +import org.openhab.core.thing.ThingTypeUID; +import org.openhab.core.thing.binding.BaseThingHandlerFactory; +import org.openhab.core.thing.binding.ThingHandler; +import org.openhab.core.thing.binding.ThingHandlerFactory; +import org.osgi.service.component.annotations.Component; + +/** + * The {@link FerroampHandlerFactory} is responsible for creating things and thing + * handlers. + * + * @author Örjan Backsell - Initial contribution + * + */ + +@NonNullByDefault +@Component(configurationPid = "binding.ferroamp", service = ThingHandlerFactory.class) +public class FerroampHandlerFactory extends BaseThingHandlerFactory { + + private static final Set SUPPORTED_THING_TYPES_UIDS = Set.of(THING_TYPE_ENERGYHUB); + + @Override + public boolean supportsThingType(ThingTypeUID thingTypeUID) { + return SUPPORTED_THING_TYPES_UIDS.contains(thingTypeUID); + } + + @Override + protected @Nullable ThingHandler createHandler(Thing thing) { + ThingTypeUID thingTypeUID = thing.getThingTypeUID(); + + if (THING_TYPE_ENERGYHUB.equals(thingTypeUID)) { + return new FerroampHandler(thing); + } + return null; + } +} diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampMqttCommunication.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampMqttCommunication.java new file mode 100644 index 0000000000000..646aabc535c3e --- /dev/null +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampMqttCommunication.java @@ -0,0 +1,821 @@ +/** + * Copyright (c) 2010-2024 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.ferroamp.internal; + +import java.nio.charset.StandardCharsets; +import java.util.concurrent.TimeUnit; + +import org.eclipse.jdt.annotation.Nullable; +import org.openhab.binding.ferroamp.dto.GetGeneralLx; +import org.openhab.binding.ferroamp.dto.GetGeneralValues; +import org.openhab.binding.ferroamp.dto.GetUdc; +import org.openhab.core.io.transport.mqtt.MqttBrokerConnection; +import org.openhab.core.io.transport.mqtt.MqttMessageSubscriber; +import org.openhab.core.thing.Thing; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.gson.Gson; +import com.google.gson.JsonObject; + +/** + * The {@link FerroampMqttCommunication} is responsible for communication with the Ferroamp-systems Mqtt-broker. + * + * @author Örjan Backsell - Initial contribution + * + */ + +public class FerroampMqttCommunication implements MqttMessageSubscriber { + + private @Nullable FerroampConfiguration ferroampConfig; + private @Nullable static MqttBrokerConnection ferroampConnection; + + static String[] ehubChannelsUpdateValues; + static String[] ssoS0ChannelsUpdateValues; + static String[] ssoS1ChannelsUpdateValues; + static String[] ssoS2ChannelsUpdateValues; + static String[] ssoS3ChannelsUpdateValues; + static String[] esoChannelsUpdateValues; + static String[] esmChannelsUpdateValues; + + static boolean isSsoChecked = false; + static String ssoS0IdCheck = ""; + static String ssoS1IdCheck = ""; + static String ssoS2IdCheck = ""; + static String ssoS3IdCheck = ""; + + static boolean isEsoAvailable = false; + static boolean isEsmAvailable = false; + + private final static Logger logger = LoggerFactory.getLogger(FerroampMqttCommunication.class); + + public FerroampMqttCommunication(Thing thing) { + super(); + } + + // Handles request topic + @SuppressWarnings("null") + void sendMQTT(String payload) { + MqttBrokerConnection localConfigurationConnection = ferroampConnection; + if (FerroampHandler.getFerroampConnection() == null) { + try { + TimeUnit.SECONDS.sleep(10); + } catch (InterruptedException e) { + logger.debug("Failed during waiting for connection to setup"); + } + } + + localConfigurationConnection.start(); + localConfigurationConnection.setCredentials(ferroampConfig.userName, ferroampConfig.password); + + if (localConfigurationConnection != null) { + localConfigurationConnection.publish(FerroampBindingConstants.REQUEST_TOPIC, payload.getBytes(), 1, false); + } + } + + // Handles respective topic type + @SuppressWarnings("null") + void getMQTT(String topic, FerroampConfiguration ferroampConfig) throws InterruptedException { + MqttBrokerConnection localSubscribeConnection = FerroampHandler.getFerroampConnection(); + localSubscribeConnection.start(); + localSubscribeConnection.setCredentials(ferroampConfig.userName, ferroampConfig.password); + + if ("ehubTopic".equals(topic)) { + localSubscribeConnection.subscribe(FerroampBindingConstants.EHUB_TOPIC, this); + } + if ("ssoTopic".equals(topic)) { + localSubscribeConnection.subscribe(FerroampBindingConstants.SSO_TOPIC, this); + } + if ("esoTopic".equals(topic)) { + localSubscribeConnection.subscribe(FerroampBindingConstants.ESO_TOPIC, this); + } + if ("esmTopic".equals(topic)) { + localSubscribeConnection.subscribe(FerroampBindingConstants.ESM_TOPIC, this); + } + } + + // Capture actual Json-topic message + @Override + public void processMessage(String topic, byte[] payload) { + if ("extapi/data/ehub".equals(topic)) { + processIncomingJsonMessageEhub(topic, new String(payload, StandardCharsets.UTF_8)); + } + if ("extapi/data/sso".equals(topic)) { + processIncomingJsonMessageSso(topic, new String(payload, StandardCharsets.UTF_8)); + } + } + + @SuppressWarnings("null") + // Prepare actual Json-topic Ehub-message and update values for channels + void processIncomingJsonMessageEhub(String topic, String messageJsonEhub) { + String[] ehubChannelPostsValue = new String[86]; // Array for EHUB (Energy Hub) Posts + JsonObject jsonElementsObject = new Gson().fromJson(new Gson().fromJson(messageJsonEhub, JsonObject.class), + JsonObject.class); + String jsonElementsStringTemp = ""; + Gson gson = new Gson(); + + // gridfreq + jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(0)).toString(); + GetGeneralValues gridfreq = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + ehubChannelPostsValue[0] = gridfreq.getVal(); + + // iace + jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(1)).toString(); + GetGeneralLx iace = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + ehubChannelPostsValue[1] = iace.getL1(); + ehubChannelPostsValue[2] = iace.getL2(); + ehubChannelPostsValue[3] = iace.getL3(); + + // ul + jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(2)).toString(); + GetGeneralLx ul = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + ehubChannelPostsValue[4] = ul.getL1(); + ehubChannelPostsValue[5] = ul.getL2(); + ehubChannelPostsValue[6] = ul.getL3(); + + // il + jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(3)).toString(); + GetGeneralLx il = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + ehubChannelPostsValue[7] = il.getL1(); + ehubChannelPostsValue[8] = il.getL2(); + ehubChannelPostsValue[9] = il.getL3(); + + // ild + jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(4)).toString(); + GetGeneralLx ild = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + ehubChannelPostsValue[10] = ild.getL1(); + ehubChannelPostsValue[11] = ild.getL2(); + ehubChannelPostsValue[12] = ild.getL3(); + + // ilq + jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(5)).toString(); + GetGeneralLx ilq = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + ehubChannelPostsValue[13] = ilq.getL1(); + ehubChannelPostsValue[14] = ilq.getL2(); + ehubChannelPostsValue[15] = ilq.getL3(); + + // iext + jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(6)).toString(); + GetGeneralLx iext = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + ehubChannelPostsValue[16] = iext.getL1(); + ehubChannelPostsValue[17] = iext.getL2(); + ehubChannelPostsValue[18] = iext.getL3(); + + // iextd + jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(7)).toString(); + GetGeneralLx iextd = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + ehubChannelPostsValue[19] = iextd.getL1(); + ehubChannelPostsValue[20] = iextd.getL2(); + ehubChannelPostsValue[21] = iextd.getL3(); + + // iextq + jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(8)).toString(); + GetGeneralLx iextq = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + ehubChannelPostsValue[22] = iextq.getL1(); + ehubChannelPostsValue[23] = iextq.getL2(); + ehubChannelPostsValue[24] = iextq.getL3(); + + // iloadd + jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(9)).toString(); + GetGeneralLx iloadd = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + ehubChannelPostsValue[25] = iloadd.getL1(); + ehubChannelPostsValue[26] = iloadd.getL2(); + ehubChannelPostsValue[27] = iloadd.getL3(); + + // iloadq + jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(10)).toString(); + GetGeneralLx iloadq = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + ehubChannelPostsValue[28] = iloadq.getL1(); + ehubChannelPostsValue[29] = iloadq.getL2(); + ehubChannelPostsValue[30] = iloadq.getL3(); + + // sext + jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(11)).toString(); + GetGeneralValues sext = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + ehubChannelPostsValue[31] = sext.getVal(); + + // pext + jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(12)).toString(); + GetGeneralLx pext = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + ehubChannelPostsValue[32] = pext.getL1(); + ehubChannelPostsValue[33] = pext.getL2(); + ehubChannelPostsValue[34] = pext.getL3(); + + // pextreactive + jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(13)).toString(); + GetGeneralLx pextreactive = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + ehubChannelPostsValue[35] = pextreactive.getL1(); + ehubChannelPostsValue[36] = pextreactive.getL2(); + ehubChannelPostsValue[37] = pextreactive.getL3(); + + // pinv + jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(14)).toString(); + GetGeneralLx pinv = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + ehubChannelPostsValue[38] = pinv.getL1(); + ehubChannelPostsValue[39] = pinv.getL2(); + ehubChannelPostsValue[40] = pinv.getL3(); + + // pinvreactive + jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(15)).toString(); + GetGeneralLx pinvreactive = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + ehubChannelPostsValue[41] = pinvreactive.getL1(); + ehubChannelPostsValue[42] = pinvreactive.getL2(); + ehubChannelPostsValue[43] = pinvreactive.getL3(); + + // pload + jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(16)).toString(); + GetGeneralLx pload = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + ehubChannelPostsValue[44] = pload.getL1(); + ehubChannelPostsValue[45] = pload.getL2(); + ehubChannelPostsValue[46] = pload.getL3(); + + // ploadreactive + jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(17)).toString(); + GetGeneralLx ploadreactive = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + ehubChannelPostsValue[47] = ploadreactive.getL1(); + ehubChannelPostsValue[48] = ploadreactive.getL2(); + ehubChannelPostsValue[49] = ploadreactive.getL3(); + + // ppv + jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(18)).toString(); + GetGeneralValues ppv = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(19)).toString(); + GetUdc udc = gson.fromJson(jsonElementsStringTemp, GetUdc.class); + ehubChannelPostsValue[50] = ppv.getVal(); + ehubChannelPostsValue[51] = udc.getPos(); + ehubChannelPostsValue[52] = udc.getNeg(); + + // wextprodq + jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(20)).toString(); + GetGeneralLx wextprodq = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + ehubChannelPostsValue[53] = mJTokWh(jsonStripEhub(wextprodq.getL1())); + ehubChannelPostsValue[54] = mJTokWh(jsonStripEhub(wextprodq.getL2())); + ehubChannelPostsValue[55] = mJTokWh(jsonStripEhub(wextprodq.getL3())); + + // wextconsq + jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(21)).toString(); + GetGeneralLx wextconsq = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + ehubChannelPostsValue[56] = mJTokWh(jsonStripEhub(wextconsq.getL1())); + ehubChannelPostsValue[57] = mJTokWh(jsonStripEhub(wextconsq.getL2())); + ehubChannelPostsValue[58] = mJTokWh(jsonStripEhub(wextconsq.getL3())); + + // winvprodq + jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(22)).toString(); + GetGeneralLx winvprodq = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + ehubChannelPostsValue[59] = mJTokWh(jsonStripEhub(winvprodq.getL1())); + ehubChannelPostsValue[60] = mJTokWh(jsonStripEhub(winvprodq.getL2())); + ehubChannelPostsValue[61] = mJTokWh(jsonStripEhub(winvprodq.getL3())); + + // winvconsq + jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(23)).toString(); + GetGeneralLx winvconsq = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + ehubChannelPostsValue[62] = mJTokWh(jsonStripEhub(winvconsq.getL1())); + ehubChannelPostsValue[63] = mJTokWh(jsonStripEhub(winvconsq.getL2())); + ehubChannelPostsValue[64] = mJTokWh(jsonStripEhub(winvconsq.getL3())); + + // wloadprodq + jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(24)).toString(); + GetGeneralLx wloadprodq = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + ehubChannelPostsValue[65] = mJTokWh(jsonStripEhub(wloadprodq.getL1())); + ehubChannelPostsValue[66] = mJTokWh(jsonStripEhub(wloadprodq.getL2())); + ehubChannelPostsValue[67] = mJTokWh(jsonStripEhub(wloadprodq.getL3())); + + // wloadconsq + jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(25)).toString(); + GetGeneralLx wloadconsq = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + ehubChannelPostsValue[68] = mJTokWh(jsonStripEhub(wloadconsq.getL1())); + ehubChannelPostsValue[69] = mJTokWh(jsonStripEhub(wloadconsq.getL2())); + ehubChannelPostsValue[70] = mJTokWh(jsonStripEhub(wloadconsq.getL3())); + + // wextprodq_3p + jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(26)).toString(); + GetGeneralValues wextprodq_3p = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + ehubChannelPostsValue[71] = mJTokWh(jsonStripOneLiners(wextprodq_3p.getVal())); + + // wextconsq_3p + jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(27)).toString(); + GetGeneralValues wextconsq3p = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + ehubChannelPostsValue[72] = mJTokWh(jsonStripOneLiners(wextconsq3p.getVal())); + + // winvprodq_3p + jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(28)).toString(); + GetGeneralValues winvprodq3p = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + ehubChannelPostsValue[73] = mJTokWh(jsonStripOneLiners(winvprodq3p.getVal())); + + // winvconsq_3p + jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(29)).toString(); + GetGeneralValues winvconsq3p = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + ehubChannelPostsValue[74] = mJTokWh(jsonStripOneLiners(winvconsq3p.getVal())); + + // wloadprodq_3p + jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(30)).toString(); + GetGeneralValues wloadprodq3p = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + ehubChannelPostsValue[75] = mJTokWh(jsonStripOneLiners(wloadprodq3p.getVal())); + + // wloadconsq_3p + jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(31)).toString(); + GetGeneralValues wloadconsq3p = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + ehubChannelPostsValue[76] = mJTokWh(jsonStripOneLiners(wloadconsq3p.getVal())); + + // wpv + jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(32)).toString(); + GetGeneralValues wpv = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + ehubChannelPostsValue[77] = mJTokWh(jsonStripOneLiners(wpv.getVal())); + + // state + jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(33)).toString(); + GetGeneralValues state = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + ehubChannelPostsValue[78] = jsonStripOneLiners(state.getVal()); + + // ts + jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(34)).toString(); + GetGeneralValues ts = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + ehubChannelPostsValue[79] = ts.getVal(); + + ehubChannelsUpdateValues = ehubChannelPostsValue; + } + + // Prepare actual Json-topic Sso-messages and update values for channels + @SuppressWarnings("null") + void processIncomingJsonMessageSso(String topic, String messageJsonSso) { + String[] ssoS0ChannelPostsValue = new String[9]; // Array for SSOS0 ( Solar String Optimizer ) Posts + String[] ssoS1ChannelPostsValue = new String[9]; // Array for SSOS1 ( Solar String Optimizer ) Posts + String[] ssoS2ChannelPostsValue = new String[9]; // Array for SSOS2 ( Solar String Optimizer ) Posts + String[] ssoS3ChannelPostsValue = new String[9]; // Array for SSOS3 ( Solar String Optimizer ) Posts + + String jsonElementsStringTempS0 = ""; + String jsonElementsStringTempS1 = ""; + String jsonElementsStringTempS2 = ""; + String jsonElementsStringTempS3 = ""; + Gson gson = new Gson(); + + JsonObject jsonElementsObjectSsoS0 = new Gson().fromJson(new Gson().fromJson(messageJsonSso, JsonObject.class), + JsonObject.class); + jsonElementsStringTempS0 = jsonElementsObjectSsoS0.get(SsoJsonElements.getJsonElementsSso().get(0)).toString(); + GetGeneralValues idS0 = gson.fromJson(jsonElementsStringTempS0, GetGeneralValues.class); + GetGeneralValues idSso = gson.fromJson(jsonElementsStringTempS0, GetGeneralValues.class); + + if (isSsoChecked == false) { + if (ssoS0IdCheck.isEmpty() && ssoS1IdCheck.isEmpty() && ssoS2IdCheck.isEmpty() && ssoS3IdCheck.isEmpty()) { + ssoS0IdCheck = idSso.getVal(); + } else { + if (!ssoS0IdCheck.isEmpty() && ssoS1IdCheck.isEmpty() && ssoS2IdCheck.isEmpty() + && ssoS3IdCheck.isEmpty()) { + ssoS1IdCheck = idSso.getVal(); + // isSsoChecked = true; + } else { + if (!ssoS0IdCheck.isEmpty() && !ssoS1IdCheck.isEmpty() && ssoS2IdCheck.isEmpty() + && ssoS3IdCheck.isEmpty()) { + ssoS2IdCheck = idSso.getVal(); + } else { + if (!ssoS0IdCheck.isEmpty() && !ssoS1IdCheck.isEmpty() && !ssoS2IdCheck.isEmpty() + && ssoS3IdCheck.isEmpty()) { + ssoS3IdCheck = idSso.getVal(); + isSsoChecked = true; + } + } + } + } + } + + if (idS0.getVal().equals(ssoS0IdCheck)) { + // id + jsonElementsStringTempS0 = jsonElementsObjectSsoS0.get(SsoJsonElements.getJsonElementsSso().get(0)) + .toString(); + idS0 = gson.fromJson(jsonElementsStringTempS0, GetGeneralValues.class); + ssoS0ChannelPostsValue[0] = idS0.getVal(); + + // upv + jsonElementsStringTempS0 = jsonElementsObjectSsoS0.get(SsoJsonElements.getJsonElementsSso().get(1)) + .toString(); + GetGeneralValues upvS0 = gson.fromJson(jsonElementsStringTempS0, GetGeneralValues.class); + ssoS0ChannelPostsValue[1] = upvS0.getVal(); + + // ipv + jsonElementsStringTempS0 = jsonElementsObjectSsoS0.get(SsoJsonElements.getJsonElementsSso().get(2)) + .toString(); + GetGeneralValues ipvS0 = gson.fromJson(jsonElementsStringTempS0, GetGeneralValues.class); + ssoS0ChannelPostsValue[2] = ipvS0.getVal(); + + // wpv + jsonElementsStringTempS0 = jsonElementsObjectSsoS0.get(SsoJsonElements.getJsonElementsSso().get(3)) + .toString(); + GetGeneralValues wpvS0 = gson.fromJson(jsonElementsStringTempS0, GetGeneralValues.class); + ssoS0ChannelPostsValue[3] = mJTokWh(jsonStripOneLiners(wpvS0.getVal())); + + // relaystatus + jsonElementsStringTempS0 = jsonElementsObjectSsoS0.get(SsoJsonElements.getJsonElementsSso().get(4)) + .toString(); + GetGeneralValues relaystatusS0 = gson.fromJson(jsonElementsStringTempS0, GetGeneralValues.class); + ssoS0ChannelPostsValue[4] = relaystatusS0.getVal(); + + // temp + jsonElementsStringTempS0 = jsonElementsObjectSsoS0.get(SsoJsonElements.getJsonElementsSso().get(5)) + .toString(); + GetGeneralValues tempS0 = gson.fromJson(jsonElementsStringTempS0, GetGeneralValues.class); + ssoS0ChannelPostsValue[5] = tempS0.getVal(); + + // faultcode + jsonElementsStringTempS0 = jsonElementsObjectSsoS0.get(SsoJsonElements.getJsonElementsSso().get(6)) + .toString(); + GetGeneralValues faultcodeS0 = gson.fromJson(jsonElementsStringTempS0, GetGeneralValues.class); + ssoS0ChannelPostsValue[6] = faultcodeS0.getVal(); + + // udc + jsonElementsStringTempS0 = jsonElementsObjectSsoS0.get(SsoJsonElements.getJsonElementsSso().get(7)) + .toString(); + GetGeneralValues udcS0 = gson.fromJson(jsonElementsStringTempS0, GetGeneralValues.class); + ssoS0ChannelPostsValue[7] = udcS0.getVal(); + + // ts + jsonElementsStringTempS0 = jsonElementsObjectSsoS0.get(SsoJsonElements.getJsonElementsSso().get(8)) + .toString(); + GetGeneralValues tsS0 = gson.fromJson(jsonElementsStringTempS0, GetGeneralValues.class); + ssoS0ChannelPostsValue[8] = tsS0.getVal(); + + ssoS0ChannelsUpdateValues = ssoS0ChannelPostsValue; + } + + JsonObject jsonElementsObjectSsoS1 = new Gson().fromJson(new Gson().fromJson(messageJsonSso, JsonObject.class), + JsonObject.class); + jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(0)).toString(); + GetGeneralValues idS1 = gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class); + + if (idS1.getVal().equals(ssoS1IdCheck)) { + // id + jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(0)) + .toString(); + idS1 = gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class); + ssoS1ChannelPostsValue[0] = idS1.getVal(); + + // upv + jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(1)) + .toString(); + GetGeneralValues upvS1 = gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class); + ssoS1ChannelPostsValue[1] = upvS1.getVal(); + + // ipv + jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(2)) + .toString(); + GetGeneralValues ipvS1 = gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class); + ssoS1ChannelPostsValue[2] = ipvS1.getVal(); + + // wpv + jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(3)) + .toString(); + GetGeneralValues wpvS1 = gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class); + ssoS1ChannelPostsValue[3] = mJTokWh(jsonStripOneLiners(wpvS1.getVal())); + + // relaystatus + jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(4)) + .toString(); + GetGeneralValues relaystatusS1 = gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class); + ssoS1ChannelPostsValue[4] = relaystatusS1.getVal(); + + // temp + jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(5)) + .toString(); + GetGeneralValues tempS1 = gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class); + ssoS1ChannelPostsValue[5] = tempS1.getVal(); + + // faultcode + jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(6)) + .toString(); + GetGeneralValues faultcodeS1 = gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class); + ssoS1ChannelPostsValue[6] = faultcodeS1.getVal(); + + // udc + jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(7)) + .toString(); + GetGeneralValues udc = gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class); + ssoS1ChannelPostsValue[7] = udc.getVal(); + + // ts + jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(8)) + .toString(); + GetGeneralValues tsS1 = gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class); + ssoS1ChannelPostsValue[8] = tsS1.getVal(); + + ssoS1ChannelsUpdateValues = ssoS1ChannelPostsValue; + } + + JsonObject jsonElementsObjectSsoS2 = new Gson().fromJson(new Gson().fromJson(messageJsonSso, JsonObject.class), + JsonObject.class); + jsonElementsStringTempS2 = jsonElementsObjectSsoS2.get(SsoJsonElements.getJsonElementsSso().get(0)).toString(); + GetGeneralValues idS2 = gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class); + + if (idS2.getVal().equals(ssoS2IdCheck)) { + // id + jsonElementsStringTempS2 = jsonElementsObjectSsoS2.get(SsoJsonElements.getJsonElementsSso().get(0)) + .toString(); + idS2 = gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class); + ssoS2ChannelPostsValue[0] = idS2.getVal(); + + // upv + jsonElementsStringTempS2 = jsonElementsObjectSsoS2.get(SsoJsonElements.getJsonElementsSso().get(1)) + .toString(); + GetGeneralValues upvS2 = gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class); + ssoS2ChannelPostsValue[1] = upvS2.getVal(); + + // ipv + jsonElementsStringTempS2 = jsonElementsObjectSsoS2.get(SsoJsonElements.getJsonElementsSso().get(2)) + .toString(); + GetGeneralValues ipvS2 = gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class); + ssoS2ChannelPostsValue[2] = ipvS2.getVal(); + + // wpv + jsonElementsStringTempS2 = jsonElementsObjectSsoS2.get(SsoJsonElements.getJsonElementsSso().get(3)) + .toString(); + GetGeneralValues wpvS2 = gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class); + ssoS2ChannelPostsValue[3] = mJTokWh(jsonStripOneLiners(wpvS2.getVal())); + + // relaystatus + jsonElementsStringTempS2 = jsonElementsObjectSsoS2.get(SsoJsonElements.getJsonElementsSso().get(4)) + .toString(); + GetGeneralValues relaystatusS2 = gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class); + ssoS2ChannelPostsValue[4] = relaystatusS2.getVal(); + + // temp + jsonElementsStringTempS2 = jsonElementsObjectSsoS2.get(SsoJsonElements.getJsonElementsSso().get(5)) + .toString(); + GetGeneralValues tempS2 = gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class); + ssoS2ChannelPostsValue[5] = tempS2.getVal(); + + // faultcode + jsonElementsStringTempS2 = jsonElementsObjectSsoS2.get(SsoJsonElements.getJsonElementsSso().get(6)) + .toString(); + GetGeneralValues faultcodeS2 = gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class); + ssoS2ChannelPostsValue[6] = faultcodeS2.getVal(); + + // udc + jsonElementsStringTempS2 = jsonElementsObjectSsoS2.get(SsoJsonElements.getJsonElementsSso().get(7)) + .toString(); + GetGeneralValues udcS2 = gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class); + ssoS2ChannelPostsValue[7] = udcS2.getVal(); + + // ts + jsonElementsStringTempS2 = jsonElementsObjectSsoS2.get(SsoJsonElements.getJsonElementsSso().get(8)) + .toString(); + GetGeneralValues tsS2 = gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class); + ssoS2ChannelPostsValue[8] = tsS2.getVal(); + + ssoS2ChannelsUpdateValues = ssoS2ChannelPostsValue; + } + + JsonObject jsonElementsObjectSsoS3 = new Gson().fromJson(new Gson().fromJson(messageJsonSso, JsonObject.class), + JsonObject.class); + jsonElementsStringTempS3 = jsonElementsObjectSsoS3.get(SsoJsonElements.getJsonElementsSso().get(0)).toString(); + GetGeneralValues idS3 = gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class); + + if (idS3.getVal().equals(ssoS3IdCheck)) { + // id + jsonElementsStringTempS3 = jsonElementsObjectSsoS3.get(SsoJsonElements.getJsonElementsSso().get(0)) + .toString(); + idS3 = gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class); + ssoS3ChannelPostsValue[0] = idS3.getVal(); + + // upv + jsonElementsStringTempS3 = jsonElementsObjectSsoS3.get(SsoJsonElements.getJsonElementsSso().get(1)) + .toString(); + GetGeneralValues upvS3 = gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class); + ssoS3ChannelPostsValue[1] = upvS3.getVal(); + + // ipv + jsonElementsStringTempS3 = jsonElementsObjectSsoS3.get(SsoJsonElements.getJsonElementsSso().get(2)) + .toString(); + GetGeneralValues ipvS3 = gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class); + ssoS3ChannelPostsValue[2] = ipvS3.getVal(); + + // wpv + jsonElementsStringTempS3 = jsonElementsObjectSsoS3.get(SsoJsonElements.getJsonElementsSso().get(3)) + .toString(); + GetGeneralValues wpvS3 = gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class); + ssoS3ChannelPostsValue[3] = mJTokWh(jsonStripOneLiners(wpvS3.getVal())); + + // relaystatus + jsonElementsStringTempS3 = jsonElementsObjectSsoS3.get(SsoJsonElements.getJsonElementsSso().get(4)) + .toString(); + GetGeneralValues relaystatusS3 = gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class); + ssoS3ChannelPostsValue[4] = relaystatusS3.getVal(); + + // temp + jsonElementsStringTempS3 = jsonElementsObjectSsoS3.get(SsoJsonElements.getJsonElementsSso().get(5)) + .toString(); + GetGeneralValues tempS3 = gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class); + ssoS3ChannelPostsValue[5] = tempS3.getVal(); + + // faultcode + jsonElementsStringTempS3 = jsonElementsObjectSsoS3.get(SsoJsonElements.getJsonElementsSso().get(6)) + .toString(); + GetGeneralValues faultcode = gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class); + ssoS3ChannelPostsValue[6] = faultcode.getVal(); + + // udc + jsonElementsStringTempS3 = jsonElementsObjectSsoS3.get(SsoJsonElements.getJsonElementsSso().get(7)) + .toString(); + GetGeneralValues udcS3 = gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class); + ssoS3ChannelPostsValue[7] = udcS3.getVal(); + + // ts + jsonElementsStringTempS3 = jsonElementsObjectSsoS3.get(SsoJsonElements.getJsonElementsSso().get(8)) + .toString(); + GetGeneralValues tsS3 = gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class); + ssoS3ChannelPostsValue[8] = tsS3.getVal(); + + ssoS3ChannelsUpdateValues = ssoS3ChannelPostsValue; + } + + if ("extapi/data/eso".equals(topic)) { + String[] esoChannelPostsValue = new String[10]; // Array for ESO, Energy Storage Optimizer ) Posts + JsonObject jsonElementsObject = new Gson().fromJson(new Gson().fromJson(messageJsonSso, JsonObject.class), + JsonObject.class); + + String jsonElementsStringTemp = ""; + + // faultcode + jsonElementsStringTemp = jsonElementsObject.get(EsoJsonElements.getJsonElementsEso().get(0)).toString(); + GetGeneralValues faultcode = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + esoChannelPostsValue[0] = faultcode.getVal(); + + // id + jsonElementsStringTemp = jsonElementsObject.get(EsoJsonElements.getJsonElementsEso().get(1)).toString(); + GetGeneralValues id = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + esoChannelPostsValue[1] = id.getVal(); + + // ibat + jsonElementsStringTemp = jsonElementsObject.get(EsoJsonElements.getJsonElementsEso().get(2)).toString(); + GetGeneralValues ibat = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + esoChannelPostsValue[2] = ibat.getVal(); + + // ubat + jsonElementsStringTemp = jsonElementsObject.get(EsoJsonElements.getJsonElementsEso().get(3)).toString(); + GetGeneralValues ubat = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + esoChannelPostsValue[3] = ubat.getVal(); + + // relaystatus + jsonElementsStringTemp = jsonElementsObject.get(EsoJsonElements.getJsonElementsEso().get(4)).toString(); + GetGeneralValues relaystatus = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + esoChannelPostsValue[4] = relaystatus.getVal(); + + // soc + jsonElementsStringTemp = jsonElementsObject.get(EsoJsonElements.getJsonElementsEso().get(5)).toString(); + GetGeneralValues soc = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + esoChannelPostsValue[5] = soc.getVal(); + + // temp + jsonElementsStringTemp = jsonElementsObject.get(EsoJsonElements.getJsonElementsEso().get(6)).toString(); + GetGeneralValues temp = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + esoChannelPostsValue[6] = temp.getVal(); + + // wbatprod + jsonElementsStringTemp = jsonElementsObject.get(EsoJsonElements.getJsonElementsEso().get(7)).toString(); + GetGeneralValues wbatprod = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + esoChannelPostsValue[7] = mJTokWh(jsonStripOneLiners(wbatprod.getVal())); + + // udc + jsonElementsStringTemp = jsonElementsObject.get(EsoJsonElements.getJsonElementsEso().get(8)).toString(); + GetGeneralValues udc = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + esoChannelPostsValue[8] = udc.getVal(); + + // ts + jsonElementsStringTemp = jsonElementsObject.get(EsoJsonElements.getJsonElementsEso().get(9)).toString(); + GetGeneralValues ts = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + esoChannelPostsValue[9] = ts.getVal(); + + esoChannelsUpdateValues = esoChannelPostsValue; + } + + if ("extapi/data/esm".equals(topic)) { + String[] esmChannelPostsValue = new String[7]; // Array for ESM, Energy Storage Module ) Posts + JsonObject jsonElementsObject = new Gson().fromJson(new Gson().fromJson(messageJsonSso, JsonObject.class), + JsonObject.class); + + String jsonElementsStringTemp = ""; + + // soc + jsonElementsStringTemp = jsonElementsObject.get(EsmJsonElements.getJsonElementsEsm().get(0)).toString(); + GetGeneralValues soc = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + esmChannelPostsValue[0] = soc.getVal(); + + // soh + jsonElementsStringTemp = jsonElementsObject.get(EsmJsonElements.getJsonElementsEsm().get(1)).toString(); + GetGeneralValues soh = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + esmChannelPostsValue[1] = soh.getVal(); + + // ratedcapacity + jsonElementsStringTemp = jsonElementsObject.get(EsmJsonElements.getJsonElementsEsm().get(2)).toString(); + GetGeneralValues ratedcapacity = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + esmChannelPostsValue[2] = ratedcapacity.getVal(); + + // id + jsonElementsStringTemp = jsonElementsObject.get(EsmJsonElements.getJsonElementsEsm().get(3)).toString(); + GetGeneralValues id = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + esmChannelPostsValue[3] = id.getVal(); + + // ratedpower + jsonElementsStringTemp = jsonElementsObject.get(EsmJsonElements.getJsonElementsEsm().get(4)).toString(); + GetGeneralValues ratedpower = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + esmChannelPostsValue[4] = ratedpower.getVal(); + + // status + jsonElementsStringTemp = jsonElementsObject.get(EsmJsonElements.getJsonElementsEsm().get(5)).toString(); + GetGeneralValues status = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + esmChannelPostsValue[5] = status.getVal(); + + // ts + jsonElementsStringTemp = jsonElementsObject.get(EsmJsonElements.getJsonElementsEsm().get(6)).toString(); + GetGeneralValues ts = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + esmChannelPostsValue[6] = ts.getVal(); + + esmChannelsUpdateValues = esmChannelPostsValue; + } + + } + + public @Nullable static String[] getEhubChannelUpdateValues() { + try { + return ehubChannelsUpdateValues; + } catch (Exception e) { + logger.debug("Failed at update of Ehub channel values"); + } + return ehubChannelsUpdateValues; + } + + public @Nullable static String[] getSsoS0ChannelUpdateValues() { + try { + return ssoS0ChannelsUpdateValues; + } catch (Exception e) { + logger.debug("Failed at update of SsoS0 channel values"); + } + return ssoS0ChannelsUpdateValues; + } + + public @Nullable static String[] getSsoS1ChannelUpdateValues() { + try { + return ssoS1ChannelsUpdateValues; + } catch (Exception e) { + logger.debug("Failed at update of SsoS1 channel values"); + } + return ssoS1ChannelsUpdateValues; + } + + public @Nullable static String[] getSsoS2ChannelUpdateValues() { + try { + return ssoS2ChannelsUpdateValues; + } catch (Exception e) { + logger.debug("Failed at update of SsoS2 channel values"); + } + return ssoS2ChannelsUpdateValues; + } + + public @Nullable static String[] getSsoS3ChannelUpdateValues() { + try { + return ssoS3ChannelsUpdateValues; + } catch (Exception e) { + logger.debug("Failed at update of SsoS3 channel values"); + } + return ssoS3ChannelsUpdateValues; + } + + public @Nullable static String[] getEsoChannelUpdateValues() { + try { + return esoChannelsUpdateValues; + } catch (Exception e) { + logger.debug("Failed at update of Eso channel values"); + } + return esoChannelsUpdateValues; + } + + public @Nullable static String[] getEsmChannelUpdateValues() { + try { + return esmChannelsUpdateValues; + } catch (Exception e) { + logger.debug("Failed at update of Esm channel values"); + } + return esmChannelsUpdateValues; + } + + public String jsonStripEhub(String jsonStringEhub) { + return jsonStringEhub.replaceAll("\"", ""); + } + + public String jsonStripOneLiners(String jsonStringOneLiners) { + return jsonStringOneLiners.replace("{", "").replace("\"", "").replace("val", "").replace(":", "").replace("}", + ""); + } + + public String mJTokWh(String actualmJ) { + Double actualkWhD = (Double.parseDouble(actualmJ) / 3600000000.0); + return actualkWhD.toString(); + } +} diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/SsoJsonElements.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/SsoJsonElements.java new file mode 100644 index 0000000000000..b6af865f37919 --- /dev/null +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/SsoJsonElements.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) 2010-2024 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.ferroamp.internal; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.jdt.annotation.NonNullByDefault; + +/** + * The {@link EhubParameters} is responsible for all parameters regarded to EHUB + * + * @author Örjan Backsell - Initial contribution + * + */ + +@NonNullByDefault +public class SsoJsonElements { + public String ssoJsonElements; + + public SsoJsonElements(String ssoJsonElements) { + this.ssoJsonElements = ssoJsonElements; + } + + public static List getJsonElementsSso() { + final List jsonElementsSso = new ArrayList<>(); + jsonElementsSso.add(new String("id")); + jsonElementsSso.add(new String("upv")); + jsonElementsSso.add(new String("ipv")); + jsonElementsSso.add(new String("wpv")); + jsonElementsSso.add(new String("relaystatus")); + jsonElementsSso.add(new String("temp")); + jsonElementsSso.add(new String("faultcode")); + jsonElementsSso.add(new String("udc")); + jsonElementsSso.add(new String("ts")); + + return jsonElementsSso; + } +} diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/SsoParameters.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/SsoParameters.java new file mode 100644 index 0000000000000..d6c27880885f9 --- /dev/null +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/SsoParameters.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) 2010-2024 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +/** + * Copyright (c) 2010-2024 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ + +package org.openhab.binding.ferroamp.internal; + +import java.util.Arrays; +import java.util.List; + +import org.eclipse.jdt.annotation.NonNullByDefault; + +/** + * The {@link SsoParameters} is responsible for all parameters regarded to SSO + * + * @author Örjan Backsell - Initial contribution + * + */ + +@NonNullByDefault +public class SsoParameters { + + public static List getChannelParametersSso() { + final List channelParametersSs0 = Arrays.asList("id", "measured-voltage-pv-string", + "measured-current-pv-string", "total-solar-energy", "relay-status", "temperature", "fault-code", + "dc-link-voltage", "timestamp"); + return channelParametersSs0; + } +} \ No newline at end of file diff --git a/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/addon/addon.xml b/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/addon/addon.xml new file mode 100644 index 0000000000000..890710efc7ba7 --- /dev/null +++ b/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/addon/addon.xml @@ -0,0 +1,11 @@ + + + + binding + Ferroamp Binding + This is the binding for Ferroamp EnergyHub. + local + + diff --git a/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/i18n/ferroamp.properties b/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/i18n/ferroamp.properties new file mode 100644 index 0000000000000..fe647c621870b --- /dev/null +++ b/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/i18n/ferroamp.properties @@ -0,0 +1,459 @@ +# add-on + +addon.ferroamp.name = Ferroamp Binding +addon.ferroamp.description = This is the binding for Ferroamp EnergyHub. + +# thing types + +thing-type.ferroamp.energyhub.label = Ferroamp EnergyHub +thing-type.ferroamp.energyhub.description = Represents the Ferroamp EnergyHub +thing-type.ferroamp.energyhub.channel.ace-current-l1.label = ACE Current L1 +thing-type.ferroamp.energyhub.channel.ace-current-l2.label = ACE Current L2 +thing-type.ferroamp.energyhub.channel.ace-current-l3.label = ACE Current L3 +thing-type.ferroamp.energyhub.channel.apparent-power.label = Apparent Power +thing-type.ferroamp.energyhub.channel.battery-energy-consumed.label = Battery Energy Consumed +thing-type.ferroamp.energyhub.channel.battery-energy-produced.label = Battery Energy Produced +thing-type.ferroamp.energyhub.channel.consumption-power-l1.label = Consumption Power L1 +thing-type.ferroamp.energyhub.channel.consumption-power-l2.label = Consumption Power L2 +thing-type.ferroamp.energyhub.channel.consumption-power-l3.label = Consumption Power L3 +thing-type.ferroamp.energyhub.channel.consumption-power-reactive-l1.label = Consumption Power Reactive L1 +thing-type.ferroamp.energyhub.channel.consumption-power-reactive-l2.label = Consumption Power Reactive L2 +thing-type.ferroamp.energyhub.channel.consumption-power-reactive-l3.label = Consumption Power Reactive L3 +thing-type.ferroamp.energyhub.channel.esm-rated-power-battery.label = Esm Rated Power of Battery +thing-type.ferroamp.energyhub.channel.esm-soc.label = Esm System State of Charge +thing-type.ferroamp.energyhub.channel.esm-soh.label = Esm System State of Health +thing-type.ferroamp.energyhub.channel.esm-status.label = Esm Status +thing-type.ferroamp.energyhub.channel.esm-timestamp.label = Esm Time Stamp When Message was Published +thing-type.ferroamp.energyhub.channel.esm-total-rated-capacity-all-batteries.label = Esm Rated Capacity +thing-type.ferroamp.energyhub.channel.esm-unique-identifier.label = Esm Unique Identifier +thing-type.ferroamp.energyhub.channel.eso-battery-energy-consumed.label = Eso Battery Energy Consumed +thing-type.ferroamp.energyhub.channel.eso-battery-energy-produced.label = Eso Battery Energy Produced +thing-type.ferroamp.energyhub.channel.eso-dc-link-voltage.label = Eso DC Link Voltage +thing-type.ferroamp.energyhub.channel.eso-fault-code.label = Eso FaultCode +thing-type.ferroamp.energyhub.channel.eso-relay-status.label = Eso RelayStatus +thing-type.ferroamp.energyhub.channel.eso-soc.label = Eso State of Charge +thing-type.ferroamp.energyhub.channel.eso-temperature.label = ESO Temperature Measured on PCB +thing-type.ferroamp.energyhub.channel.eso-timestamp.label = Eso Time Stamp When Message was Published +thing-type.ferroamp.energyhub.channel.eso-unique-identifier.label = Eso Unique Identifier +thing-type.ferroamp.energyhub.channel.external-energy-consumed-3p.label = External Energy Consumed 3p +thing-type.ferroamp.energyhub.channel.external-energy-consumed-l1.label = External Energy Consumed L1 +thing-type.ferroamp.energyhub.channel.external-energy-consumed-l2.label = External Energy Consumed L2 +thing-type.ferroamp.energyhub.channel.external-energy-consumed-l3.label = External Energy Consumed L3 +thing-type.ferroamp.energyhub.channel.external-energy-produced-3p.label = External Energy Produced 3p +thing-type.ferroamp.energyhub.channel.external-energy-produced-l1.label = External Energy Produced L1 +thing-type.ferroamp.energyhub.channel.external-energy-produced-l2.label = External Energy Produced L2 +thing-type.ferroamp.energyhub.channel.external-energy-produced-l3.label = External Energy Produced L3 +thing-type.ferroamp.energyhub.channel.external-voltage-l1.label = External Voltage L1 +thing-type.ferroamp.energyhub.channel.external-voltage-l2.label = External Voltage L2 +thing-type.ferroamp.energyhub.channel.external-voltage-l3.label = External Voltage L3 +thing-type.ferroamp.energyhub.channel.grid-current-active-l1.label = Grid Current Active L1 +thing-type.ferroamp.energyhub.channel.grid-current-active-l2.label = Grid Current Active L2 +thing-type.ferroamp.energyhub.channel.grid-current-active-l3.label = Grid Current Active L3 +thing-type.ferroamp.energyhub.channel.grid-current-l1.label = Grid Current L1 +thing-type.ferroamp.energyhub.channel.grid-current-l2.label = Grid Current L2 +thing-type.ferroamp.energyhub.channel.grid-current-l3.label = Grid Current L3 +thing-type.ferroamp.energyhub.channel.grid-current-reactive-l1.label = Grid Reactive Current L1 +thing-type.ferroamp.energyhub.channel.grid-current-reactive-l2.label = Grid Reactive Current L2 +thing-type.ferroamp.energyhub.channel.grid-current-reactive-l3.label = Grid Reactive Current L3 +thing-type.ferroamp.energyhub.channel.grid-frequency.label = Estimated Grid Frequency +thing-type.ferroamp.energyhub.channel.grid-power-active-l1.label = Grid Power Active L1 +thing-type.ferroamp.energyhub.channel.grid-power-active-l2.label = Grid Power Active L2 +thing-type.ferroamp.energyhub.channel.grid-power-active-l3.label = Grid Power Active L3 +thing-type.ferroamp.energyhub.channel.grid-power-reactive-l1.label = Grid Power Reactive L1 +thing-type.ferroamp.energyhub.channel.grid-power-reactive-l2.label = Grid Power Reactive L2 +thing-type.ferroamp.energyhub.channel.grid-power-reactive-l3.label = Grid Power Reactive L3 +thing-type.ferroamp.energyhub.channel.inverter-current-active-l1.label = Inverter Active Current L1 +thing-type.ferroamp.energyhub.channel.inverter-current-active-l2.label = Inverter Active Current L2 +thing-type.ferroamp.energyhub.channel.inverter-current-active-l3.label = Inverter Active Current L3 +thing-type.ferroamp.energyhub.channel.inverter-current-reactive-l1.label = Inverter Reactive Current L1 +thing-type.ferroamp.energyhub.channel.inverter-current-reactive-l2.label = Inverter Reactive Current L2 +thing-type.ferroamp.energyhub.channel.inverter-current-reactive-l3.label = Inverter Reactive Current L3 +thing-type.ferroamp.energyhub.channel.inverter-energy-consumed-3p.label = Inverter Energy Consumed 3p +thing-type.ferroamp.energyhub.channel.inverter-energy-consumed-l1.label = Inverter Energy Consumed L1 +thing-type.ferroamp.energyhub.channel.inverter-energy-consumed-l2.label = Inverter Energy Consumed L2 +thing-type.ferroamp.energyhub.channel.inverter-energy-consumed-l3.label = Inverter Energy Consumed L3 +thing-type.ferroamp.energyhub.channel.inverter-energy-produced-3p.label = Inverter Energy Produced 3p +thing-type.ferroamp.energyhub.channel.inverter-energy-produced-l1.label = Inverter Energy Produced L1 +thing-type.ferroamp.energyhub.channel.inverter-energy-produced-l2.label = Inverter Energy Produced L2 +thing-type.ferroamp.energyhub.channel.inverter-energy-produced-l3.label = Inverter Energy Produced L3 +thing-type.ferroamp.energyhub.channel.inverter-load-l1.label = Inverter Load L1 +thing-type.ferroamp.energyhub.channel.inverter-load-l2.label = Inverter Load L2 +thing-type.ferroamp.energyhub.channel.inverter-load-l3.label = Inverter Load L3 +thing-type.ferroamp.energyhub.channel.inverter-power-active-l1.label = Inverter Power Active L1 +thing-type.ferroamp.energyhub.channel.inverter-power-active-l2.label = Inverter Power Active L2 +thing-type.ferroamp.energyhub.channel.inverter-power-active-l3.label = Inverter Power Active L3 +thing-type.ferroamp.energyhub.channel.inverter-power-reactive-l1.label = Inverter Power Reactive L1 +thing-type.ferroamp.energyhub.channel.inverter-power-reactive-l2.label = Inverter Power Reactive L2 +thing-type.ferroamp.energyhub.channel.inverter-power-reactive-l3.label = Inverter Power Reactive L3 +thing-type.ferroamp.energyhub.channel.inverter-reactive-current-l1.label = Inverter Reactive Current L1 +thing-type.ferroamp.energyhub.channel.inverter-reactive-current-l2.label = Inverter Reactive Current L2 +thing-type.ferroamp.energyhub.channel.inverter-reactive-current-l3.label = Inverter Reactive Current L3 +thing-type.ferroamp.energyhub.channel.inverter-rms-current-l1.label = Inverter RMS Current L1 +thing-type.ferroamp.energyhub.channel.inverter-rms-current-l2.label = Inverter RMS Current L2 +thing-type.ferroamp.energyhub.channel.inverter-rms-current-l3.label = Inverter RMS Current L3 +thing-type.ferroamp.energyhub.channel.load-energy-consumed-3p.label = Load Energy Consumed 3p +thing-type.ferroamp.energyhub.channel.load-energy-consumed-l1.label = Load Energy Consumed L1 +thing-type.ferroamp.energyhub.channel.load-energy-consumed-l2.label = Load Energy Consumed L2 +thing-type.ferroamp.energyhub.channel.load-energy-consumed-l3.label = Load Energy Consumed L3 +thing-type.ferroamp.energyhub.channel.load-energy-produced-3p.label = Load Energy Produced 3p +thing-type.ferroamp.energyhub.channel.load-energy-produced-l1.label = Load Energy Produced L1 +thing-type.ferroamp.energyhub.channel.load-energy-produced-l2.label = Load Energy Produced L2 +thing-type.ferroamp.energyhub.channel.load-energy-produced-l3.label = Load Energy Produced L3 +thing-type.ferroamp.energyhub.channel.measured-current-battery.label = Eso Current Measured on Battery Side +thing-type.ferroamp.energyhub.channel.measured-voltage-battery.label = Eso Voltage Measured on Battery Side +thing-type.ferroamp.energyhub.channel.negative-dc-link-voltage.label = Negative DC Link Voltage +thing-type.ferroamp.energyhub.channel.positive-dc-link-voltage.label = Positive DC Link Voltage +thing-type.ferroamp.energyhub.channel.power-battery.label = Battery Power +thing-type.ferroamp.energyhub.channel.request-auto.label = RequestAuto +thing-type.ferroamp.energyhub.channel.request-charge.label = RequestCharge +thing-type.ferroamp.energyhub.channel.request-discharge.label = RequestDischarge +thing-type.ferroamp.energyhub.channel.request-extapi-version.label = RequestExtapiVersion +thing-type.ferroamp.energyhub.channel.s0-dc-link-voltage.label = S0 DC Link Voltage +thing-type.ferroamp.energyhub.channel.s0-fault-code.label = S0 FaultCode +thing-type.ferroamp.energyhub.channel.s0-id.label = S0 ID +thing-type.ferroamp.energyhub.channel.s0-measured-current-pv-string.label = S0 Measured Current on PV String Side +thing-type.ferroamp.energyhub.channel.s0-measured-voltage-pv-string.label = S0 Measured Voltage on PV String Side +thing-type.ferroamp.energyhub.channel.s0-relay-status.label = S0 RelayStatus +thing-type.ferroamp.energyhub.channel.s0-temperature.label = S0 Temperature Measured on PCB +thing-type.ferroamp.energyhub.channel.s0-timestamp.label = S0 Time Stamp When Message was Published +thing-type.ferroamp.energyhub.channel.s0-total-solar-energy.label = S0 Total Solar Energy +thing-type.ferroamp.energyhub.channel.s1-dc-link-voltage.label = S1 DC Link Voltage +thing-type.ferroamp.energyhub.channel.s1-fault-code.label = S1 FaultCode +thing-type.ferroamp.energyhub.channel.s1-id.label = S1 ID +thing-type.ferroamp.energyhub.channel.s1-measured-current-pv-string.label = S1 Measured Current on PV String Side +thing-type.ferroamp.energyhub.channel.s1-measured-voltage-pv-string.label = S1 Measured Voltage on PV String Side +thing-type.ferroamp.energyhub.channel.s1-relay-status.label = S1 RelayStatus +thing-type.ferroamp.energyhub.channel.s1-temperature.label = S1 Temperature Measured on PCB +thing-type.ferroamp.energyhub.channel.s1-timestamp.label = S1 Time Stamp When Message was Published +thing-type.ferroamp.energyhub.channel.s1-total-solar-energy.label = S1 Total Solar Energy +thing-type.ferroamp.energyhub.channel.s2-dc-link-voltage.label = S2 DC Link Voltage +thing-type.ferroamp.energyhub.channel.s2-fault-code.label = S2 FaultCode +thing-type.ferroamp.energyhub.channel.s2-id.label = S2 ID +thing-type.ferroamp.energyhub.channel.s2-measured-current-pv-string.label = S2 Measured Current on PV String Side +thing-type.ferroamp.energyhub.channel.s2-measured-voltage-pv-string.label = S2 Measured Voltage on PV String Side +thing-type.ferroamp.energyhub.channel.s2-relay-status.label = S2 RelayStatus +thing-type.ferroamp.energyhub.channel.s2-temperature.label = S2 Temperature Measured on PCB +thing-type.ferroamp.energyhub.channel.s2-timestamp.label = S2 Time Stamp When Message was Published +thing-type.ferroamp.energyhub.channel.s2-total-solar-energy.label = S2 Total Solar Energy +thing-type.ferroamp.energyhub.channel.s3-dc-link-voltage.label = S3 DC Link Voltage +thing-type.ferroamp.energyhub.channel.s3-fault-code.label = S3 FaultCode +thing-type.ferroamp.energyhub.channel.s3-id.label = S3 ID +thing-type.ferroamp.energyhub.channel.s3-measured-current-pv-string.label = S3 Measured Current on PV String Side +thing-type.ferroamp.energyhub.channel.s3-measured-voltage-pv-string.label = S3 Measured Voltage on PV String Side +thing-type.ferroamp.energyhub.channel.s3-relay-status.label = S3 RelayStatus +thing-type.ferroamp.energyhub.channel.s3-temperature.label = S3 Temperature Measured on PCB +thing-type.ferroamp.energyhub.channel.s3-timestamp.label = S3 Time Stamp When Message was Published +thing-type.ferroamp.energyhub.channel.s3-total-solar-energy.label = S3 Total Solar Energy +thing-type.ferroamp.energyhub.channel.soc.label = System State of Charge +thing-type.ferroamp.energyhub.channel.soh.label = System State of Health +thing-type.ferroamp.energyhub.channel.solar-pv.label = Solar Power +thing-type.ferroamp.energyhub.channel.state.label = State of the System +thing-type.ferroamp.energyhub.channel.timestamp.label = Time Stamp When Message was Published +thing-type.ferroamp.energyhub.channel.total-rated-capacity-all-batteries.label = Total Rated Capacity of All Batteries +thing-type.ferroamp.energyhub.channel.total-solar-energy.label = Total Solar Energy +thing-type.ferroamp.energyhub.label = Ferroamp Binding Thing +thing-type.ferroamp.energyhub.description = Thing for Ferroamp Binding + +# thing types config + +thing-type.config.ferroamp.energyhub.esm.label = ESM Module Available +thing-type.config.ferroamp.energyhub.esm.description = ESM Module Available +thing-type.config.ferroamp.energyhub.eso.label = ESO Module Available +thing-type.config.ferroamp.energyhub.eso.description = ESO Module Available +thing-type.config.ferroamp.energyhub.hasBattery.label = Battery Capable +thing-type.config.ferroamp.energyhub.hasBattery.description = Ehub type, with/without battery +thing-type.config.ferroamp.energyhub.hostName.label = Hostname +thing-type.config.ferroamp.energyhub.hostName.description = Hostname or IP address of the device +thing-type.config.ferroamp.energyhub.password.label = Password +thing-type.config.ferroamp.energyhub.password.description = Password to access the device +thing-type.config.ferroamp.energyhub.ssoS0.label = SSO String S0 Available +thing-type.config.ferroamp.energyhub.ssoS0.description = First SSO Unit Available +thing-type.config.ferroamp.energyhub.ssoS1.label = SSO String S1 Available +thing-type.config.ferroamp.energyhub.ssoS1.description = Second SSO Unit Available +thing-type.config.ferroamp.energyhub.ssoS2.label = SSO String S2 Available +thing-type.config.ferroamp.energyhub.ssoS2.description = Third SSO Unit Available +thing-type.config.ferroamp.energyhub.ssoS3.label = SSO String S3 Available +thing-type.config.ferroamp.energyhub.ssoS3.description = Fourth SSO Unit Available +thing-type.config.ferroamp.energyhub.userName.label = Username +thing-type.config.ferroamp.energyhub.userName.description = Username to access the device + +# channel group types + +channel-group-type.ferroamp.date-time.label = Date Time +channel-group-type.ferroamp.dimensionless.label = Dimensionless +channel-group-type.ferroamp.electric-current.label = Electric Current +channel-group-type.ferroamp.electric-potential.label = Electrical Potential +channel-group-type.ferroamp.energy.label = Energy +channel-group-type.ferroamp.frequency.label = Frequency +channel-group-type.ferroamp.power.label = Power +channel-group-type.ferroamp.string.label = String +channel-group-type.ferroamp.temperature.label = Temperature + +# channel types + +channel-type.ferroamp.date-time.label = Date Time +channel-type.ferroamp.dimensionless.label = Dimensionless +channel-type.ferroamp.electric-current.label = Electric Current +channel-type.ferroamp.electric-potential.label = Electrical Potential +channel-type.ferroamp.energy.label = Energy +channel-type.ferroamp.frequency.label = Frequency +channel-type.ferroamp.power.label = Power +channel-type.ferroamp.request-extapiversion.label = Request-ExtapiVersion +channel-type.ferroamp.request-extapiversion.description = Returns Extapi Version +channel-type.ferroamp.request.label = String +channel-type.ferroamp.request.description = Used for control of system +channel-type.ferroamp.string.label = String +channel-type.ferroamp.temperature.label = Temperature + +# channel types + +channel-type.ferroamp.ehub-gridfreq.label = EHUB, Estimated Grid Frequency +channel-type.ferroamp.ehub-gridfreq.description = Estimated grid frequency +channel-type.ferroamp.ehub-iace-l1.label = EHUB, ACE Equalization L1 +channel-type.ferroamp.ehub-iace-l1.description = ACE equalization l1 +channel-type.ferroamp.ehub-iace-l2.label = EHUB, ACE Equalization L2 +channel-type.ferroamp.ehub-iace-l2.description = ACE equalization l2 +channel-type.ferroamp.ehub-iace-l3.label = EHUB, ACE Equalization L3 +channel-type.ferroamp.ehub-iace-l3.description = ACE equalization l3 +channel-type.ferroamp.ehub-iext-l1.label = EHUB, External/Grid RMS Current L1 +channel-type.ferroamp.ehub-iext-l1.description = External/Grid rms current l1 +channel-type.ferroamp.ehub-iext-l2.label = EHUB, External/Grid RMS Current L2 +channel-type.ferroamp.ehub-iext-l2.description = External/Grid rms current l2 +channel-type.ferroamp.ehub-iext-l3.label = EHUB, External/Grid RMS Current L3 +channel-type.ferroamp.ehub-iext-l3.description = External/Grid rms current l3 +channel-type.ferroamp.ehub-iextd-l1.label = EHUB, External/Grid Reactive Current L1 +channel-type.ferroamp.ehub-iextd-l1.description = External/Grid reactive current l1 +channel-type.ferroamp.ehub-iextd-l2.label = EHUB, External/Grid Reactive Current L2 +channel-type.ferroamp.ehub-iextd-l2.description = External/Grid reactive current l2 +channel-type.ferroamp.ehub-iextd-l3.label = EHUB, External/Grid Reactive Current L3 +channel-type.ferroamp.ehub-iextd-l3.description = External/Grid reactive current l3 +channel-type.ferroamp.ehub-iextq-l1.label = EHUB, External/Grid Active Current L1 +channel-type.ferroamp.ehub-iextq-l1.description = External/Grid active current l1 +channel-type.ferroamp.ehub-iextq-l2.label = EHUB, External/Grid Active Current L2 +channel-type.ferroamp.ehub-iextq-l2.description = External/Grid active current l2 +channel-type.ferroamp.ehub-iextq-l3.label = EHUB, External/Grid Active Current L3 +channel-type.ferroamp.ehub-iextq-l3.description = External/Grid active current l3 +channel-type.ferroamp.ehub-il-l1.label = EHUB, Inverter RMS Current L1 +channel-type.ferroamp.ehub-il-l1.description = Inverter rms current l1 +channel-type.ferroamp.ehub-il-l2.label = EHUB, Inverter RMS Current L2 +channel-type.ferroamp.ehub-il-l2.description = Inverter rms current l2 +channel-type.ferroamp.ehub-il-l3.label = EHUB, Inverter RMS Current L3 +channel-type.ferroamp.ehub-il-l3.description = Inverter rms current l3 +channel-type.ferroamp.ehub-ild-l1.label = EHUB, Inverter Reactive Current L1 +channel-type.ferroamp.ehub-ild-l1.description = Inverter reactive current l1 +channel-type.ferroamp.ehub-ild-l2.label = EHUB, Inverter Reactive Current L2 +channel-type.ferroamp.ehub-ild-l2.description = Inverter reactive current l2 +channel-type.ferroamp.ehub-ild-l3.label = EHUB, Inverter Reactive Current L3 +channel-type.ferroamp.ehub-ild-l3.description = Inverter reactive current l3 +channel-type.ferroamp.ehub-iloadd-l1.label = EHUB, ILoadd L1 +channel-type.ferroamp.ehub-iloadd-l2.label = EHUB, ILoadd L2 +channel-type.ferroamp.ehub-iloadd-l3.label = EHUB, ILoadd L3 +channel-type.ferroamp.ehub-iloadq-l1.label = EHUB, ILoadq L1 +channel-type.ferroamp.ehub-iloadq-l2.label = EHUB, ILoadq L2 +channel-type.ferroamp.ehub-iloadq-l3.label = EHUB, ILoadq L3 +channel-type.ferroamp.ehub-ilq-l1.label = EHUB, Inverter Active Current L1 +channel-type.ferroamp.ehub-ilq-l1.description = Inverter active current l1 +channel-type.ferroamp.ehub-ilq-l2.label = EHUB, Inverter Active Current L2 +channel-type.ferroamp.ehub-ilq-l2.description = Inverter active current l2 +channel-type.ferroamp.ehub-ilq-l3.label = EHUB, Inverter Active Current L3 +channel-type.ferroamp.ehub-ilq-l3.description = Inverter active current l3 +channel-type.ferroamp.ehub-pbat.label = EHUB, Power Batteries +channel-type.ferroamp.ehub-pbat.description = Only sent when system has batteries +channel-type.ferroamp.ehub-pext-l1.label = EHUB, External/Grid Power, Active L1 +channel-type.ferroamp.ehub-pext-l1.description = External/Grid power, active l1 +channel-type.ferroamp.ehub-pext-l2.label = EHUB, External/Grid Power, Active L2 +channel-type.ferroamp.ehub-pext-l2.description = External/Grid power, active l2 +channel-type.ferroamp.ehub-pext-l3.label = EHUB, External/Grid Power, Active L3 +channel-type.ferroamp.ehub-pext-l3.description = External/Grid power, active l3 +channel-type.ferroamp.ehub-pextreactive-l1.label = EHUB, External/Grid Power, Reactive L1 +channel-type.ferroamp.ehub-pextreactive-l1.description = External/Grid power, reactive l1 +channel-type.ferroamp.ehub-pextreactive-l2.label = EHUB, External/Grid Power, Reactive L2 +channel-type.ferroamp.ehub-pextreactive-l2.description = External/Grid power, reactive l2 +channel-type.ferroamp.ehub-pextreactive-l3.label = EHUB, External/Grid Power, Reactive L3 +channel-type.ferroamp.ehub-pextreactive-l3.description = External/Grid power, reactive l3 +channel-type.ferroamp.ehub-pinv-l1.label = EHUB, Inverter Power, Active L1 +channel-type.ferroamp.ehub-pinv-l1.description = Inverter power, active l1 +channel-type.ferroamp.ehub-pinv-l2.label = EHUB, Inverter Power, Active L2 +channel-type.ferroamp.ehub-pinv-l2.description = Inverter power, active l2 +channel-type.ferroamp.ehub-pinv-l3.label = EHUB, Inverter Power, Active L3 +channel-type.ferroamp.ehub-pinv-l3.description = Inverter power, active l3 +channel-type.ferroamp.ehub-pinvreactive-l1.label = EHUB, Inverter Power, Reactive L1 +channel-type.ferroamp.ehub-pinvreactive-l1.description = Inverter power, reactive l1 +channel-type.ferroamp.ehub-pinvreactive-l2.label = EHUB, Inverter Power, Reactive L2 +channel-type.ferroamp.ehub-pinvreactive-l2.description = Inverter power, reactive l2 +channel-type.ferroamp.ehub-pinvreactive-l3.label = EHUB, Inverter Power, Reactive L3 +channel-type.ferroamp.ehub-pinvreactive-l3.description = Inverter power, reactive l3 +channel-type.ferroamp.ehub-pload-l1.label = EHUB, PLoad L1 +channel-type.ferroamp.ehub-pload-l2.label = EHUB, PLoad L2 +channel-type.ferroamp.ehub-pload-l3.label = EHUB, PLoad L3 +channel-type.ferroamp.ehub-ploadreactive-l1.label = EHUB, PLoadReactive L1 +channel-type.ferroamp.ehub-ploadreactive-l2.label = EHUB, PLoadReactive L2 +channel-type.ferroamp.ehub-ploadreactive-l3.label = EHUB, PLoadReactive L3 +channel-type.ferroamp.ehub-ppv.label = EHUB, Power PV +channel-type.ferroamp.ehub-ppv.description = Only sent when system has pv +channel-type.ferroamp.ehub-ratedcap.label = EHUB, Total Rated Capacity Batteries +channel-type.ferroamp.ehub-ratedcap.description = Total rated capacity of all batteries in the system +channel-type.ferroamp.ehub-sext.label = EHUB, Apparent Power +channel-type.ferroamp.ehub-sext.description = Apparent power +channel-type.ferroamp.ehub-soc.label = EHUB, Soc +channel-type.ferroamp.ehub-soc.description = State of charge for the EHUB +channel-type.ferroamp.ehub-soh.label = EHUB, Soh +channel-type.ferroamp.ehub-soh.description = State of health for the EHUB +channel-type.ferroamp.ehub-state.label = EHUB, State Of The System +channel-type.ferroamp.ehub-state.description = State of the system +channel-type.ferroamp.ehub-ts.label = EHUB, Time Stamp +channel-type.ferroamp.ehub-ts.description = Time stamp when message was published +channel-type.ferroamp.ehub-udcneg.label = EHUB, Negativ DC Link Voltage +channel-type.ferroamp.ehub-udcneg.description = Negativ dc link voltage +channel-type.ferroamp.ehub-udcpos.label = EHUB, Positiv DC Link Voltage +channel-type.ferroamp.ehub-udcpos.description = Positiv dc link voltage +channel-type.ferroamp.ehub-ul-l1.label = EHUB, External Voltage L1 +channel-type.ferroamp.ehub-ul-l1.description = External voltage l1 +channel-type.ferroamp.ehub-ul-l2.label = EHUB, External Voltage L2 +channel-type.ferroamp.ehub-ul-l2.description = External voltage l2 +channel-type.ferroamp.ehub-ul-l3.label = EHUB, External Voltage L3 +channel-type.ferroamp.ehub-ul-l3.description = External voltage l3 +channel-type.ferroamp.ehub-wbatprod.label = EHUB, Produced Power Batteries +channel-type.ferroamp.ehub-wbatprod.description = Only sent when system has batteries +channel-type.ferroamp.ehub-wextconsq-l1.label = EHUB, WExtConsq L1 +channel-type.ferroamp.ehub-wextconsq-l2.label = EHUB, WExtConsq L2 +channel-type.ferroamp.ehub-wextconsq-l3.label = EHUB, WExtConsq L3 +channel-type.ferroamp.ehub-wextconsq_3p.label = EHUB, WExtConsq_3p +channel-type.ferroamp.ehub-wextprodq-l1.label = EHUB, WExtProdq L1 +channel-type.ferroamp.ehub-wextprodq-l2.label = EHUB, WExtProdq L2 +channel-type.ferroamp.ehub-wextprodq-l3.label = EHUB, WExtProdq L3 +channel-type.ferroamp.ehub-wextprodq_3p.label = EHUB, WExtProdq_3p +channel-type.ferroamp.ehub-winvconsq-l1.label = EHUB, WInvConsq L1 +channel-type.ferroamp.ehub-winvconsq-l2.label = EHUB, WInvConsq L2 +channel-type.ferroamp.ehub-winvconsq-l3.label = EHUB, WInvConsq L3 +channel-type.ferroamp.ehub-winvconsq_3p.label = EHUB, WInvConsq_3p +channel-type.ferroamp.ehub-winvprodq-l1.label = EHUB, WInvProdq L1 +channel-type.ferroamp.ehub-winvprodq-l2.label = EHUB, WInvProdq L2 +channel-type.ferroamp.ehub-winvprodq-l3.label = EHUB, WInvProdq L3 +channel-type.ferroamp.ehub-winvprodq_3p.label = EHUB, WInvProdq_3p +channel-type.ferroamp.ehub-wloadconsq-l1.label = EHUB, WLoadConsq L1 +channel-type.ferroamp.ehub-wloadconsq-l2.label = EHUB, WLoadConsq L2 +channel-type.ferroamp.ehub-wloadconsq-l3.label = EHUB, WLoadConsq L3 +channel-type.ferroamp.ehub-wloadconsq_3p.label = EHUB, WLoadConsq_3p +channel-type.ferroamp.ehub-wloadprodq-l1.label = EHUB, WLoadProdq L1 +channel-type.ferroamp.ehub-wloadprodq-l2.label = EHUB, WLoadProdq L2 +channel-type.ferroamp.ehub-wloadprodq-l3.label = EHUB, WLoadProdq L3 +channel-type.ferroamp.ehub-wloadprodq_3p.label = EHUB, WLoadProdq_3p +channel-type.ferroamp.ehub-wpbatcons.label = EHUB, Consumed Power Batteries +channel-type.ferroamp.ehub-wpbatcons.description = Only sent when system has batteries +channel-type.ferroamp.ehub-wpv.label = EHUB, PV Power +channel-type.ferroamp.ehub-wpv.description = Only sent when system has pv +channel-type.ferroamp.esm-id.label = ESM, Unique Identifier Of Battery. +channel-type.ferroamp.esm-id.description = Unique identifier of battery. If available, this will be the unique id that the battery reports. +channel-type.ferroamp.esm-rated-capacity.label = ESM, Rated Capacity Of Battery +channel-type.ferroamp.esm-rated-capacity.description = Rated capacity of battery +channel-type.ferroamp.esm-rated-power.label = ESM, Rated Power Of Battery +channel-type.ferroamp.esm-rated-power.description = Rated power of battery +channel-type.ferroamp.esm-soc.label = ESM, Soc +channel-type.ferroamp.esm-soc.description = State of charge for the ESM +channel-type.ferroamp.esm-soh.label = ESM, Soh +channel-type.ferroamp.esm-soh.description = State of health for the ESM +channel-type.ferroamp.esm-status.label = ESM, Battery Status +channel-type.ferroamp.esm-status.description = Dependent on battery manufacturer +channel-type.ferroamp.esm-ts.label = ESM, Time Stamp +channel-type.ferroamp.esm-ts.description = Time stamp when message was published +channel-type.ferroamp.eso-faultcode.label = ESO, Fault Code +channel-type.ferroamp.eso-faultcode.description = See section 4.1.3.1 below for further explanation of fault codes +channel-type.ferroamp.eso-ibat.label = ESO, Current On Battery Side +channel-type.ferroamp.eso-ibat.description = Measured on battery side +channel-type.ferroamp.eso-id.label = ESO, Unique Identifier +channel-type.ferroamp.eso-id.description = Unique identifier +channel-type.ferroamp.eso-relaystatus.label = ESO, Relay Status +channel-type.ferroamp.eso-relaystatus.description = 0 = relay closed, 1 = relay open +channel-type.ferroamp.eso-soc.label = ESO, Soc +channel-type.ferroamp.eso-soc.description = State of charge for ESO +channel-type.ferroamp.eso-temp.label = ESO, Temperature +channel-type.ferroamp.eso-temp.description = Temperature measured inside ESO +channel-type.ferroamp.eso-ts.label = ESO, Time stamp +channel-type.ferroamp.eso-ts.description = Time stamp when message was published +channel-type.ferroamp.eso-ubat.label = ESO, Voltage On Battery Side +channel-type.ferroamp.eso-ubat.description = Measured on battery side +channel-type.ferroamp.eso-udc.label = ESO, DC Link Voltage +channel-type.ferroamp.eso-udc.description = Dc link voltage as measured by ESO +channel-type.ferroamp.eso-wbatprod.label = ESO, Total Energy Produced +channel-type.ferroamp.eso-wbatprod.description = Total energy produced by ESO, i.e total energy discharged +channel-type.ferroamp.eso-wpbatcons.label = ESO, Total Energy Consumed +channel-type.ferroamp.eso-wpbatcons.description = Total energy consumed by ESO, i.e total energy charged +channel-type.ferroamp.request-auto.label = Configure Auto Power +channel-type.ferroamp.request-auto.description = Set auto power +channel-type.ferroamp.request-charge.label = Configure Charge Power +channel-type.ferroamp.request-charge.description = Charge power in watt +channel-type.ferroamp.request-discharge.label = Configure Discharge Power +channel-type.ferroamp.request-discharge.description = Discharge power in watt +channel-type.ferroamp.ssos0-faultcode.label = SSO, String-0, Fault Code +channel-type.ferroamp.ssos0-faultcode.description = 0x00 = OK, For all other values please contact Ferroamp support +channel-type.ferroamp.ssos0-id.label = SSO, String-0, Unique Identifier +channel-type.ferroamp.ssos0-id.description = Unique identifier of SSO +channel-type.ferroamp.ssos0-ipv.label = SSO, String-0, Current On PV String Side +channel-type.ferroamp.ssos0-ipv.description = Measured on pv string side +channel-type.ferroamp.ssos0-relaystatus.label = SSO, String-0, Relay Status +channel-type.ferroamp.ssos0-relaystatus.description = 0 = relay closed (i.e running power), 1 = relay open/disconnected, 2 = precharge +channel-type.ferroamp.ssos0-temp.label = SSO, String-0, Temperature +channel-type.ferroamp.ssos0-temp.description = Temperature measured on pcb of SSO +channel-type.ferroamp.ssos0-ts.label = SSO, String-0, Time Stamp +channel-type.ferroamp.ssos0-ts.description = Time stamp when message was published +channel-type.ferroamp.ssos0-udc.label = SSO, String-0, DC Link Voltage +channel-type.ferroamp.ssos0-udc.description = Dc link voltage as measured by SSO +channel-type.ferroamp.ssos0-upv.label = SSO, String-0, Voltage On PV String Side +channel-type.ferroamp.ssos0-upv.description = Measured on pv string side +channel-type.ferroamp.ssos0-wpv.label = SSO, String-0, Total Energy Produced +channel-type.ferroamp.ssos0-wpv.description = Total energy produced by SSO +channel-type.ferroamp.ssos1-faultcode.label = SSO, String-1, Fault Code +channel-type.ferroamp.ssos1-faultcode.description = 0x00 = OK, For all other values please contact Ferroamp support +channel-type.ferroamp.ssos1-id.label = SSO, String-1, Unique Identifier +channel-type.ferroamp.ssos1-id.description = Unique identifier of SSO +channel-type.ferroamp.ssos1-ipv.label = SSO, String-1, Current On PV String Side +channel-type.ferroamp.ssos1-ipv.description = Measured on pv string side +channel-type.ferroamp.ssos1-relaystatus.label = SSO, String-1, Relay Status +channel-type.ferroamp.ssos1-relaystatus.description = 0 = relay closed (i.e running power), 1 = relay open/disconnected, 2 = precharge +channel-type.ferroamp.ssos1-temp.label = SSO, String-1, Temperature +channel-type.ferroamp.ssos1-temp.description = Temperature measured on pcb of SSO +channel-type.ferroamp.ssos1-ts.label = SSO, String-1, Time Stamp +channel-type.ferroamp.ssos1-ts.description = Time stamp when message was published +channel-type.ferroamp.ssos1-udc.label = SSO, String-1, DC Link Voltage +channel-type.ferroamp.ssos1-udc.description = Dc link voltage as measured by SSO +channel-type.ferroamp.ssos1-upv.label = SSO, String-1, Voltage On PV String Side +channel-type.ferroamp.ssos1-upv.description = Measured on pv string side +channel-type.ferroamp.ssos1-wpv.label = SSO, String-1, Total Energy Produced +channel-type.ferroamp.ssos1-wpv.description = Total energy produced by SSO +channel-type.ferroamp.ssos2-faultcode.label = SSO, String-2, Fault Code +channel-type.ferroamp.ssos2-faultcode.description = 0x00 = OK, For all other values please contact Ferroamp support +channel-type.ferroamp.ssos2-id.label = SSO, String-2, Unique Identifier +channel-type.ferroamp.ssos2-id.description = Unique identifier of SSO +channel-type.ferroamp.ssos2-ipv.label = SSO, String-2, Current On PV String Side +channel-type.ferroamp.ssos2-ipv.description = Measured on pv string side +channel-type.ferroamp.ssos2-relaystatus.label = SSO, String-2, Relay Status +channel-type.ferroamp.ssos2-relaystatus.description = 0 = relay closed (i.e running power), 1 = relay open/disconnected, 2 = precharge +channel-type.ferroamp.ssos2-temp.label = SSO, String-2, Temperature +channel-type.ferroamp.ssos2-temp.description = Temperature measured on pcb of SSO +channel-type.ferroamp.ssos2-ts.label = SSO, String-2, Time Stamp +channel-type.ferroamp.ssos2-ts.description = Time stamp when message was published +channel-type.ferroamp.ssos2-udc.label = SSO, String-2, DC Link Voltage +channel-type.ferroamp.ssos2-udc.description = Dc link voltage as measured by SSO +channel-type.ferroamp.ssos2-upv.label = SSO, String-2, Voltage On PV String Side +channel-type.ferroamp.ssos2-upv.description = Measured on pv string side +channel-type.ferroamp.ssos2-wpv.label = SSO, String-2, Total Energy Produced +channel-type.ferroamp.ssos2-wpv.description = Total energy produced by SSO +channel-type.ferroamp.ssos3-faultcode.label = SSO, String-3, Fault Code +channel-type.ferroamp.ssos3-faultcode.description = 0x00 = OK, For all other values please contact Ferroamp support +channel-type.ferroamp.ssos3-id.label = SSO, String-3, Unique Identifier +channel-type.ferroamp.ssos3-id.description = Unique identifier of SSO +channel-type.ferroamp.ssos3-ipv.label = SSO, String-3, Current On PV String Side +channel-type.ferroamp.ssos3-ipv.description = Measured on pv string side +channel-type.ferroamp.ssos3-relaystatus.label = SSO, String-3, Relay Status +channel-type.ferroamp.ssos3-relaystatus.description = 0 = relay closed (i.e running power), 1 = relay open/disconnected, 2 = precharge +channel-type.ferroamp.ssos3-temp.label = SSO, String-3, Temperature +channel-type.ferroamp.ssos3-temp.description = Temperature measured on pcb of SSO +channel-type.ferroamp.ssos3-ts.label = SSO, String-3, Time Stamp +channel-type.ferroamp.ssos3-ts.description = Time stamp when message was published +channel-type.ferroamp.ssos3-udc.label = SSO, String-3, DC Link Voltage +channel-type.ferroamp.ssos3-udc.description = Dc link voltage as measured by SSO +channel-type.ferroamp.ssos3-upv.label = SSO, String-3, Voltage On PV String Side +channel-type.ferroamp.ssos3-upv.description = Measured on pv string side +channel-type.ferroamp.ssos3-wpv.label = SSO, String-3, Total Energy Produced +channel-type.ferroamp.ssos3-wpv.description = Total energy produced by SSO diff --git a/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/channels.xml b/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/channels.xml new file mode 100644 index 0000000000000..b98d22d227245 --- /dev/null +++ b/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/channels.xml @@ -0,0 +1,101 @@ + + + + Number:Energy + + Energy + + + + + + + Number:ElectricCurrent + + Energy + + + + + + + Number:Power + + Energy + + + + + + + DateTime + + Energy + + + + + + + Number:ElectricPotential + + Energy + + + + + + + Number:Frequency + + Energy + + + + + + + Number:Dimensionless + + Energy + + + + + + + Number:Temperature + + Energy + + + + + + + String + + Energy + + + + + + + String + + Used for control of system + Energy + + + + String + + Returns Extapi Version + Energy + + + \ No newline at end of file diff --git a/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/ferroamp.xml b/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/ferroamp.xml new file mode 100644 index 0000000000000..d25104279a2e7 --- /dev/null +++ b/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/ferroamp.xml @@ -0,0 +1,449 @@ + + + + + Represents the Ferroamp EnergyHub + Energy + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Ferroamp + + + + \ No newline at end of file diff --git a/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/thing-types.xml b/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/thing-types.xml new file mode 100644 index 0000000000000..a3054e8b8b35c --- /dev/null +++ b/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/thing-types.xml @@ -0,0 +1,57 @@ + + + + + + Thing for Ferroamp Binding + + + network-address + + Hostname or IP address of the device + + + username + + Username to access the device + + + password + + Password to access the device + + + + Ehub type, with/without battery + false + + + + First SSO Unit Available + + + + Second SSO Unit Available + + + + Third SSO Unit Available + + + + Fourth SSO Unit Available + + + + ESO Module Available + + + + ESM Module Available + + + + diff --git a/bundles/pom.xml b/bundles/pom.xml index f8a7c1b0e3caa..2459811049ba1 100644 --- a/bundles/pom.xml +++ b/bundles/pom.xml @@ -1,21 +1,14 @@ - - - + 4.0.0 - org.openhab.addons org.openhab.addons.reactor 4.3.0-SNAPSHOT - org.openhab.addons.bundles org.openhab.addons.reactor.bundles pom - openHAB Add-ons :: Bundles - org.openhab.automation.groovyscripting @@ -147,6 +140,7 @@ org.openhab.binding.feed org.openhab.binding.feican org.openhab.binding.fenecon + org.openhab.binding.ferroamp org.openhab.binding.fineoffsetweatherstation org.openhab.binding.flicbutton org.openhab.binding.flume @@ -484,12 +478,10 @@ org.openhab.voice.watsonstt org.openhab.voice.whisperstt - target/dependency - org.lastnpe.eea @@ -545,7 +537,6 @@ provided - @@ -615,7 +606,6 @@ - biz.aQute.bnd @@ -681,7 +671,6 @@ - @@ -707,5 +696,4 @@ - From 00301172ca0250e3d8043da3a4ee3ec7d0ad7643 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96rjan=20Backsell?= Date: Thu, 10 Oct 2024 12:51:21 +0200 Subject: [PATCH 02/16] [ferroamp] Binding for ferroamp 20241010 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes done in FerroampHandlerFactory.java Signed-off-by: Örjan Backsell --- .../src/main/feature/feature.xml | 19 +- .../openhab/binding/ferroamp/dto/GetUdc.java | 2 +- .../ferroamp/internal/EsmJsonElements.java | 2 +- .../FerroampChannelConfiguration.java | 2 +- .../ferroamp/internal/FerroampHandler.java | 2 +- .../internal/FerroampHandlerFactory.java | 1 - .../internal/FerroampMqttCommunication.java | 1 - .../ferroamp/internal/SsoParameters.java | 2 +- .../src/main/resources/OH-INF/addon/addon.xml | 12 +- .../main/resources/OH-INF/thing/channels.xml | 198 ++-- .../main/resources/OH-INF/thing/ferroamp.xml | 894 +++++++++--------- .../resources/OH-INF/thing/thing-types.xml | 106 +-- bundles/pom.xml | 4 +- 13 files changed, 621 insertions(+), 624 deletions(-) diff --git a/bundles/org.openhab.binding.ferroamp/src/main/feature/feature.xml b/bundles/org.openhab.binding.ferroamp/src/main/feature/feature.xml index bca67f9098228..811b2ce24f635 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/feature/feature.xml +++ b/bundles/org.openhab.binding.ferroamp/src/main/feature/feature.xml @@ -1,16 +1,13 @@ - mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${ohc.version}/xml/features + mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${ohc.version}/xml/features - - openhab-runtime-base - openhab-transport-mqtt - mvn:org.openhab.addons.bundles/org.openhab.binding.mqtt/${project.version} + + openhab-runtime-base + openhab-transport-mqtt + mvn:org.openhab.addons.bundles/org.openhab.binding.mqtt/${project.version} - mvn:org.openhab.addons.bundles/org.openhab.binding.mqtt/${project.version} - mvn:org.openhab.addons.bundles/org.openhab.binding.ferroamp/${project.version} - + mvn:org.openhab.addons.bundles/org.openhab.binding.mqtt/${project.version} + mvn:org.openhab.addons.bundles/org.openhab.binding.ferroamp/${project.version} + - - - diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/dto/GetUdc.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/dto/GetUdc.java index 150419411495f..f0bdad205bb16 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/dto/GetUdc.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/dto/GetUdc.java @@ -39,4 +39,4 @@ public void setNeg(String neg) { public String getNeg() { return neg; } -} \ No newline at end of file +} diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EsmJsonElements.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EsmJsonElements.java index 7cf27958f81f4..699c3a1d8c8f2 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EsmJsonElements.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EsmJsonElements.java @@ -44,4 +44,4 @@ public static List getJsonElementsEsm() { jsonElementsEsm.add(new String("ts")); return jsonElementsEsm; } -} \ No newline at end of file +} diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampChannelConfiguration.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampChannelConfiguration.java index 8513b3f53f58f..04a5bbd1de1ca 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampChannelConfiguration.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampChannelConfiguration.java @@ -364,4 +364,4 @@ public static List getChannelConfigurationRequest( new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_REQUESTEXTAPIVERSION, Units.ONE)); return channelConfigurationRequest; } -} \ No newline at end of file +} diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java index e43e276bfe899..b4dd64aef1d94 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java @@ -275,4 +275,4 @@ public static boolean gethasBattery() { } return ferroampConfig.hasBattery; } -} \ No newline at end of file +} diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandlerFactory.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandlerFactory.java index 4c5561246cade..b317e8313d322 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandlerFactory.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandlerFactory.java @@ -1,5 +1,4 @@ /** - /** * Copyright (c) 2010-2024 Contributors to the openHAB project * * See the NOTICE file(s) distributed with this work for additional diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampMqttCommunication.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampMqttCommunication.java index 646aabc535c3e..a0dd0f1b38412 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampMqttCommunication.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampMqttCommunication.java @@ -739,7 +739,6 @@ void processIncomingJsonMessageSso(String topic, String messageJsonSso) { esmChannelsUpdateValues = esmChannelPostsValue; } - } public @Nullable static String[] getEhubChannelUpdateValues() { diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/SsoParameters.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/SsoParameters.java index d6c27880885f9..dba7ac760bbd6 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/SsoParameters.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/SsoParameters.java @@ -46,4 +46,4 @@ public static List getChannelParametersSso() { "dc-link-voltage", "timestamp"); return channelParametersSs0; } -} \ No newline at end of file +} diff --git a/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/addon/addon.xml b/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/addon/addon.xml index 890710efc7ba7..2c3f658531346 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/addon/addon.xml +++ b/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/addon/addon.xml @@ -1,11 +1,11 @@ + xmlns:addon="https://openhab.org/schemas/addon/v1.0.0" + xsi:schemaLocation="https://openhab.org/schemas/addon/v1.0.0 https://openhab.org/schemas/addon-1.0.0.xsd"> - binding - Ferroamp Binding - This is the binding for Ferroamp EnergyHub. - local + binding + Ferroamp Binding + This is the binding for Ferroamp EnergyHub. + local diff --git a/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/channels.xml b/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/channels.xml index b98d22d227245..32cf435834826 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/channels.xml +++ b/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/channels.xml @@ -1,101 +1,101 @@ - - Number:Energy - - Energy - - - - - - - Number:ElectricCurrent - - Energy - - - - - - - Number:Power - - Energy - - - - - - - DateTime - - Energy - - - - - - - Number:ElectricPotential - - Energy - - - - - - - Number:Frequency - - Energy - - - - - - - Number:Dimensionless - - Energy - - - - - - - Number:Temperature - - Energy - - - - - - - String - - Energy - - - - - - - String - - Used for control of system - Energy - - - - String - - Returns Extapi Version - Energy - - - \ No newline at end of file + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0" + xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd"> + + Number:Energy + + Energy + + + + + + + Number:ElectricCurrent + + Energy + + + + + + + Number:Power + + Energy + + + + + + + DateTime + + Energy + + + + + + + Number:ElectricPotential + + Energy + + + + + + + Number:Frequency + + Energy + + + + + + + Number:Dimensionless + + Energy + + + + + + + Number:Temperature + + Energy + + + + + + + String + + Energy + + + + + + + String + + Used for control of system + Energy + + + + String + + Returns Extapi Version + Energy + + + diff --git a/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/ferroamp.xml b/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/ferroamp.xml index d25104279a2e7..6c166b13b5ff1 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/ferroamp.xml +++ b/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/ferroamp.xml @@ -1,449 +1,449 @@ - - - Represents the Ferroamp EnergyHub - Energy - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Ferroamp - - - - \ No newline at end of file + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0" + xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd"> + + + Represents the Ferroamp EnergyHub + Energy + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Ferroamp + + + + diff --git a/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/thing-types.xml b/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/thing-types.xml index a3054e8b8b35c..af1e4cf3291a1 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/thing-types.xml +++ b/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/thing-types.xml @@ -1,57 +1,57 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0" + xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd"> - - - Thing for Ferroamp Binding - - - network-address - - Hostname or IP address of the device - - - username - - Username to access the device - - - password - - Password to access the device - - - - Ehub type, with/without battery - false - - - - First SSO Unit Available - - - - Second SSO Unit Available - - - - Third SSO Unit Available - - - - Fourth SSO Unit Available - - - - ESO Module Available - - - - ESM Module Available - - - + + + Thing for Ferroamp Binding + + + network-address + + Hostname or IP address of the device + + + username + + Username to access the device + + + password + + Password to access the device + + + + Ehub type, with/without battery + false + + + + First SSO Unit Available + + + + Second SSO Unit Available + + + + Third SSO Unit Available + + + + Fourth SSO Unit Available + + + + ESO Module Available + + + + ESM Module Available + + + diff --git a/bundles/pom.xml b/bundles/pom.xml index 2459811049ba1..eb74ebaacecd5 100644 --- a/bundles/pom.xml +++ b/bundles/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 org.openhab.addons From c399b64defd017c952c1cb64495c0dac48e0362d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96rjan=20Backsell?= Date: Thu, 10 Oct 2024 19:15:08 +0200 Subject: [PATCH 03/16] [ferroamp] Binding for ferroamp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes done in README.md, 20241010 Örjan Backsell Signed-off-by: Örjan Backsell --- bundles/org.openhab.binding.ferroamp/README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/bundles/org.openhab.binding.ferroamp/README.md b/bundles/org.openhab.binding.ferroamp/README.md index 396fb075e0f58..6e9c7241fea56 100644 --- a/bundles/org.openhab.binding.ferroamp/README.md +++ b/bundles/org.openhab.binding.ferroamp/README.md @@ -2,10 +2,10 @@ The Ferroamp binding is used to get live data from Ferroamp EnergyHub -The Ferroamp binding is compatible with EnergyHub Wall and EnergyHub XL, and use connection to your local EnergyHub via LAN or similar. +The Ferroamp binding is compatible with EnergyHub Wall and EnergyHub XL, and connects to your local EnergyHub via LAN. Data and commands are received/sent using MQTT where the user connects to the MQTT broker residing on the EnergyHub. -Contact Ferroamp support to enable MQTT in the EnergyHub and to get the Username and Password: +*note* Contact Ferroamp support to enable MQTT in the EnergyHub and to get the Username and Password: https://ferroamp.com/om-ferroamp/ @@ -13,10 +13,10 @@ https://ferroamp.com/om-ferroamp/ The binding retrieves data from the different parts of the Ferroamp EnergyHub such as: -- `Ehub`: EnergyHub Wall and EnergyHub XL. -- `Sso`: Solar string optimizer. -- `Eso`: Bidirectional DC/DC converter for connection of battery. -- `Esm`: Energy Storage Module. +- `ehub`: EnergyHub Wall and EnergyHub XL. +- `sso`: Solar string optimizer. +- `eso`: Bidirectional DC/DC converter for connection of battery. +- `esm`: Energy Storage Module. ## Discovery @@ -24,7 +24,7 @@ Discovery is not supported. ## Thing Configuration -The following configuration-parameters are available. +The following configuration parameters are available. | Name | Type | Description | Default | Required | Advanced | |-----------------|---------|------------------------------------------|---------|----------|----------| @@ -205,13 +205,13 @@ The following channels are available for `Ferroamp` EnergyHub configuration. Ple # Full Example -## Thing +## `demo.things` Example ```java Thing ferroamp:energyhub:myenergyhub [ hostName="energyhub-ip", userName="myUserName", password="myPassword", hasBattery=false ] ``` -## Items +## `demo.items` Example ```java Number:Energy Ferroamp "Load Energy Consumed L1" { channel="ferroamp:energyhub:myenergyhub:load-energy-consumed-l1" } From 5c5ebc0f86ac9b2e36c2a85755a97bca726e3a93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96rjan=20Backsell?= Date: Thu, 10 Oct 2024 22:37:08 +0200 Subject: [PATCH 04/16] [ferroamp] Binding for ferroamp 20241010_1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Done changes in EhubParameters.java, FerroampBindingConstants.java, FerroampChannelConfiguration.java, ferroamp.xml, README.md Signed-off-by: Örjan Backsell --- .../org.openhab.binding.ferroamp/README.md | 82 +++++++++---------- .../ferroamp/internal/EhubParameters.java | 10 +-- .../internal/FerroampBindingConstants.java | 24 +++--- .../FerroampChannelConfiguration.java | 40 ++++----- .../main/resources/OH-INF/thing/ferroamp.xml | 48 +++++------ 5 files changed, 102 insertions(+), 102 deletions(-) diff --git a/bundles/org.openhab.binding.ferroamp/README.md b/bundles/org.openhab.binding.ferroamp/README.md index 6e9c7241fea56..57ac7d10fe081 100644 --- a/bundles/org.openhab.binding.ferroamp/README.md +++ b/bundles/org.openhab.binding.ferroamp/README.md @@ -26,16 +26,16 @@ Discovery is not supported. The following configuration parameters are available. -| Name | Type | Description | Default | Required | Advanced | -|-----------------|---------|------------------------------------------|---------|----------|----------| -| hostName | text | Hostname or IP address of the device | N/A | yes | no | -| userName | text | Username to access the device | N/A | yes | no | -| password | text | Password to access the device | N/A | yes | no | -| hasBattery | boolean | Is there a battery connected or not? | N/A | no | yes | -| ssoS0 | boolean | Is there a first SSO unit connected? | N/A | no | no | -| ssoS1 | boolean | Is there a second SSO unit connected? | N/A | no | no | -| ssoS2 | boolean | Is there a third SSO unit connected? | N/A | no | no | -| ssoS3 | boolean | Is there a fourth SSO unit connected? | N/A | no | no | +| Name | Type | Description | Default | Required | Advanced | +|-----------------|---------|------------------------------------------ |---------|----------|----------| +| hostName | text | Hostname or IP address of the device | N/A | yes | no | +| userName | text | Username to access the device | N/A | yes | no | +| password | text | Password to access the device | N/A | yes | no | +| hasBattery | boolean | Has the system a battery connected? | N/A | no | yes | +| ssoS0 | boolean | Has the system, the 1'st Sso Pv-string connected? | N/A | no | no | +| ssoS1 | boolean | Has the system, the 2'nd Sso Pv-string connected? | N/A | no | no | +| ssoS2 | boolean | Has the system, the 3'rd Sso Pv-string connected? | N/A | no | no | +| ssoS3 | boolean | Has the system, the 4'th Sso Pv-string connected? | N/A | no | no | | The unique serial number is marked on the side of the SSO unit. Ex. PS00990-A04-S20120476 @@ -44,9 +44,9 @@ The following configuration parameters are available. | Channel Type ID | Item Type | Read/Write | Label | Description |---------------------------------------------------------------------------------------------------------------------------------------------- | grid-frequency | Number:Frequency | R | Estimated Grid Frequency | Estimated Grid Frequency | -| ace-current-l1 | Number:ElectricCurrent | R | ACE Current L1 | ACE equalization current set-points in Arms | -| ace-current-l2 | Number:ElectricCurrent | R | ACE Current L2 | ACE equalization current set-points in Arms | -| ace-current-l3 | Number:ElectricCurrent | R | ACE Current L3 | ACE equalization current set-points in Arms | +| ace-current-l1 | Number:ElectricCurrent | R | ACE Current L1 | Adaptive Current Equalization (ACE) equalization current set-points in Amps root mean square (Arms) | +| ace-current-l2 | Number:ElectricCurrent | R | ACE Current L2 | Adaptive Current Equalization (ACE) equalization current set-points in Amps root mean square (Arms) | +| ace-current-l3 | Number:ElectricCurrent | R | ACE Current L3 | Adaptive Current Equalization (ACE) equalization current set-points in Amps root mean square (Arms) | | external-voltage-l1 | Number:ElectricPotential | R | External Voltage L1 | External voltage | | external-voltage-l2 | Number:ElectricPotential | R | External Voltage L2 | External voltage | | external-voltage-l3 | Number:ElectricPotential | R | External Voltage L3 | External voltage | @@ -59,15 +59,15 @@ The following configuration parameters are available. | inverter-current-active-l1 | Number:ElectricCurrent | R | Inverter Active current L1 | Inverter active current | | inverter-current-active-l2 | Number:ElectricCurrent | R | Inverter Active current L1 | Inverter active current | | inverter-current-active-l3 | Number:ElectricCurrent | R | Inverter Active current L1 | Inverter active current | -| grid-current-l1 | Number:ElectricCurrent | R | Grid Current L1 | External/grid RMS current | -| grid-current-l2 | Number:ElectricCurrent | R | Grid Current L2 | External/grid RMS current | -| grid-current-l3 | Number:ElectricCurrent | R | Grid Current L3 | External/grid RMS current | -| grid-current-reactive-l1 | Number:ElectricCurrent | R | Grid Current Reactive L1 | External/grid current reactive | -| grid-current-reactive-l2 | Number:ElectricCurrent | R | Grid Current Reactive L2 | External/grid current reactive | -| grid-current-reactive-l3 | Number:ElectricCurrent | R | Grid Current Reactive L3 | External/grid current reactive | -| grid-current-active-l1 | Number:ElectricCurrent | R | Grid Current Active L1 | External/grid current active | -| grid-current-active-l2 | Number:ElectricCurrent | R | Grid Current Active L2 | External/grid current active | -| grid-current-active-l3 | Number:ElectricCurrent | R | Grid Current Active L3 | External/grid current active | +| grid-current-l1 | Number:ElectricCurrent | R | Grid Current L1 | Grid RMS current | +| grid-current-l2 | Number:ElectricCurrent | R | Grid Current L2 | Grid RMS current | +| grid-current-l3 | Number:ElectricCurrent | R | Grid Current L3 | Grid RMS current | +| grid-current-reactive-l1 | Number:ElectricCurrent | R | Grid Current Reactive L1 | Grid current reactive | +| grid-current-reactive-l2 | Number:ElectricCurrent | R | Grid Current Reactive L2 | Grid current reactive | +| grid-current-reactive-l3 | Number:ElectricCurrent | R | Grid Current Reactive L3 | Grid current reactive | +| grid-current-active-l1 | Number:ElectricCurrent | R | Grid Current Active L1 | Grid current active | +| grid-current-active-l2 | Number:ElectricCurrent | R | Grid Current Active L2 | Grid current active | +| grid-current-active-l3 | Number:ElectricCurrent | R | Grid Current Active L3 | Grid current active | | inverter-reactive-current-l1 | Number:ElectricCurrent | R | Inverter Reactive Current L1 | | inverter-reactive-current-l2 | Number:ElectricCurrent | R | Inverter Reactive Current L2 | | inverter-reactive-current-l3 | Number:ElectricCurrent | R | Inverter Reactive Current L3 | @@ -75,12 +75,12 @@ The following configuration parameters are available. | inverter-load-l2 | Number:ElectricCurrent | R | Inverter Load L2 | | inverter-load-l3 | Number:ElectricCurrent | R | Inverter Load L3 | | apparent-power | Number:Energy | R | Apparent Power | Apparent power -| grid-power-active-l1 | Number:Power | R | Grid Power Active L1 | External/grid power, active | -| grid-power-active-l2 | Number:Power | R | Grid Power Active L2 | External/grid power, active | -| grid-power-active-l3 | Number:Power | R | Grid Power Active L3 | External/grid power, active | -| grid-power-reactive-l1 | Number:Power | R | Grid Power Reactive L1 | External/grid power, reactive | -| grid-power-reactive-l2 | Number:Power | R | Grid Power Reactive L2 | External/grid power, reactive | -| grid-power-reactive-l3 | Number:Power | R | Grid Power Reactive L3 | External/grid power, reactive | +| grid-power-active-l1 | Number:Power | R | Grid Power Active L1 | Grid power, active | +| grid-power-active-l2 | Number:Power | R | Grid Power Active L2 | Grid power, active | +| grid-power-active-l3 | Number:Power | R | Grid Power Active L3 | Grid power, active | +| grid-power-reactive-l1 | Number:Power | R | Grid Power Reactive L1 | Grid power, reactive | +| grid-power-reactive-l2 | Number:Power | R | Grid Power Reactive L2 | Grid power, reactive | +| grid-power-reactive-l3 | Number:Power | R | Grid Power Reactive L3 | Grid power, reactive | | inverter-power-active-l1 | Number:Power | R | Inverter Power Active L1 | Inverter power, active | | inverter-power-active-l2 | Number:Power | R | Inverter Power Active L2 | Inverter power, active | | inverter-power-active-l3 | Number:Power | R | Inverter Power Active L3 | Inverter power, active | @@ -93,15 +93,15 @@ The following configuration parameters are available. | consumption-power-reactive-l1 | Number:Power | R | Consumption Power Reactive L1 | | consumption-power-reactive-l2 | Number:Power | R | Consumption Power Reactive L2 | | consumption-power-reactive-l3 | Number:Power | R | Consumption Power Reactive L3 | -| solar-pv | Number:Power | R | Solar Power | Only sent when system has PV | +| solar-pv | Number:Power | R | Solar Power | Only sent when system has PV | | positive-dc-link-voltage | Number:ElectricPotential | R | Positiv DC Link Voltage | Positiv DC link voltage | | negative-dc-link-voltage | Number:ElectricPotential | R | Negative DC Link Voltage | Negative DC link voltage | -| external-energy-produced-l1 | Number:Energy | R | External Energy Produced L1 | -| external-energy-produced-l2 | Number:Energy | R | External Energy Produced L2 | -| external-energy-produced-l3 | Number:Energy | R | External Energy Produced L3 | -| external-energy-consumed-l1 | Number:Energy | R | External Energy Consumed L1 | -| external-energy-consumed-l2 | Number:Energy | R | External Energy Consumed L2 | -| external-energy-consumed-l3 | Number:Energy | R | External Energy Consumed L3 | +| grid-energy-produced-l1 | Number:Energy | R | Grid Energy Produced L1 | +| grid-energy-produced-l2 | Number:Energy | R | Grid Energy Produced L2 | +| grid-energy-produced-l3 | Number:Energy | R | Grid Energy Produced L3 | +| grid-energy-consumed-l1 | Number:Energy | R | Grid Energy Consumed L1 | +| grid-energy-consumed-l2 | Number:Energy | R | Grid Energy Consumed L2 | +| grid-energy-consumed-l3 | Number:Energy | R | Grid Energy Consumed L3 | | inverter-energy-produced-l1 | Number:Energy | R | Inverter Energy Produced L1 | | inverter-energy-produced-l2 | Number:Energy | R | Inverter Energy Produced L2 | | inverter-energy-produced-l3 | Number:Energy | R | Inverter Energy Produced L3 | @@ -114,12 +114,12 @@ The following configuration parameters are available. | load-energy-consumed-l1 | Number:Energy | R | Load Energy Consumed L1 | | load-energy-consumed-l2 | Number:Energy | R | Load Energy Consumed L2 | | load-energy-consumed-l3 | Number:Energy | R | Load Energy Consumed L3 | -| external-energy-produced-3p | Number:Energy | R | External Energy Produced 3P | -| external-energy-consumed-3p | Number:Energy | R | External Energy Consumed 3P | -| inverter-energy-produced-3p | Number:Energy | R | Inverter Energy Produced 3P | -| inverter-energy-consumed-3p | Number:Energy | R | Inverter Energy Consumed 3P | -| load-energy-produced-3p | Number:Energy | R | Load Energy Produced 3P | -| load-energy-consumed-3p | Number:Energy | R | Load Energy Consumed 3P | +| total-grid-energy-produced | Number:Energy | R | Total produced grid energy | +| total-grid-energy-consumed | Number:Energy | R | Total consumed grid energy | +| total-inverter-energy-produced | Number:Energy | R | Total produced inverter energy | +| total-inverter-energy-consumed | Number:Energy | R | Total consumed inverter energy | +| total-load-energy-produced | Number:Energy | R | Total produced load energy | +| total-load-energy-consumed | Number:Energy | R | Total consumed load energy | | total-solar-energy | Number:Energy | R | Total Solar Energy | Only sent when system has PV | | state | String | R | State of the System | | timestamp | DateTime | R | Time Stamp When Message was Published | Time stamp when message was published | diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EhubParameters.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EhubParameters.java index cfe5d30251833..80abd87159c30 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EhubParameters.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EhubParameters.java @@ -47,14 +47,14 @@ public static List getChannelParametersEhub() { "inverter-power-reactive-l1", "inverter-power-reactive-l2", "inverter-power-reactive-l3", "consumption-power-l1", "consumption-power-l2", "consumption-power-l3", "consumption-power-reactive-l1", "consumption-power-reactive-l2", "consumption-power-reactive-l3", "solar-pv", - "positive-dc-link-voltage", "negative-dc-link-voltage", "external-energy-produced-l1", - "external-energy-produced-l2", "external-energy-produced-l3", "external-energy-consumed-l1", - "external-energy-consumed-l2", "external-energy-consumed-l3", "inverter-energy-produced-l1", + "positive-dc-link-voltage", "negative-dc-link-voltage", "grid-energy-produced-l1", + "grid-energy-produced-l2", "grid-energy-produced-l3", "grid-energy-consumed-l1", + "grid-energy-consumed-l2", "grid-energy-consumed-l3", "inverter-energy-produced-l1", "inverter-energy-produced-l2", "inverter-energy-produced-l3", "inverter-energy-consumed-l1", "inverter-energy-consumed-l2", "inverter-energy-consumed-l3", "load-energy-produced-l1", "load-energy-produced-l2", "load-energy-produced-l3", "load-energy-consumed-l1", - "load-energy-consumed-l2", "load-energy-consumed-l3", "external-energy-produced-3p", - "external-energy-consumed-3p", "inverter-energy-produced-3p", "inverter-energy-consumed-3p", + "load-energy-consumed-l2", "load-energy-consumed-l3", "grid-energy-produced-total", + "grid-energy-consumed-total", "inverter-energy-produced-total", "inverter-energy-consumed-total", "load-energy-produced-3p", "load-energy-consumed-3p", "total-solar-energy", "state", "timestamp", "battery-energy-produced", "battery-energy-consumed", "soc", "soh", "power-battery", "total-rated-capacity-all-batteries"); diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampBindingConstants.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampBindingConstants.java index 3541879ff78c6..c7ecee8de648c 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampBindingConstants.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampBindingConstants.java @@ -102,12 +102,12 @@ public class FerroampBindingConstants { public static final String CHANNEL_SOLARPV = "solar-pv"; public static final String CHANNEL_POSITIVEDCLINKVOLTAGE = "positive-dc-link-voltage"; public static final String CHANNEL_NEGATIVEDCLINKVOLTAGE = "negative-dc-link-voltage"; - public static final String CHANNEL_EXTERNALENERGYPRODUCEDL1 = "external-energy-produced-l1"; - public static final String CHANNEL_EXTERNALENERGYPRODUCEDL2 = "external-energy-produced-l2"; - public static final String CHANNEL_EXTERNALENERGYPRODUCEDL3 = "external-energy-produced-l3"; - public static final String CHANNEL_EXTERNALENERGYCONSUMEDL1 = "external-energy-consumed-l1"; - public static final String CHANNEL_EXTERNALENERGYCONSUMEDL2 = "external-energy-consumed-l2"; - public static final String CHANNEL_EXTERNALENERGYCONSUMEDL3 = "external-energy-consumed-l3"; + public static final String CHANNEL_GRIDENERGYPRODUCEDL1 = "grid-energy-produced-l1"; + public static final String CHANNEL_GRIDENERGYPRODUCEDL2 = "grid-energy-produced-l2"; + public static final String CHANNEL_GRIDENERGYPRODUCEDL3 = "grid-energy-produced-l3"; + public static final String CHANNEL_GRIDENERGYCONSUMEDL1 = "grid-energy-consumed-l1"; + public static final String CHANNEL_GRIDENERGYCONSUMEDL2 = "grid-energy-consumed-l2"; + public static final String CHANNEL_GRIDENERGYCONSUMEDL3 = "grid-energy-consumed-l3"; public static final String CHANNEL_INVERTERENERGYPRODUCEDL1 = "inverter-energy-produced-l1"; public static final String CHANNEL_INVERTERENERGYPRODUCEDL2 = "inverter-energy-produced-l2"; public static final String CHANNEL_INVERTERENERGYPRODUCEDL3 = "inverter-energy-produced-l3"; @@ -120,12 +120,12 @@ public class FerroampBindingConstants { public static final String CHANNEL_LOADENERGYCONSUMEDL1 = "load-energy-consumed-l1"; public static final String CHANNEL_LOADENERGYCONSUMEDL2 = "load-energy-consumed-l2"; public static final String CHANNEL_LOADENERGYCONSUMEDL3 = "load-energy-consumed-l3"; - public static final String CHANNEL_EXTERNALENERGYPRODUCED3P = "external-energy-produced-3p"; - public static final String CHANNEL_EXTERNALENERGYCONSUMED3P = "external-energy-consumed-3p"; - public static final String CHANNEL_INVERTERENERGYPRODUCED3P = "inverter-energy-produced-3p"; - public static final String CHANNEL_INVERTERENERGYCONSUMED3P = "inverter-energy-consumed-3p"; - public static final String CHANNEL_LOADENERGYPRODUCED3P = "load-energy-produced-3p"; - public static final String CHANNEL_LOADENERGYCONSUMED3P = "load-energy-consumed-3p"; + public static final String CHANNEL_GRIDENERGYPRODUCEDTOTAL = "grid-energy-produced-total"; + public static final String CHANNEL_GRIDENERGYCONSUMEDTOTAL = "grid-energy-consumed-total"; + public static final String CHANNEL_INVERTERENERGYPRODUCEDTOTAL = "inverter-energy-produced-total"; + public static final String CHANNEL_INVERTERENERGYCONSUMEDTOTAL = "inverter-energy-consumed-total"; + public static final String CHANNEL_LOADENERGYPRODUCEDTOTAL = "load-energy-produced-total"; + public static final String CHANNEL_LOADENERGYCONSUMEDTOTAL = "load-energy-consumed-total"; public static final String CHANNEL_TOTALSOLARENERGY = "total-solar-energy"; public static final String CHANNEL_STATE = "state"; public static final String CHANNEL_TIMESTAMP = "timestamp"; diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampChannelConfiguration.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampChannelConfiguration.java index 04a5bbd1de1ca..e80162e040c2b 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampChannelConfiguration.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampChannelConfiguration.java @@ -145,18 +145,18 @@ public static List getChannelConfigurationEhub() { new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_POSITIVEDCLINKVOLTAGE, Units.VOLT)); channelConfigurationEhub.add( new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_NEGATIVEDCLINKVOLTAGE, Units.VOLT)); - channelConfigurationEhub.add(new FerroampChannelConfiguration( - FerroampBindingConstants.CHANNEL_EXTERNALENERGYPRODUCEDL1, Units.WATT)); - channelConfigurationEhub.add(new FerroampChannelConfiguration( - FerroampBindingConstants.CHANNEL_EXTERNALENERGYPRODUCEDL2, Units.WATT)); - channelConfigurationEhub.add(new FerroampChannelConfiguration( - FerroampBindingConstants.CHANNEL_EXTERNALENERGYPRODUCEDL3, Units.WATT)); - channelConfigurationEhub.add(new FerroampChannelConfiguration( - FerroampBindingConstants.CHANNEL_EXTERNALENERGYCONSUMEDL1, Units.WATT)); - channelConfigurationEhub.add(new FerroampChannelConfiguration( - FerroampBindingConstants.CHANNEL_EXTERNALENERGYCONSUMEDL2, Units.WATT)); - channelConfigurationEhub.add(new FerroampChannelConfiguration( - FerroampBindingConstants.CHANNEL_EXTERNALENERGYCONSUMEDL3, Units.WATT)); + channelConfigurationEhub.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_GRIDENERGYPRODUCEDL1, Units.WATT)); + channelConfigurationEhub.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_GRIDENERGYPRODUCEDL2, Units.WATT)); + channelConfigurationEhub.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_GRIDENERGYPRODUCEDL3, Units.WATT)); + channelConfigurationEhub.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_GRIDENERGYCONSUMEDL1, Units.WATT)); + channelConfigurationEhub.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_GRIDENERGYCONSUMEDL2, Units.WATT)); + channelConfigurationEhub.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_GRIDENERGYCONSUMEDL3, Units.WATT)); channelConfigurationEhub.add(new FerroampChannelConfiguration( FerroampBindingConstants.CHANNEL_INVERTERENERGYPRODUCEDL1, Units.WATT)); channelConfigurationEhub.add(new FerroampChannelConfiguration( @@ -181,18 +181,18 @@ public static List getChannelConfigurationEhub() { new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_LOADENERGYCONSUMEDL2, Units.WATT)); channelConfigurationEhub.add( new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_LOADENERGYCONSUMEDL3, Units.WATT)); + channelConfigurationEhub.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_GRIDENERGYPRODUCEDTOTAL, Units.WATT)); + channelConfigurationEhub.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_GRIDENERGYCONSUMEDTOTAL, Units.WATT)); channelConfigurationEhub.add(new FerroampChannelConfiguration( - FerroampBindingConstants.CHANNEL_EXTERNALENERGYPRODUCED3P, Units.WATT)); - channelConfigurationEhub.add(new FerroampChannelConfiguration( - FerroampBindingConstants.CHANNEL_EXTERNALENERGYCONSUMED3P, Units.WATT)); - channelConfigurationEhub.add(new FerroampChannelConfiguration( - FerroampBindingConstants.CHANNEL_INVERTERENERGYPRODUCED3P, Units.WATT)); + FerroampBindingConstants.CHANNEL_INVERTERENERGYPRODUCEDTOTAL, Units.WATT)); channelConfigurationEhub.add(new FerroampChannelConfiguration( - FerroampBindingConstants.CHANNEL_INVERTERENERGYCONSUMED3P, Units.WATT)); + FerroampBindingConstants.CHANNEL_INVERTERENERGYCONSUMEDTOTAL, Units.WATT)); channelConfigurationEhub.add( - new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_LOADENERGYPRODUCED3P, Units.WATT)); + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_LOADENERGYPRODUCEDTOTAL, Units.WATT)); channelConfigurationEhub.add( - new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_LOADENERGYCONSUMED3P, Units.WATT)); + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_LOADENERGYCONSUMEDTOTAL, Units.WATT)); channelConfigurationEhub .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_TOTALSOLARENERGY, Units.WATT)); channelConfigurationEhub diff --git a/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/ferroamp.xml b/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/ferroamp.xml index 6c166b13b5ff1..a21234a8cfa23 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/ferroamp.xml +++ b/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/ferroamp.xml @@ -167,23 +167,23 @@ - - + + - - + + - - + + - - + + - - + + - - + + @@ -221,23 +221,23 @@ - - + + - - + + - - + + - - + + - - + + - - + + From d7853623b2fbad2a7082220a1fa2fbc76af4afc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96rjan=20Backsell?= Date: Fri, 11 Oct 2024 10:32:57 +0200 Subject: [PATCH 05/16] [ferroamp] Binding for ferroamp 20241011 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes done in: EsmParameters.java EsoParameters.java ferroamp.xml FerroampBindingConstants.java FerroampChannelConfiguration.java README.md SsoParameters.java Signed-off-by: Örjan Backsell --- .../org.openhab.binding.ferroamp/README.md | 32 ++++++------ .../ferroamp/internal/EhubParameters.java | 2 +- .../ferroamp/internal/EsmParameters.java | 4 +- .../ferroamp/internal/EsoParameters.java | 6 +-- .../internal/FerroampBindingConstants.java | 30 +++++------ .../FerroampChannelConfiguration.java | 52 +++++++++---------- .../ferroamp/internal/SsoParameters.java | 5 +- .../main/resources/OH-INF/thing/ferroamp.xml | 30 +++++------ 8 files changed, 80 insertions(+), 81 deletions(-) diff --git a/bundles/org.openhab.binding.ferroamp/README.md b/bundles/org.openhab.binding.ferroamp/README.md index 57ac7d10fe081..e857de7724e6b 100644 --- a/bundles/org.openhab.binding.ferroamp/README.md +++ b/bundles/org.openhab.binding.ferroamp/README.md @@ -128,11 +128,11 @@ The following configuration parameters are available. | soc | Number:Dimensionless | R | System State of Check | State of the system | | soh | Number:Dimensionless | R | System State of Health | | power-battery | Number:Power | R | Battery Power | Only sent when system has batteries | -| total-rated-capacity-all-batteries | Number:Energy | R | Total Rated Capacity of All Batteries | +| total-capacity-batteries | Number:Energy | R | Total Rated Capacity of All Batteries | -| s0-id | String | R | S0 ID | Unique identifier of SSO-0 | -| s0-measured-voltage-on-pv-string-side | Number:ElectricPotential | R | S0 Measured Voltage on PV String Side | Measured on PV string side | -| s0-measured-current-on-pv-string-side | Number:ElectricCurrent | R | S0 Measured Current on PV String Side | Measured on PV string side | +| s0-id | String | R | S0 ID | Unique identifier of SSO-0 | +| s0-pv-voltage | Number:ElectricPotential | R | S0 Measured Voltage on PV String Side | Measured on PV string side | +| s0-pv-current | Number:ElectricCurrent | R | S0 Measured Current on PV String Side | Measured on PV string side | | s0-total-solar-energy | Number:Energy | R | S0 Total Solar Energy | Total energy produced by SSO-0 | | s0-relay-status | String | R | S0 Relay Status | 0 = relay closed (i.e running power), 1 = relay open/disconnected, 2 = precharge | | s0-temperature | Number:Temperature | R | S0 Temperature Measured on PCB | Temperature Measured on PCB | @@ -141,8 +141,8 @@ The following configuration parameters are available. | s0-timestamp | DateTime | R | S0 Time Stamp When Message was Published | Time stamp when message was published | | | s1-id | String | R | S1 ID | Unique identifier of SSO-1 | -| s1-measured-voltage-on-pv-string-side | Number:ElectricPotential | R | S1 easured Voltage on PV String Side | Measured on PV string side | -| s1-measured-current-on-pv-string-side | Number:ElectricCurrent | R | S1 Measured Current on PV String Side | Measured on PV string side | +| s1-pv-voltage | Number:ElectricPotential | R | S1 easured Voltage on PV String Side | Measured on PV string side | +| s1-pv-current | Number:ElectricCurrent | R | S1 Measured Current on PV String Side | Measured on PV string side | | s1-total-solar-energy | Number:Energy | R | S1 Total Solar Energy | Total energy produced by SSO-1 | | s1-relay-status | String | R | S1 Relay Status | 0 = relay closed (i.e running power), 1 = relay open/disconnected, 2 = precharge | | s1-temperature | Number:Temperature | R | S1 Temperature Measured on PCB | Temperature Measured on PCB | @@ -152,8 +152,8 @@ The following configuration parameters are available. | | s2-id | String | R | S2 ID | Unique identifier of SSO-2 | -| s2-measured-voltage-on-pv-string-side | Number:ElectricPotential | R | S2 Measured Voltage on PV String Side | Measured on PV string side | -| s2-measured-current-on-pv-string-side | Number:ElectricCurrent | R | S2 Measured Current on PV String Side | Measured on PV string side | +| s2-pv-voltage | Number:ElectricPotential | R | S2 Measured Voltage on PV String Side | Measured on PV string side | +| s2-pv-current | Number:ElectricCurrent | R | S2 Measured Current on PV String Side | Measured on PV string side | | s2-total-solar-energy | Number:Energy | R | S2 Total Solar Energy | Total energy produced by SSO-2 | | s2-relay-status | String | R | S2 Relay Status | 0 = relay closed (i.e running power), 1 = relay open/disconnected, 2 = precharge | | s2-temperature | Number:Temperature | R | S2 Temperature Measured on PCB | Temperature Measured on PCB | @@ -163,8 +163,8 @@ The following configuration parameters are available. | | s3-id | String | R | S3 ID | Unique identifier of SSO-3 | -| s3-measured-voltage-on-pv-string-side | Number:ElectricPotential | R | S3 Measured Voltage on PV String Side | Measured on PV string side | -| s3-measured-current-on-pv-string-side | Number:ElectricCurrent | R | S3 Measured Current on PV String Side | Measured on PV string side | +| s3-pv-voltage | Number:ElectricPotential | R | S3 Measured Voltage on PV String Side | Measured on PV string side | +| s3-pv-current | Number:ElectricCurrent | R | S3 Measured Current on PV String Side | Measured on PV string side | | s3-total-solar-energy | Number:Energy | R | S3 Total Solar Energy | Total energy produced by SSO-3 | | s3-relay-status | String | R | S3 Relay Status | 0 = relay closed (i.e running power), 1 = relay open/disconnected, 2 = precharge | | s3-temperature | Number:Temperature | R | S3 Temperature Measured on PCB | Temperature Measured on PCB | @@ -173,9 +173,9 @@ The following configuration parameters are available. | s3-timestamp | DateTime | R | S3 Time Stamp When Message was Published | Time stamp when message was published | | -| eso-unique-identifier | String | R | Eso Unique Identifier | Unique identifier | -| measured-voltage-battery | Number:ElectricPotential | R | Eso Voltage Measured on Battery Side | Measured on battery side | -| measured-current-battery | Number:ElectricCurrent | R | Eso Current Measured on Battery Side | Measured on battery side | +| eso-id | String | R | Eso Unique Identifier | Unique identifier | +| eso-voltage-battery | Number:ElectricPotential | R | Eso Voltage Measured on Battery Side | Measured on battery side | +| eso-current-battery | Number:ElectricCurrent | R | Eso Current Measured on Battery Side | Measured on battery side | | eso-battery-energy-produced | Number:Energy | R | Eso Battery Energy Produced | Total energy produced by ESO, i.e total energy charged | | eso-battery-energy-consumed | Number:Energy | R | Eso Battery Energy Consumed | Total energy consumed by ESO, i.e total energy discharged | | eso-soc | Number:Dimensionless | R | Eso State of Charge | State of Charge for ESO | @@ -187,11 +187,11 @@ The following configuration parameters are available. | eso-timestamp | DateTime | R | Eso Time Stamp When Message was Published| Time stamp when message was published | -| esm-unique-identifier | String | R | Esm Unique Identifier | Unique identifier of battery. If available, this will be the unique id that the battery reports.| +| esm-id | String | R | Esm Unique Identifier | Unique identifier of battery. If available, this will be the unique id that the battery reports.| | esm-soh | Number:Dimensionless | R | Esm System State of Health | State of Health for ESM | | esm-soc | Number:Dimensionless | R | Esm System State of Charge | State of Charge for ESM | -| esm-total-rated-capacity-all-batteries | Number:Energy | R | Esm Rated Capacity | Rated capacity of battery | -| esm-rated-power-battery | Number:Power | R | Esm Rated power of battery | Rated power of battery | +| esm-total-capacity | Number:Energy | R | Esm Rated Capacity | Rated capacity of all batteries | +| esm-power-battery | Number:Power | R | Esm Rated power of battery | Rated power of battery | | esm-status | String | R | Esm Status | Dependent on battery manufacturer | | esm-timestamp | DateTime | R | Esm Time Stamp When Message was Published| Time stamp when message was published | diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EhubParameters.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EhubParameters.java index 80abd87159c30..fd9503d7c84e1 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EhubParameters.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EhubParameters.java @@ -57,7 +57,7 @@ public static List getChannelParametersEhub() { "grid-energy-consumed-total", "inverter-energy-produced-total", "inverter-energy-consumed-total", "load-energy-produced-3p", "load-energy-consumed-3p", "total-solar-energy", "state", "timestamp", "battery-energy-produced", "battery-energy-consumed", "soc", "soh", "power-battery", - "total-rated-capacity-all-batteries"); + "total-capacity-batteries"); return channelParametersEhub; } } diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EsmParameters.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EsmParameters.java index ac2b60587312d..3cd33a508a5dd 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EsmParameters.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EsmParameters.java @@ -34,8 +34,8 @@ public EsmParameters(String jsonPostEsm) { } public static List getChannelParametersEsm() { - final List channelParametersEsm = Arrays.asList("esm-unique-identifier", "esm-soh", "esm-soc", - "esm-total-rated-capacity-all-batteries", "esm-rated-power-battery", "esm-status", "esm-timestamp"); + final List channelParametersEsm = Arrays.asList("esm-id", "esm-soh", "esm-soc", "esm-total-capacity", + "esm-power-battery", "esm-status", "esm-timestamp"); return channelParametersEsm; } } diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EsoParameters.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EsoParameters.java index 844b67f7b447d..3f317dd1b12d3 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EsoParameters.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EsoParameters.java @@ -34,9 +34,9 @@ public EsoParameters(String jsonPostEso) { } public static List getChannelParametersEso() { - final List channelParametersEso = Arrays.asList("eso-unique-identifier", "eso-measured-voltage-battery", - "eso-measured-current-battery", "eso-battery-energy-produced", "eso-battery-energy-consumed", "eso-soc", - "eso-relay-status", "eso-temperature", "eso-fault-code", "eso-dc-link-voltage", "eso-timestamp"); + final List channelParametersEso = Arrays.asList("eso-id", "eso-voltage-battery", "eso-current-battery", + "eso-battery-energy-produced", "eso-battery-energy-consumed", "eso-soc", "eso-relay-status", + "eso-temperature", "eso-fault-code", "eso-dc-link-voltage", "eso-timestamp"); return channelParametersEso; } } diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampBindingConstants.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampBindingConstants.java index c7ecee8de648c..cbfe21e041eba 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampBindingConstants.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampBindingConstants.java @@ -136,12 +136,12 @@ public class FerroampBindingConstants { public static final String CHANNEL_SOC = "soc"; public static final String CHANNEL_SOH = "soh"; public static final String CHANNEL_POWERBATTERY = "power-battery"; - public static final String CHANNEL_TOTALRATEDCAPACITYALLBATTERIES = "total-rated-capacity-all-batteries"; + public static final String CHANNEL_TOTALCAPACITYBATTERIES = "total-capacity-batteries"; // List of SSO Channel ids public static final String CHANNEL_S0ID = "s0-id"; - public static final String CHANNEL_S0MEASUREDVOLTAGEPVSTRING = "s0-measured-voltage-pv-string"; - public static final String CHANNEL_S0MEASUREDCURRENTPVSTRING = "s0-measured-current-pv-string"; + public static final String CHANNEL_S0PVVOLTAGE = "s0-pv-voltage"; + public static final String CHANNEL_S0PVCURRENT = "s0-pv-current"; public static final String CHANNEL_S0TOTALSOLARENERGY = "s0-total-solar-energy"; public static final String CHANNEL_S0RELAYSTATUS = "s0-relay-status"; public static final String CHANNEL_S0TEMPERATURE = "s0-temperature"; @@ -149,8 +149,8 @@ public class FerroampBindingConstants { public static final String CHANNEL_S0DCLINKVOLTAGE = "s0-dc-link-voltage"; public static final String CHANNEL_S0TIMESTAMP = "s0-timestamp"; public static final String CHANNEL_S1ID = "s1-id"; - public static final String CHANNEL_S1MEASUREDVOLTAGEPVSTRING = "s1-measured-voltage-pv-string"; - public static final String CHANNEL_S1MEASUREDCURRENTPVSTRING = "s1-measured-current-pv-string"; + public static final String CHANNEL_S1PVVOLTAGE = "s1-pv-voltage"; + public static final String CHANNEL_S1PVCURRENT = "s1-pv-current"; public static final String CHANNEL_S1TOTALSOLARENERGY = "s1-total-solar-energy"; public static final String CHANNEL_S1RELAYSTATUS = "s1-relay-status"; public static final String CHANNEL_S1TEMPERATURE = "s1-temperature"; @@ -158,8 +158,8 @@ public class FerroampBindingConstants { public static final String CHANNEL_S1DCLINKVOLTAGE = "s1-dc-link-voltage"; public static final String CHANNEL_S1TIMESTAMP = "s1-timestamp"; public static final String CHANNEL_S2ID = "s2-id"; - public static final String CHANNEL_S2MEASUREDVOLTAGEPVSTRING = "s2-measured-voltage-pv-string"; - public static final String CHANNEL_S2MEASUREDCURRENTPVSTRING = "s2-measured-current-pv-string"; + public static final String CHANNEL_S2PVVOLTAGE = "s2-pv-voltage"; + public static final String CHANNEL_S2PVCURRENT = "s2-pv-current"; public static final String CHANNEL_S2TOTALSOLARENERGY = "s2-total-solar-energy"; public static final String CHANNEL_S2RELAYSTATUS = "s2-relay-status"; public static final String CHANNEL_S2TEMPERATURE = "s2-temperature"; @@ -167,8 +167,8 @@ public class FerroampBindingConstants { public static final String CHANNEL_S2DCLINKVOLTAGE = "s2-dc-link-voltage"; public static final String CHANNEL_S2TIMESTAMP = "s2-timestamp"; public static final String CHANNEL_S3ID = "s3-id"; - public static final String CHANNEL_S3MEASUREDVOLTAGEPVSTRING = "s3-measured-voltage-pv-string"; - public static final String CHANNEL_S3MEASUREDCURRENTPVSTRING = "s3-measured-current-pv-string"; + public static final String CHANNEL_S3PVVOLTAGE = "s3-pv-voltage"; + public static final String CHANNEL_S3PVCURRENT = "s3-pv-current"; public static final String CHANNEL_S3TOTALSOLARENERGY = "s3-total-solar-energy"; public static final String CHANNEL_S3RELAYSTATUS = "s3-relay-status"; public static final String CHANNEL_S3TEMPERATURE = "s3-temperature"; @@ -177,9 +177,9 @@ public class FerroampBindingConstants { public static final String CHANNEL_S3TIMESTAMP = "s3-timestamp"; // List of ESO Channel ids - public static final String CHANNEL_ESOUNIQUEIDENTIFIER = "eso-unique-identifier"; - public static final String CHANNEL_ESOMEASUREDVOLTAGEBATTERY = "eso-measured-voltage-battery"; - public static final String CHANNEL_ESOMEASUREDCURRENTBATTERY = "eso-measured-current-battery"; + public static final String CHANNEL_ESOID = "eso-id"; + public static final String CHANNEL_ESOVOLTAGEBATTERY = "eso-voltage-battery"; + public static final String CHANNEL_ESOCURRENTBATTERY = "eso-current-battery"; public static final String CHANNEL_ESOBATTERYENERGYPRODUCED = "eso-battery-energy-produced"; public static final String CHANNEL_ESOBATTERYENERGYCONSUMED = "eso-battery-energy-consumed"; public static final String CHANNEL_ESOSOC = "eso-soc"; @@ -190,11 +190,11 @@ public class FerroampBindingConstants { public static final String CHANNEL_ESOTIMESTAMP = "eso-timestamp"; // List of ESM Channel ids - public static final String CHANNEL_ESMUNIQUEIDENTIFIER = "esm-unique-identifier"; + public static final String CHANNEL_ESMID = "esm-id"; public static final String CHANNEL_ESMSOH = "esm-soh"; public static final String CHANNEL_ESMSOC = "esm-soc"; - public static final String CHANNEL_ESMTOTALRATEDCAPACITYALLBATTERIES = "esm-total-rated-capacity-all-batteries"; - public static final String CHANNEL_ESMRATEDPOWERBATTERY = "esm-rated-power-battery"; + public static final String CHANNEL_ESMTOTALCAPACITY = "esm-total-capacity"; + public static final String CHANNEL_ESMPOWERBATTERY = "esm-power-battery"; public static final String CHANNEL_ESMSTATUS = "esm-status"; public static final String CHANNEL_ESMTIMESTAMP = "esm-timestamp"; diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampChannelConfiguration.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampChannelConfiguration.java index e80162e040c2b..df98b94a87fec 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampChannelConfiguration.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampChannelConfiguration.java @@ -210,7 +210,7 @@ public static List getChannelConfigurationEhub() { channelConfigurationEhub .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_POWERBATTERY, Units.WATT)); channelConfigurationEhub.add(new FerroampChannelConfiguration( - FerroampBindingConstants.CHANNEL_TOTALRATEDCAPACITYALLBATTERIES, Units.WATT_HOUR)); + FerroampBindingConstants.CHANNEL_TOTALCAPACITYBATTERIES, Units.WATT_HOUR)); return channelConfigurationEhub; } @@ -218,10 +218,10 @@ public static List getChannelConfigurationSsoS0() final List channelConfigurationSsoS0 = new ArrayList<>(); channelConfigurationSsoS0 .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S0ID, Units.ONE)); - channelConfigurationSsoS0.add(new FerroampChannelConfiguration( - FerroampBindingConstants.CHANNEL_S0MEASUREDVOLTAGEPVSTRING, Units.VOLT)); - channelConfigurationSsoS0.add(new FerroampChannelConfiguration( - FerroampBindingConstants.CHANNEL_S0MEASUREDCURRENTPVSTRING, Units.AMPERE)); + channelConfigurationSsoS0 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S0PVVOLTAGE, Units.VOLT)); + channelConfigurationSsoS0 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S0PVCURRENT, Units.AMPERE)); channelConfigurationSsoS0 .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S0TOTALSOLARENERGY, Units.WATT)); channelConfigurationSsoS0 @@ -241,10 +241,10 @@ public static List getChannelConfigurationSsoS1() final List channelConfigurationSsoS1 = new ArrayList<>(); channelConfigurationSsoS1 .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S1ID, Units.ONE)); - channelConfigurationSsoS1.add(new FerroampChannelConfiguration( - FerroampBindingConstants.CHANNEL_S1MEASUREDVOLTAGEPVSTRING, Units.VOLT)); - channelConfigurationSsoS1.add(new FerroampChannelConfiguration( - FerroampBindingConstants.CHANNEL_S1MEASUREDCURRENTPVSTRING, Units.AMPERE)); + channelConfigurationSsoS1 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S1PVVOLTAGE, Units.VOLT)); + channelConfigurationSsoS1 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S1PVCURRENT, Units.AMPERE)); channelConfigurationSsoS1 .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S1TOTALSOLARENERGY, Units.WATT)); channelConfigurationSsoS1 @@ -264,10 +264,10 @@ public static List getChannelConfigurationSsoS2() final List channelConfigurationSsoS2 = new ArrayList<>(); channelConfigurationSsoS2 .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S2ID, Units.ONE)); - channelConfigurationSsoS2.add(new FerroampChannelConfiguration( - FerroampBindingConstants.CHANNEL_S2MEASUREDVOLTAGEPVSTRING, Units.VOLT)); - channelConfigurationSsoS2.add(new FerroampChannelConfiguration( - FerroampBindingConstants.CHANNEL_S2MEASUREDCURRENTPVSTRING, Units.AMPERE)); + channelConfigurationSsoS2 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S2PVVOLTAGE, Units.VOLT)); + channelConfigurationSsoS2 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S2PVCURRENT, Units.AMPERE)); channelConfigurationSsoS2 .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S2TOTALSOLARENERGY, Units.WATT)); channelConfigurationSsoS2 @@ -287,10 +287,10 @@ public static List getChannelConfigurationSsoS3() final List channelConfigurationSsoS3 = new ArrayList<>(); channelConfigurationSsoS3 .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S3ID, Units.ONE)); - channelConfigurationSsoS3.add(new FerroampChannelConfiguration( - FerroampBindingConstants.CHANNEL_S3MEASUREDVOLTAGEPVSTRING, Units.VOLT)); - channelConfigurationSsoS3.add(new FerroampChannelConfiguration( - FerroampBindingConstants.CHANNEL_S3MEASUREDCURRENTPVSTRING, Units.AMPERE)); + channelConfigurationSsoS3 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S3PVVOLTAGE, Units.VOLT)); + channelConfigurationSsoS3 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S3PVCURRENT, Units.AMPERE)); channelConfigurationSsoS3 .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S3TOTALSOLARENERGY, Units.WATT)); channelConfigurationSsoS3 @@ -309,11 +309,11 @@ public static List getChannelConfigurationSsoS3() public static List getChannelConfigurationEso() { final List channelConfigurationEso = new ArrayList<>(); channelConfigurationEso - .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_ESOUNIQUEIDENTIFIER, Units.ONE)); - channelConfigurationEso.add(new FerroampChannelConfiguration( - FerroampBindingConstants.CHANNEL_ESOMEASUREDVOLTAGEBATTERY, Units.VOLT)); - channelConfigurationEso.add(new FerroampChannelConfiguration( - FerroampBindingConstants.CHANNEL_ESOMEASUREDCURRENTBATTERY, Units.AMPERE)); + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_ESOID, Units.ONE)); + channelConfigurationEso + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_ESOVOLTAGEBATTERY, Units.VOLT)); + channelConfigurationEso.add( + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_ESOCURRENTBATTERY, Units.AMPERE)); channelConfigurationEso.add(new FerroampChannelConfiguration( FerroampBindingConstants.CHANNEL_ESOBATTERYENERGYPRODUCED, Units.WATT)); channelConfigurationEso.add(new FerroampChannelConfiguration( @@ -336,15 +336,15 @@ public static List getChannelConfigurationEso() { public static List getChannelConfigurationEsm() { final List channelConfigurationEsm = new ArrayList<>(); channelConfigurationEsm - .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_ESMUNIQUEIDENTIFIER, Units.ONE)); + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_ESMID, Units.ONE)); channelConfigurationEsm .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_ESMSOH, Units.PERCENT)); channelConfigurationEsm .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_ESMSOC, Units.PERCENT)); - channelConfigurationEsm.add(new FerroampChannelConfiguration( - FerroampBindingConstants.CHANNEL_ESMTOTALRATEDCAPACITYALLBATTERIES, Units.WATT_HOUR)); channelConfigurationEsm.add( - new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_ESMRATEDPOWERBATTERY, Units.WATT)); + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_ESMTOTALCAPACITY, Units.WATT_HOUR)); + channelConfigurationEsm + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_ESMPOWERBATTERY, Units.WATT)); channelConfigurationEsm .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_ESMSTATUS, Units.ONE)); channelConfigurationEsm diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/SsoParameters.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/SsoParameters.java index dba7ac760bbd6..776402fd43fb3 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/SsoParameters.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/SsoParameters.java @@ -41,9 +41,8 @@ public class SsoParameters { public static List getChannelParametersSso() { - final List channelParametersSs0 = Arrays.asList("id", "measured-voltage-pv-string", - "measured-current-pv-string", "total-solar-energy", "relay-status", "temperature", "fault-code", - "dc-link-voltage", "timestamp"); + final List channelParametersSs0 = Arrays.asList("id", "pv-voltage", "pv-current", "total-solar-energy", + "relay-status", "temperature", "fault-code", "dc-link-voltage", "timestamp"); return channelParametersSs0; } } diff --git a/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/ferroamp.xml b/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/ferroamp.xml index a21234a8cfa23..211d5c8902ee9 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/ferroamp.xml +++ b/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/ferroamp.xml @@ -263,16 +263,16 @@ - + - + - + @@ -296,10 +296,10 @@ - + - + @@ -323,10 +323,10 @@ - + - + @@ -350,10 +350,10 @@ - + - + @@ -374,13 +374,13 @@ - + - + - + @@ -407,7 +407,7 @@ - + @@ -416,10 +416,10 @@ - + - + From ae90e1d66ee9b2ccb29e8df7310d8c9a21a65443 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96rjan=20Backsell?= Date: Fri, 11 Oct 2024 12:31:14 +0200 Subject: [PATCH 06/16] [ferroamp] Binding for ferroamp 20241011_1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes done in README.md Signed-off-by: Örjan Backsell --- .../org.openhab.binding.ferroamp/README.md | 106 +++++++++--------- 1 file changed, 54 insertions(+), 52 deletions(-) diff --git a/bundles/org.openhab.binding.ferroamp/README.md b/bundles/org.openhab.binding.ferroamp/README.md index e857de7724e6b..7da775f5ef957 100644 --- a/bundles/org.openhab.binding.ferroamp/README.md +++ b/bundles/org.openhab.binding.ferroamp/README.md @@ -27,7 +27,7 @@ Discovery is not supported. The following configuration parameters are available. | Name | Type | Description | Default | Required | Advanced | -|-----------------|---------|------------------------------------------ |---------|----------|----------| +|-----------------|---------|-------------------------------------------------------|---------|----------|----------| | hostName | text | Hostname or IP address of the device | N/A | yes | no | | userName | text | Username to access the device | N/A | yes | no | | password | text | Password to access the device | N/A | yes | no | @@ -36,6 +36,8 @@ The following configuration parameters are available. | ssoS1 | boolean | Has the system, the 2'nd Sso Pv-string connected? | N/A | no | no | | ssoS2 | boolean | Has the system, the 3'rd Sso Pv-string connected? | N/A | no | no | | ssoS3 | boolean | Has the system, the 4'th Sso Pv-string connected? | N/A | no | no | +| eso | boolean | Has the system an Eso unit connected? | N/A | no | no | +| esm | boolean | Has the system an Esm unit connected? | N/A | no | no | | The unique serial number is marked on the side of the SSO unit. Ex. PS00990-A04-S20120476 @@ -93,15 +95,15 @@ The following configuration parameters are available. | consumption-power-reactive-l1 | Number:Power | R | Consumption Power Reactive L1 | | consumption-power-reactive-l2 | Number:Power | R | Consumption Power Reactive L2 | | consumption-power-reactive-l3 | Number:Power | R | Consumption Power Reactive L3 | -| solar-pv | Number:Power | R | Solar Power | Only sent when system has PV | +| solar-pv | Number:Power | R | Solar Power | Only sent when system has PV | | positive-dc-link-voltage | Number:ElectricPotential | R | Positiv DC Link Voltage | Positiv DC link voltage | | negative-dc-link-voltage | Number:ElectricPotential | R | Negative DC Link Voltage | Negative DC link voltage | -| grid-energy-produced-l1 | Number:Energy | R | Grid Energy Produced L1 | -| grid-energy-produced-l2 | Number:Energy | R | Grid Energy Produced L2 | -| grid-energy-produced-l3 | Number:Energy | R | Grid Energy Produced L3 | -| grid-energy-consumed-l1 | Number:Energy | R | Grid Energy Consumed L1 | -| grid-energy-consumed-l2 | Number:Energy | R | Grid Energy Consumed L2 | -| grid-energy-consumed-l3 | Number:Energy | R | Grid Energy Consumed L3 | +| grid-energy-produced-l1 | Number:Energy | R | Grid Energy Produced L1 | +| grid-energy-produced-l2 | Number:Energy | R | Grid Energy Produced L2 | +| grid-energy-produced-l3 | Number:Energy | R | Grid Energy Produced L3 | +| grid-energy-consumed-l1 | Number:Energy | R | Grid Energy Consumed L1 | +| grid-energy-consumed-l2 | Number:Energy | R | Grid Energy Consumed L2 | +| grid-energy-consumed-l3 | Number:Energy | R | Grid Energy Consumed L3 | | inverter-energy-produced-l1 | Number:Energy | R | Inverter Energy Produced L1 | | inverter-energy-produced-l2 | Number:Energy | R | Inverter Energy Produced L2 | | inverter-energy-produced-l3 | Number:Energy | R | Inverter Energy Produced L3 | @@ -114,12 +116,12 @@ The following configuration parameters are available. | load-energy-consumed-l1 | Number:Energy | R | Load Energy Consumed L1 | | load-energy-consumed-l2 | Number:Energy | R | Load Energy Consumed L2 | | load-energy-consumed-l3 | Number:Energy | R | Load Energy Consumed L3 | -| total-grid-energy-produced | Number:Energy | R | Total produced grid energy | -| total-grid-energy-consumed | Number:Energy | R | Total consumed grid energy | -| total-inverter-energy-produced | Number:Energy | R | Total produced inverter energy | -| total-inverter-energy-consumed | Number:Energy | R | Total consumed inverter energy | -| total-load-energy-produced | Number:Energy | R | Total produced load energy | -| total-load-energy-consumed | Number:Energy | R | Total consumed load energy | +| total-grid-energy-produced | Number:Energy | R | Total produced grid energy | +| total-grid-energy-consumed | Number:Energy | R | Total consumed grid energy | +| total-inverter-energy-produced | Number:Energy | R | Total produced inverter energy | +| total-inverter-energy-consumed | Number:Energy | R | Total consumed inverter energy | +| total-load-energy-produced | Number:Energy | R | Total produced load energy | +| total-load-energy-consumed | Number:Energy | R | Total consumed load energy | | total-solar-energy | Number:Energy | R | Total Solar Energy | Only sent when system has PV | | state | String | R | State of the System | | timestamp | DateTime | R | Time Stamp When Message was Published | Time stamp when message was published | @@ -128,23 +130,23 @@ The following configuration parameters are available. | soc | Number:Dimensionless | R | System State of Check | State of the system | | soh | Number:Dimensionless | R | System State of Health | | power-battery | Number:Power | R | Battery Power | Only sent when system has batteries | -| total-capacity-batteries | Number:Energy | R | Total Rated Capacity of All Batteries | +| total-capacity-batteries | Number:Energy | R | Total Rated Capacity of All Batteries | -| s0-id | String | R | S0 ID | Unique identifier of SSO-0 | +| s0-id | String | R | S0 ID | Unique identifier of SSO-0 | | s0-pv-voltage | Number:ElectricPotential | R | S0 Measured Voltage on PV String Side | Measured on PV string side | | s0-pv-current | Number:ElectricCurrent | R | S0 Measured Current on PV String Side | Measured on PV string side | | s0-total-solar-energy | Number:Energy | R | S0 Total Solar Energy | Total energy produced by SSO-0 | -| s0-relay-status | String | R | S0 Relay Status | 0 = relay closed (i.e running power), 1 = relay open/disconnected, 2 = precharge | +| s0-relay-status | Contact | R | S0 Relay Status | 0 = relay closed (i.e running power), 1 = relay open/disconnected, 2 = precharge | | s0-temperature | Number:Temperature | R | S0 Temperature Measured on PCB | Temperature Measured on PCB | | s0-fault-code | String | R | S0 FaultCode | 0x00 = OK. For all other values Please contact Ferroamp support | | s0-dc-link-voltage | Number:ElectricPotential | R | S0 DC Link Voltage | DC link voltage as measured by SSO-0 | | s0-timestamp | DateTime | R | S0 Time Stamp When Message was Published | Time stamp when message was published | | -| s1-id | String | R | S1 ID | Unique identifier of SSO-1 | -| s1-pv-voltage | Number:ElectricPotential | R | S1 easured Voltage on PV String Side | Measured on PV string side | -| s1-pv-current | Number:ElectricCurrent | R | S1 Measured Current on PV String Side | Measured on PV string side | +| s1-id | String | R | S1 ID | Unique identifier of SSO-1 | +| s1-pv-voltage | Number:ElectricPotential | R | S1 easured Voltage on PV String Side | Measured on PV string side | +| s1-pv-current | Number:ElectricCurrent | R | S1 Measured Current on PV String Side | Measured on PV string side | | s1-total-solar-energy | Number:Energy | R | S1 Total Solar Energy | Total energy produced by SSO-1 | -| s1-relay-status | String | R | S1 Relay Status | 0 = relay closed (i.e running power), 1 = relay open/disconnected, 2 = precharge | +| s1-relay-status | Contact | R | S1 Relay Status | 0 = relay closed (i.e running power), 1 = relay open/disconnected, 2 = precharge | | s1-temperature | Number:Temperature | R | S1 Temperature Measured on PCB | Temperature Measured on PCB | | s1-fault-code | String | R | S1 FaultCode | 0x00 = OK. For all other values Please contact Ferroamp support | | s1-dc-link-voltage | Number:ElectricPotential | R | S1 DC Link Voltage | DC link voltage as measured by SSO-1 | @@ -152,10 +154,10 @@ The following configuration parameters are available. | | s2-id | String | R | S2 ID | Unique identifier of SSO-2 | -| s2-pv-voltage | Number:ElectricPotential | R | S2 Measured Voltage on PV String Side | Measured on PV string side | -| s2-pv-current | Number:ElectricCurrent | R | S2 Measured Current on PV String Side | Measured on PV string side | +| s2-pv-voltage | Number:ElectricPotential | R | S2 Measured Voltage on PV String Side | Measured on PV string side | +| s2-pv-current | Number:ElectricCurrent | R | S2 Measured Current on PV String Side | Measured on PV string side | | s2-total-solar-energy | Number:Energy | R | S2 Total Solar Energy | Total energy produced by SSO-2 | -| s2-relay-status | String | R | S2 Relay Status | 0 = relay closed (i.e running power), 1 = relay open/disconnected, 2 = precharge | +| s2-relay-status | Contact | R | S2 Relay Status | 0 = relay closed (i.e running power), 1 = relay open/disconnected, 2 = precharge | | s2-temperature | Number:Temperature | R | S2 Temperature Measured on PCB | Temperature Measured on PCB | | s2-fault-code | String | R | S2 FaultCode | 0x00 = OK. For all other values Please contact Ferroamp support | | s2-dc-link-voltage | Number:ElectricPotential | R | S2 DC Link Voltage | DC link voltage as measured by SSO-2 | @@ -163,44 +165,44 @@ The following configuration parameters are available. | | s3-id | String | R | S3 ID | Unique identifier of SSO-3 | -| s3-pv-voltage | Number:ElectricPotential | R | S3 Measured Voltage on PV String Side | Measured on PV string side | -| s3-pv-current | Number:ElectricCurrent | R | S3 Measured Current on PV String Side | Measured on PV string side | +| s3-pv-voltage | Number:ElectricPotential | R | S3 Measured Voltage on PV String Side | Measured on PV string side | +| s3-pv-current | Number:ElectricCurrent | R | S3 Measured Current on PV String Side | Measured on PV string side | | s3-total-solar-energy | Number:Energy | R | S3 Total Solar Energy | Total energy produced by SSO-3 | -| s3-relay-status | String | R | S3 Relay Status | 0 = relay closed (i.e running power), 1 = relay open/disconnected, 2 = precharge | +| s3-relay-status | Contact | R | S3 Relay Status | 0 = relay closed (i.e running power), 1 = relay open/disconnected, 2 = precharge | | s3-temperature | Number:Temperature | R | S3 Temperature Measured on PCB | Temperature Measured on PCB | | s3-fault-code | String | R | S3 FaultCode | 0x00 = OK. For all other values Please contact Ferroamp support | | s3-dc-link-voltage | Number:ElectricPotential | R | S3 DC Link Voltage | DC link voltage as measured by SSO-3 | | s3-timestamp | DateTime | R | S3 Time Stamp When Message was Published | Time stamp when message was published | | -| eso-id | String | R | Eso Unique Identifier | Unique identifier | -| eso-voltage-battery | Number:ElectricPotential | R | Eso Voltage Measured on Battery Side | Measured on battery side | -| eso-current-battery | Number:ElectricCurrent | R | Eso Current Measured on Battery Side | Measured on battery side | -| eso-battery-energy-produced | Number:Energy | R | Eso Battery Energy Produced | Total energy produced by ESO, i.e total energy charged | -| eso-battery-energy-consumed | Number:Energy | R | Eso Battery Energy Consumed | Total energy consumed by ESO, i.e total energy discharged | -| eso-soc | Number:Dimensionless | R | Eso State of Charge | State of Charge for ESO | -| eso-relay-status | String | R | Eso Relay Status | 0 = relay closed, 1 = relay open | -| eso-temperature | Number:Temperature | R | Eso Temperature Measured on PCB | Measured inside ESO | -| eso-fault-code | String | R | Eso FaultCode | See section 4.1.3.1 in Ferroamp-External-API-specifikation | -| eso-battery-energy-produced | Number:Energy | R | Eso Battery Energy Produced | Total energy produced by ESO, i.e total energy charged | -| eso-dc-link-voltage | Number:ElectricPotential | R | Eso Dc Link Voltage | DC link voltage as measured by ESO | -| eso-timestamp | DateTime | R | Eso Time Stamp When Message was Published| Time stamp when message was published | - - -| esm-id | String | R | Esm Unique Identifier | Unique identifier of battery. If available, this will be the unique id that the battery reports.| -| esm-soh | Number:Dimensionless | R | Esm System State of Health | State of Health for ESM | -| esm-soc | Number:Dimensionless | R | Esm System State of Charge | State of Charge for ESM | -| esm-total-capacity | Number:Energy | R | Esm Rated Capacity | Rated capacity of all batteries | -| esm-power-battery | Number:Power | R | Esm Rated power of battery | Rated power of battery | -| esm-status | String | R | Esm Status | Dependent on battery manufacturer | -| esm-timestamp | DateTime | R | Esm Time Stamp When Message was Published| Time stamp when message was published | +| eso-id | String | R | Eso Unique Identifier | Unique identifier | +| eso-voltage-battery | Number:ElectricPotential | R | Eso Voltage Measured on Battery Side | Measured on battery side | +| eso-current-battery | Number:ElectricCurrent | R | Eso Current Measured on Battery Side | Measured on battery side | +| eso-battery-energy-produced | Number:Energy | R | Eso Battery Energy Produced | Total energy produced by ESO, i.e total energy charged | +| eso-battery-energy-consumed | Number:Energy | R | Eso Battery Energy Consumed | Total energy consumed by ESO, i.e total energy discharged | +| eso-soc | Number:Dimensionless | R | Eso State of Charge | State of Charge for ESO | +| eso-relay-status | Contact | R | Eso Relay Status | 0 = relay closed, 1 = relay open | +| eso-temperature | Number:Temperature | R | Eso Temperature Measured on PCB | Measured inside ESO | +| eso-fault-code | String | R | Eso FaultCode | See section 4.1.3.1 in Ferroamp-External-API-specifikation | +| eso-battery-energy-produced | Number:Energy | R | Eso Battery Energy Produced | Total energy produced by ESO, i.e total energy charged | +| eso-dc-link-voltage | Number:ElectricPotential | R | Eso Dc Link Voltage | DC link voltage as measured by ESO | +| eso-timestamp | DateTime | R | Eso Time Stamp When Message was Published| Time stamp when message was published | + + +| esm-id | String | R | Esm Unique Identifier | Unique identifier of battery. If available, this will be the unique id that the battery reports.| +| esm-soh | Number:Dimensionless | R | Esm System State of Health | State of Health for ESM | +| esm-soc | Number:Dimensionless | R | Esm System State of Charge | State of Charge for ESM | +| esm-total-capacity | Number:Energy | R | Esm Rated Capacity | Rated capacity of all batteries | +| esm-power-battery | Number:Power | R | Esm Rated power of battery | Rated power of battery | +| esm-status | String | R | Esm Status | Dependent on battery manufacturer | +| esm-timestamp | DateTime | R | Esm Time Stamp When Message was Published| Time stamp when message was published | The following channels are available for `Ferroamp` EnergyHub configuration. Please, see Ferroamp documentation for more details. -| Channel Type ID | Item Type | Read/Write | Description | -|---------------------------------------------------|------------|------------------------------------------| -| request-charge | String | W | Set charge power, value in Watt | -| request-discharge | String | W | Set discharge power, value in Watt | +| Channel Type ID | Item Type | Read/Write | Description | +|---------------------------------------------------|------------|-------------------------------------------------------------------------| +| request-charge | String | W | Set charge power, value in Watt | +| request-discharge | String | W | Set discharge power, value in Watt | | request-auto | String | W | Set auto power. Returning control of batteries to system, value as auto.| # Full Example From f31221c2cb53fb1cab6e1cf214cd67d488d9451a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96rjan=20Backsell?= Date: Thu, 24 Oct 2024 19:00:54 +0200 Subject: [PATCH 07/16] [ferroamp] Binding for ferroamp 20241024 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes done, Please see Reply...regarded to each conversion Signed-off-by: Örjan Backsell --- .../org.openhab.binding.ferroamp/README.md | 10 + .../ferroamp/internal/FerroampHandler.java | 22 +- .../internal/FerroampMqttCommunication.java | 193 +++--- .../resources/OH-INF/i18n/ferroamp.properties | 114 ++-- .../main/resources/OH-INF/thing/channels.xml | 101 --- .../main/resources/OH-INF/thing/ferroamp.xml | 449 ------------- .../resources/OH-INF/thing/thing-types.xml | 622 ++++++++++++++++-- bundles/pom.xml | 2 - 8 files changed, 768 insertions(+), 745 deletions(-) delete mode 100644 bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/channels.xml delete mode 100644 bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/ferroamp.xml diff --git a/bundles/org.openhab.binding.ferroamp/README.md b/bundles/org.openhab.binding.ferroamp/README.md index 7da775f5ef957..db2812ad2c113 100644 --- a/bundles/org.openhab.binding.ferroamp/README.md +++ b/bundles/org.openhab.binding.ferroamp/README.md @@ -213,6 +213,16 @@ The following channels are available for `Ferroamp` EnergyHub configuration. Ple Thing ferroamp:energyhub:myenergyhub [ hostName="energyhub-ip", userName="myUserName", password="myPassword", hasBattery=false ] ``` +```java +Thing ferroamp:energyhub:myenergyhub [ hostName="energyhub-ip", userName="myUserName", password="myPassword", hasBattery=false, ssoS0=true ] +``` + +```java +Thing ferroamp:energyhub:myenergyhub [ hostName="energyhub-ip", userName="myUserName", password="myPassword", hasBattery=true, ssoS0=true, eso=true ] +``` + + + ## `demo.items` Example ```java diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java index b4dd64aef1d94..24d1f9c88d3e9 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java @@ -83,6 +83,7 @@ public void handleCommand(ChannelUID channelUID, Command command) { } } + @SuppressWarnings("null") @Override public void initialize() { // Set channel configuration parameters @@ -114,17 +115,26 @@ public void initialize() { } } else { updateStatus(ThingStatus.OFFLINE); + thingReachable = false; } }); // Start channel-update as configured scheduler.scheduleWithFixedDelay(() -> { - try { - channelUpdate(); - } catch (RuntimeException scheduleWithFixedDelayException) { - updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, - scheduleWithFixedDelayException.getClass().getName() + ":" - + scheduleWithFixedDelayException.getMessage()); + System.out.println("ffff = " + getFerroampConnection().connectionState()); + if (getFerroampConnection().connectionState().toString().equals("DISCONNECTED")) { + System.out.println("aaaaa = " + getFerroampConnection().connectionState()); + updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR); + logger.debug("Problem connection to MqttBroker"); + } else { + try { + channelUpdate(); + updateStatus(ThingStatus.ONLINE); + } catch (RuntimeException scheduleWithFixedDelayException) { + updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, + scheduleWithFixedDelayException.getClass().getName() + ":" + + scheduleWithFixedDelayException.getMessage()); + } } }, 60, refreshInterval, TimeUnit.SECONDS); diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampMqttCommunication.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampMqttCommunication.java index a0dd0f1b38412..ca7adb7a9fc8b 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampMqttCommunication.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampMqttCommunication.java @@ -113,6 +113,12 @@ public void processMessage(String topic, byte[] payload) { if ("extapi/data/sso".equals(topic)) { processIncomingJsonMessageSso(topic, new String(payload, StandardCharsets.UTF_8)); } + if ("extapi/data/eso".equals(topic)) { + processIncomingJsonMessageEso(topic, new String(payload, StandardCharsets.UTF_8)); + } + if ("extapi/data/esm".equals(topic)) { + processIncomingJsonMessageEsm(topic, new String(payload, StandardCharsets.UTF_8)); + } } @SuppressWarnings("null") @@ -634,111 +640,116 @@ void processIncomingJsonMessageSso(String topic, String messageJsonSso) { ssoS3ChannelsUpdateValues = ssoS3ChannelPostsValue; } + } - if ("extapi/data/eso".equals(topic)) { - String[] esoChannelPostsValue = new String[10]; // Array for ESO, Energy Storage Optimizer ) Posts - JsonObject jsonElementsObject = new Gson().fromJson(new Gson().fromJson(messageJsonSso, JsonObject.class), - JsonObject.class); - - String jsonElementsStringTemp = ""; - - // faultcode - jsonElementsStringTemp = jsonElementsObject.get(EsoJsonElements.getJsonElementsEso().get(0)).toString(); - GetGeneralValues faultcode = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); - esoChannelPostsValue[0] = faultcode.getVal(); - - // id - jsonElementsStringTemp = jsonElementsObject.get(EsoJsonElements.getJsonElementsEso().get(1)).toString(); - GetGeneralValues id = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); - esoChannelPostsValue[1] = id.getVal(); - - // ibat - jsonElementsStringTemp = jsonElementsObject.get(EsoJsonElements.getJsonElementsEso().get(2)).toString(); - GetGeneralValues ibat = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); - esoChannelPostsValue[2] = ibat.getVal(); - - // ubat - jsonElementsStringTemp = jsonElementsObject.get(EsoJsonElements.getJsonElementsEso().get(3)).toString(); - GetGeneralValues ubat = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); - esoChannelPostsValue[3] = ubat.getVal(); - - // relaystatus - jsonElementsStringTemp = jsonElementsObject.get(EsoJsonElements.getJsonElementsEso().get(4)).toString(); - GetGeneralValues relaystatus = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); - esoChannelPostsValue[4] = relaystatus.getVal(); - - // soc - jsonElementsStringTemp = jsonElementsObject.get(EsoJsonElements.getJsonElementsEso().get(5)).toString(); - GetGeneralValues soc = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); - esoChannelPostsValue[5] = soc.getVal(); - - // temp - jsonElementsStringTemp = jsonElementsObject.get(EsoJsonElements.getJsonElementsEso().get(6)).toString(); - GetGeneralValues temp = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); - esoChannelPostsValue[6] = temp.getVal(); - - // wbatprod - jsonElementsStringTemp = jsonElementsObject.get(EsoJsonElements.getJsonElementsEso().get(7)).toString(); - GetGeneralValues wbatprod = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); - esoChannelPostsValue[7] = mJTokWh(jsonStripOneLiners(wbatprod.getVal())); + @SuppressWarnings("null") + // Prepare actual Json-topic Eso-message and update values for channels + void processIncomingJsonMessageEso(String topic, String messageJsonEso) { + String[] esoChannelPostsValue = new String[10]; // Array for ESO, Energy Storage Optimizer ) Posts + JsonObject jsonElementsObject = new Gson().fromJson(new Gson().fromJson(messageJsonEso, JsonObject.class), + JsonObject.class); + String jsonElementsStringTemp = ""; + Gson gson = new Gson(); - // udc - jsonElementsStringTemp = jsonElementsObject.get(EsoJsonElements.getJsonElementsEso().get(8)).toString(); - GetGeneralValues udc = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); - esoChannelPostsValue[8] = udc.getVal(); + // faultcode + jsonElementsStringTemp = jsonElementsObject.get(EsoJsonElements.getJsonElementsEso().get(0)).toString(); + GetGeneralValues faultcode = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + esoChannelPostsValue[0] = faultcode.getVal(); + + // id + jsonElementsStringTemp = jsonElementsObject.get(EsoJsonElements.getJsonElementsEso().get(1)).toString(); + GetGeneralValues id = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + esoChannelPostsValue[1] = id.getVal(); + + // ibat + jsonElementsStringTemp = jsonElementsObject.get(EsoJsonElements.getJsonElementsEso().get(2)).toString(); + GetGeneralValues ibat = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + esoChannelPostsValue[2] = ibat.getVal(); + + // ubat + jsonElementsStringTemp = jsonElementsObject.get(EsoJsonElements.getJsonElementsEso().get(3)).toString(); + GetGeneralValues ubat = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + esoChannelPostsValue[3] = ubat.getVal(); + + // relaystatus + jsonElementsStringTemp = jsonElementsObject.get(EsoJsonElements.getJsonElementsEso().get(4)).toString(); + GetGeneralValues relaystatus = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + esoChannelPostsValue[4] = relaystatus.getVal(); + + // soc + jsonElementsStringTemp = jsonElementsObject.get(EsoJsonElements.getJsonElementsEso().get(5)).toString(); + GetGeneralValues soc = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + esoChannelPostsValue[5] = soc.getVal(); + + // temp + jsonElementsStringTemp = jsonElementsObject.get(EsoJsonElements.getJsonElementsEso().get(6)).toString(); + GetGeneralValues temp = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + esoChannelPostsValue[6] = temp.getVal(); + + // wbatprod + jsonElementsStringTemp = jsonElementsObject.get(EsoJsonElements.getJsonElementsEso().get(7)).toString(); + GetGeneralValues wbatprod = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + esoChannelPostsValue[7] = mJTokWh(jsonStripOneLiners(wbatprod.getVal())); + + // udc + jsonElementsStringTemp = jsonElementsObject.get(EsoJsonElements.getJsonElementsEso().get(8)).toString(); + GetGeneralValues udc = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + esoChannelPostsValue[8] = udc.getVal(); - // ts - jsonElementsStringTemp = jsonElementsObject.get(EsoJsonElements.getJsonElementsEso().get(9)).toString(); - GetGeneralValues ts = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); - esoChannelPostsValue[9] = ts.getVal(); + // ts + jsonElementsStringTemp = jsonElementsObject.get(EsoJsonElements.getJsonElementsEso().get(9)).toString(); + GetGeneralValues ts = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + esoChannelPostsValue[9] = ts.getVal(); - esoChannelsUpdateValues = esoChannelPostsValue; - } + esoChannelsUpdateValues = esoChannelPostsValue; + } - if ("extapi/data/esm".equals(topic)) { - String[] esmChannelPostsValue = new String[7]; // Array for ESM, Energy Storage Module ) Posts - JsonObject jsonElementsObject = new Gson().fromJson(new Gson().fromJson(messageJsonSso, JsonObject.class), - JsonObject.class); + @SuppressWarnings("null") + // Prepare actual Json-topic Esm-message and update values for channels + void processIncomingJsonMessageEsm(String topic, String messageJsonEsm) { + String[] esmChannelPostsValue = new String[7]; // Array for ESM, Energy Storage Module ) Posts + JsonObject jsonElementsObject = new Gson().fromJson(new Gson().fromJson(messageJsonEsm, JsonObject.class), + JsonObject.class); + String jsonElementsStringTemp = ""; + Gson gson = new Gson(); - String jsonElementsStringTemp = ""; + // soc + jsonElementsStringTemp = jsonElementsObject.get(EsmJsonElements.getJsonElementsEsm().get(0)).toString(); + GetGeneralValues soc = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + esmChannelPostsValue[0] = soc.getVal(); - // soc - jsonElementsStringTemp = jsonElementsObject.get(EsmJsonElements.getJsonElementsEsm().get(0)).toString(); - GetGeneralValues soc = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); - esmChannelPostsValue[0] = soc.getVal(); + // soh + jsonElementsStringTemp = jsonElementsObject.get(EsmJsonElements.getJsonElementsEsm().get(1)).toString(); + GetGeneralValues soh = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + esmChannelPostsValue[1] = soh.getVal(); - // soh - jsonElementsStringTemp = jsonElementsObject.get(EsmJsonElements.getJsonElementsEsm().get(1)).toString(); - GetGeneralValues soh = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); - esmChannelPostsValue[1] = soh.getVal(); + // ratedcapacity + jsonElementsStringTemp = jsonElementsObject.get(EsmJsonElements.getJsonElementsEsm().get(2)).toString(); + GetGeneralValues ratedcapacity = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + esmChannelPostsValue[2] = ratedcapacity.getVal(); - // ratedcapacity - jsonElementsStringTemp = jsonElementsObject.get(EsmJsonElements.getJsonElementsEsm().get(2)).toString(); - GetGeneralValues ratedcapacity = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); - esmChannelPostsValue[2] = ratedcapacity.getVal(); + // id + jsonElementsStringTemp = jsonElementsObject.get(EsmJsonElements.getJsonElementsEsm().get(3)).toString(); + GetGeneralValues id = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + esmChannelPostsValue[3] = id.getVal(); - // id - jsonElementsStringTemp = jsonElementsObject.get(EsmJsonElements.getJsonElementsEsm().get(3)).toString(); - GetGeneralValues id = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); - esmChannelPostsValue[3] = id.getVal(); + // ratedpower + jsonElementsStringTemp = jsonElementsObject.get(EsmJsonElements.getJsonElementsEsm().get(4)).toString(); + GetGeneralValues ratedpower = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + esmChannelPostsValue[4] = ratedpower.getVal(); - // ratedpower - jsonElementsStringTemp = jsonElementsObject.get(EsmJsonElements.getJsonElementsEsm().get(4)).toString(); - GetGeneralValues ratedpower = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); - esmChannelPostsValue[4] = ratedpower.getVal(); + // status + jsonElementsStringTemp = jsonElementsObject.get(EsmJsonElements.getJsonElementsEsm().get(5)).toString(); + GetGeneralValues status = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + esmChannelPostsValue[5] = status.getVal(); - // status - jsonElementsStringTemp = jsonElementsObject.get(EsmJsonElements.getJsonElementsEsm().get(5)).toString(); - GetGeneralValues status = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); - esmChannelPostsValue[5] = status.getVal(); + // ts + jsonElementsStringTemp = jsonElementsObject.get(EsmJsonElements.getJsonElementsEsm().get(6)).toString(); + GetGeneralValues ts = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + esmChannelPostsValue[6] = ts.getVal(); - // ts - jsonElementsStringTemp = jsonElementsObject.get(EsmJsonElements.getJsonElementsEsm().get(6)).toString(); - GetGeneralValues ts = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); - esmChannelPostsValue[6] = ts.getVal(); + esmChannelsUpdateValues = esmChannelPostsValue; - esmChannelsUpdateValues = esmChannelPostsValue; - } } public @Nullable static String[] getEhubChannelUpdateValues() { diff --git a/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/i18n/ferroamp.properties b/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/i18n/ferroamp.properties index fe647c621870b..2044acd4bcc4f 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/i18n/ferroamp.properties +++ b/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/i18n/ferroamp.properties @@ -5,8 +5,8 @@ addon.ferroamp.description = This is the binding for Ferroamp EnergyHub. # thing types -thing-type.ferroamp.energyhub.label = Ferroamp EnergyHub -thing-type.ferroamp.energyhub.description = Represents the Ferroamp EnergyHub +thing-type.ferroamp.energyhub.label = Ferroamp Binding Thing +thing-type.ferroamp.energyhub.description = Provides information from Ferroamp EnergyHub thing-type.ferroamp.energyhub.channel.ace-current-l1.label = ACE Current L1 thing-type.ferroamp.energyhub.channel.ace-current-l2.label = ACE Current L2 thing-type.ferroamp.energyhub.channel.ace-current-l3.label = ACE Current L3 @@ -19,30 +19,24 @@ thing-type.ferroamp.energyhub.channel.consumption-power-l3.label = Consumption P thing-type.ferroamp.energyhub.channel.consumption-power-reactive-l1.label = Consumption Power Reactive L1 thing-type.ferroamp.energyhub.channel.consumption-power-reactive-l2.label = Consumption Power Reactive L2 thing-type.ferroamp.energyhub.channel.consumption-power-reactive-l3.label = Consumption Power Reactive L3 -thing-type.ferroamp.energyhub.channel.esm-rated-power-battery.label = Esm Rated Power of Battery +thing-type.ferroamp.energyhub.channel.esm-id.label = Esm Unique Identifier +thing-type.ferroamp.energyhub.channel.esm-power-battery.label = Esm Rated Power of Battery thing-type.ferroamp.energyhub.channel.esm-soc.label = Esm System State of Charge thing-type.ferroamp.energyhub.channel.esm-soh.label = Esm System State of Health thing-type.ferroamp.energyhub.channel.esm-status.label = Esm Status thing-type.ferroamp.energyhub.channel.esm-timestamp.label = Esm Time Stamp When Message was Published -thing-type.ferroamp.energyhub.channel.esm-total-rated-capacity-all-batteries.label = Esm Rated Capacity -thing-type.ferroamp.energyhub.channel.esm-unique-identifier.label = Esm Unique Identifier +thing-type.ferroamp.energyhub.channel.esm-total-capacity.label = Esm Rated Capacity thing-type.ferroamp.energyhub.channel.eso-battery-energy-consumed.label = Eso Battery Energy Consumed thing-type.ferroamp.energyhub.channel.eso-battery-energy-produced.label = Eso Battery Energy Produced +thing-type.ferroamp.energyhub.channel.eso-current-battery.label = Eso Current Measured on Battery Side thing-type.ferroamp.energyhub.channel.eso-dc-link-voltage.label = Eso DC Link Voltage thing-type.ferroamp.energyhub.channel.eso-fault-code.label = Eso FaultCode +thing-type.ferroamp.energyhub.channel.eso-id.label = Eso Unique Identifier thing-type.ferroamp.energyhub.channel.eso-relay-status.label = Eso RelayStatus thing-type.ferroamp.energyhub.channel.eso-soc.label = Eso State of Charge thing-type.ferroamp.energyhub.channel.eso-temperature.label = ESO Temperature Measured on PCB thing-type.ferroamp.energyhub.channel.eso-timestamp.label = Eso Time Stamp When Message was Published -thing-type.ferroamp.energyhub.channel.eso-unique-identifier.label = Eso Unique Identifier -thing-type.ferroamp.energyhub.channel.external-energy-consumed-3p.label = External Energy Consumed 3p -thing-type.ferroamp.energyhub.channel.external-energy-consumed-l1.label = External Energy Consumed L1 -thing-type.ferroamp.energyhub.channel.external-energy-consumed-l2.label = External Energy Consumed L2 -thing-type.ferroamp.energyhub.channel.external-energy-consumed-l3.label = External Energy Consumed L3 -thing-type.ferroamp.energyhub.channel.external-energy-produced-3p.label = External Energy Produced 3p -thing-type.ferroamp.energyhub.channel.external-energy-produced-l1.label = External Energy Produced L1 -thing-type.ferroamp.energyhub.channel.external-energy-produced-l2.label = External Energy Produced L2 -thing-type.ferroamp.energyhub.channel.external-energy-produced-l3.label = External Energy Produced L3 +thing-type.ferroamp.energyhub.channel.eso-voltage-battery.label = Eso Voltage Measured on Battery Side thing-type.ferroamp.energyhub.channel.external-voltage-l1.label = External Voltage L1 thing-type.ferroamp.energyhub.channel.external-voltage-l2.label = External Voltage L2 thing-type.ferroamp.energyhub.channel.external-voltage-l3.label = External Voltage L3 @@ -55,6 +49,14 @@ thing-type.ferroamp.energyhub.channel.grid-current-l3.label = Grid Current L3 thing-type.ferroamp.energyhub.channel.grid-current-reactive-l1.label = Grid Reactive Current L1 thing-type.ferroamp.energyhub.channel.grid-current-reactive-l2.label = Grid Reactive Current L2 thing-type.ferroamp.energyhub.channel.grid-current-reactive-l3.label = Grid Reactive Current L3 +thing-type.ferroamp.energyhub.channel.grid-energy-consumed-l1.label = Grid Energy Consumed L1 +thing-type.ferroamp.energyhub.channel.grid-energy-consumed-l2.label = Grid Energy Consumed L2 +thing-type.ferroamp.energyhub.channel.grid-energy-consumed-l3.label = Grid Energy Consumed L3 +thing-type.ferroamp.energyhub.channel.grid-energy-consumed-total.label = Total Consumed Grid Energy +thing-type.ferroamp.energyhub.channel.grid-energy-produced-l1.label = Grid Energy Produced L1 +thing-type.ferroamp.energyhub.channel.grid-energy-produced-l2.label = Grid Energy Produced L2 +thing-type.ferroamp.energyhub.channel.grid-energy-produced-l3.label = Grid Energy Produced L3 +thing-type.ferroamp.energyhub.channel.grid-energy-produced-total.label = Total Produced Grid Energy thing-type.ferroamp.energyhub.channel.grid-frequency.label = Estimated Grid Frequency thing-type.ferroamp.energyhub.channel.grid-power-active-l1.label = Grid Power Active L1 thing-type.ferroamp.energyhub.channel.grid-power-active-l2.label = Grid Power Active L2 @@ -68,14 +70,14 @@ thing-type.ferroamp.energyhub.channel.inverter-current-active-l3.label = Inverte thing-type.ferroamp.energyhub.channel.inverter-current-reactive-l1.label = Inverter Reactive Current L1 thing-type.ferroamp.energyhub.channel.inverter-current-reactive-l2.label = Inverter Reactive Current L2 thing-type.ferroamp.energyhub.channel.inverter-current-reactive-l3.label = Inverter Reactive Current L3 -thing-type.ferroamp.energyhub.channel.inverter-energy-consumed-3p.label = Inverter Energy Consumed 3p thing-type.ferroamp.energyhub.channel.inverter-energy-consumed-l1.label = Inverter Energy Consumed L1 thing-type.ferroamp.energyhub.channel.inverter-energy-consumed-l2.label = Inverter Energy Consumed L2 thing-type.ferroamp.energyhub.channel.inverter-energy-consumed-l3.label = Inverter Energy Consumed L3 -thing-type.ferroamp.energyhub.channel.inverter-energy-produced-3p.label = Inverter Energy Produced 3p +thing-type.ferroamp.energyhub.channel.inverter-energy-consumed-total.label = Total Consumed Inverter Energy thing-type.ferroamp.energyhub.channel.inverter-energy-produced-l1.label = Inverter Energy Produced L1 thing-type.ferroamp.energyhub.channel.inverter-energy-produced-l2.label = Inverter Energy Produced L2 thing-type.ferroamp.energyhub.channel.inverter-energy-produced-l3.label = Inverter Energy Produced L3 +thing-type.ferroamp.energyhub.channel.inverter-energy-produced-total.label = Total Produced Inverter Energy thing-type.ferroamp.energyhub.channel.inverter-load-l1.label = Inverter Load L1 thing-type.ferroamp.energyhub.channel.inverter-load-l2.label = Inverter Load L2 thing-type.ferroamp.energyhub.channel.inverter-load-l3.label = Inverter Load L3 @@ -91,16 +93,14 @@ thing-type.ferroamp.energyhub.channel.inverter-reactive-current-l3.label = Inver thing-type.ferroamp.energyhub.channel.inverter-rms-current-l1.label = Inverter RMS Current L1 thing-type.ferroamp.energyhub.channel.inverter-rms-current-l2.label = Inverter RMS Current L2 thing-type.ferroamp.energyhub.channel.inverter-rms-current-l3.label = Inverter RMS Current L3 -thing-type.ferroamp.energyhub.channel.load-energy-consumed-3p.label = Load Energy Consumed 3p thing-type.ferroamp.energyhub.channel.load-energy-consumed-l1.label = Load Energy Consumed L1 thing-type.ferroamp.energyhub.channel.load-energy-consumed-l2.label = Load Energy Consumed L2 thing-type.ferroamp.energyhub.channel.load-energy-consumed-l3.label = Load Energy Consumed L3 -thing-type.ferroamp.energyhub.channel.load-energy-produced-3p.label = Load Energy Produced 3p +thing-type.ferroamp.energyhub.channel.load-energy-consumed-total.label = Total Consumed Load Energy thing-type.ferroamp.energyhub.channel.load-energy-produced-l1.label = Load Energy Produced L1 thing-type.ferroamp.energyhub.channel.load-energy-produced-l2.label = Load Energy Produced L2 thing-type.ferroamp.energyhub.channel.load-energy-produced-l3.label = Load Energy Produced L3 -thing-type.ferroamp.energyhub.channel.measured-current-battery.label = Eso Current Measured on Battery Side -thing-type.ferroamp.energyhub.channel.measured-voltage-battery.label = Eso Voltage Measured on Battery Side +thing-type.ferroamp.energyhub.channel.load-energy-produced-total.label = Total Produced Load Energy thing-type.ferroamp.energyhub.channel.negative-dc-link-voltage.label = Negative DC Link Voltage thing-type.ferroamp.energyhub.channel.positive-dc-link-voltage.label = Positive DC Link Voltage thing-type.ferroamp.energyhub.channel.power-battery.label = Battery Power @@ -111,8 +111,8 @@ thing-type.ferroamp.energyhub.channel.request-extapi-version.label = RequestExta thing-type.ferroamp.energyhub.channel.s0-dc-link-voltage.label = S0 DC Link Voltage thing-type.ferroamp.energyhub.channel.s0-fault-code.label = S0 FaultCode thing-type.ferroamp.energyhub.channel.s0-id.label = S0 ID -thing-type.ferroamp.energyhub.channel.s0-measured-current-pv-string.label = S0 Measured Current on PV String Side -thing-type.ferroamp.energyhub.channel.s0-measured-voltage-pv-string.label = S0 Measured Voltage on PV String Side +thing-type.ferroamp.energyhub.channel.s0-pv-current.label = S0 Measured Current on PV String Side +thing-type.ferroamp.energyhub.channel.s0-pv-voltage.label = S0 Measured Voltage on PV String Side thing-type.ferroamp.energyhub.channel.s0-relay-status.label = S0 RelayStatus thing-type.ferroamp.energyhub.channel.s0-temperature.label = S0 Temperature Measured on PCB thing-type.ferroamp.energyhub.channel.s0-timestamp.label = S0 Time Stamp When Message was Published @@ -120,8 +120,8 @@ thing-type.ferroamp.energyhub.channel.s0-total-solar-energy.label = S0 Total Sol thing-type.ferroamp.energyhub.channel.s1-dc-link-voltage.label = S1 DC Link Voltage thing-type.ferroamp.energyhub.channel.s1-fault-code.label = S1 FaultCode thing-type.ferroamp.energyhub.channel.s1-id.label = S1 ID -thing-type.ferroamp.energyhub.channel.s1-measured-current-pv-string.label = S1 Measured Current on PV String Side -thing-type.ferroamp.energyhub.channel.s1-measured-voltage-pv-string.label = S1 Measured Voltage on PV String Side +thing-type.ferroamp.energyhub.channel.s1-pv-current.label = S1 Measured Current on PV String Side +thing-type.ferroamp.energyhub.channel.s1-pv-voltage.label = S1 Measured Voltage on PV String Side thing-type.ferroamp.energyhub.channel.s1-relay-status.label = S1 RelayStatus thing-type.ferroamp.energyhub.channel.s1-temperature.label = S1 Temperature Measured on PCB thing-type.ferroamp.energyhub.channel.s1-timestamp.label = S1 Time Stamp When Message was Published @@ -129,8 +129,8 @@ thing-type.ferroamp.energyhub.channel.s1-total-solar-energy.label = S1 Total Sol thing-type.ferroamp.energyhub.channel.s2-dc-link-voltage.label = S2 DC Link Voltage thing-type.ferroamp.energyhub.channel.s2-fault-code.label = S2 FaultCode thing-type.ferroamp.energyhub.channel.s2-id.label = S2 ID -thing-type.ferroamp.energyhub.channel.s2-measured-current-pv-string.label = S2 Measured Current on PV String Side -thing-type.ferroamp.energyhub.channel.s2-measured-voltage-pv-string.label = S2 Measured Voltage on PV String Side +thing-type.ferroamp.energyhub.channel.s2-pv-current.label = S2 Measured Current on PV String Side +thing-type.ferroamp.energyhub.channel.s2-pv-voltage.label = S2 Measured Voltage on PV String Side thing-type.ferroamp.energyhub.channel.s2-relay-status.label = S2 RelayStatus thing-type.ferroamp.energyhub.channel.s2-temperature.label = S2 Temperature Measured on PCB thing-type.ferroamp.energyhub.channel.s2-timestamp.label = S2 Time Stamp When Message was Published @@ -138,8 +138,8 @@ thing-type.ferroamp.energyhub.channel.s2-total-solar-energy.label = S2 Total Sol thing-type.ferroamp.energyhub.channel.s3-dc-link-voltage.label = S3 DC Link Voltage thing-type.ferroamp.energyhub.channel.s3-fault-code.label = S3 FaultCode thing-type.ferroamp.energyhub.channel.s3-id.label = S3 ID -thing-type.ferroamp.energyhub.channel.s3-measured-current-pv-string.label = S3 Measured Current on PV String Side -thing-type.ferroamp.energyhub.channel.s3-measured-voltage-pv-string.label = S3 Measured Voltage on PV String Side +thing-type.ferroamp.energyhub.channel.s3-pv-current.label = S3 Measured Current on PV String Side +thing-type.ferroamp.energyhub.channel.s3-pv-voltage.label = S3 Measured Voltage on PV String Side thing-type.ferroamp.energyhub.channel.s3-relay-status.label = S3 RelayStatus thing-type.ferroamp.energyhub.channel.s3-temperature.label = S3 Temperature Measured on PCB thing-type.ferroamp.energyhub.channel.s3-timestamp.label = S3 Time Stamp When Message was Published @@ -149,10 +149,8 @@ thing-type.ferroamp.energyhub.channel.soh.label = System State of Health thing-type.ferroamp.energyhub.channel.solar-pv.label = Solar Power thing-type.ferroamp.energyhub.channel.state.label = State of the System thing-type.ferroamp.energyhub.channel.timestamp.label = Time Stamp When Message was Published -thing-type.ferroamp.energyhub.channel.total-rated-capacity-all-batteries.label = Total Rated Capacity of All Batteries +thing-type.ferroamp.energyhub.channel.total-capacity-batteries.label = Total Rated Capacity of All Batteries thing-type.ferroamp.energyhub.channel.total-solar-energy.label = Total Solar Energy -thing-type.ferroamp.energyhub.label = Ferroamp Binding Thing -thing-type.ferroamp.energyhub.description = Thing for Ferroamp Binding # thing types config @@ -177,18 +175,6 @@ thing-type.config.ferroamp.energyhub.ssoS3.description = Fourth SSO Unit Availab thing-type.config.ferroamp.energyhub.userName.label = Username thing-type.config.ferroamp.energyhub.userName.description = Username to access the device -# channel group types - -channel-group-type.ferroamp.date-time.label = Date Time -channel-group-type.ferroamp.dimensionless.label = Dimensionless -channel-group-type.ferroamp.electric-current.label = Electric Current -channel-group-type.ferroamp.electric-potential.label = Electrical Potential -channel-group-type.ferroamp.energy.label = Energy -channel-group-type.ferroamp.frequency.label = Frequency -channel-group-type.ferroamp.power.label = Power -channel-group-type.ferroamp.string.label = String -channel-group-type.ferroamp.temperature.label = Temperature - # channel types channel-type.ferroamp.date-time.label = Date Time @@ -205,6 +191,48 @@ channel-type.ferroamp.request.description = Used for control of system channel-type.ferroamp.string.label = String channel-type.ferroamp.temperature.label = Temperature +# thing types + +thing-type.ferroamp.energyhub.channel.esm-rated-power-battery.label = Esm Rated Power of Battery +thing-type.ferroamp.energyhub.channel.esm-total-rated-capacity-all-batteries.label = Esm Rated Capacity +thing-type.ferroamp.energyhub.channel.esm-unique-identifier.label = Esm Unique Identifier +thing-type.ferroamp.energyhub.channel.eso-unique-identifier.label = Eso Unique Identifier +thing-type.ferroamp.energyhub.channel.external-energy-consumed-3p.label = External Energy Consumed 3p +thing-type.ferroamp.energyhub.channel.external-energy-consumed-l1.label = External Energy Consumed L1 +thing-type.ferroamp.energyhub.channel.external-energy-consumed-l2.label = External Energy Consumed L2 +thing-type.ferroamp.energyhub.channel.external-energy-consumed-l3.label = External Energy Consumed L3 +thing-type.ferroamp.energyhub.channel.external-energy-produced-3p.label = External Energy Produced 3p +thing-type.ferroamp.energyhub.channel.external-energy-produced-l1.label = External Energy Produced L1 +thing-type.ferroamp.energyhub.channel.external-energy-produced-l2.label = External Energy Produced L2 +thing-type.ferroamp.energyhub.channel.external-energy-produced-l3.label = External Energy Produced L3 +thing-type.ferroamp.energyhub.channel.inverter-energy-consumed-3p.label = Inverter Energy Consumed 3p +thing-type.ferroamp.energyhub.channel.inverter-energy-produced-3p.label = Inverter Energy Produced 3p +thing-type.ferroamp.energyhub.channel.load-energy-consumed-3p.label = Load Energy Consumed 3p +thing-type.ferroamp.energyhub.channel.load-energy-produced-3p.label = Load Energy Produced 3p +thing-type.ferroamp.energyhub.channel.measured-current-battery.label = Eso Current Measured on Battery Side +thing-type.ferroamp.energyhub.channel.measured-voltage-battery.label = Eso Voltage Measured on Battery Side +thing-type.ferroamp.energyhub.channel.s0-measured-current-pv-string.label = S0 Measured Current on PV String Side +thing-type.ferroamp.energyhub.channel.s0-measured-voltage-pv-string.label = S0 Measured Voltage on PV String Side +thing-type.ferroamp.energyhub.channel.s1-measured-current-pv-string.label = S1 Measured Current on PV String Side +thing-type.ferroamp.energyhub.channel.s1-measured-voltage-pv-string.label = S1 Measured Voltage on PV String Side +thing-type.ferroamp.energyhub.channel.s2-measured-current-pv-string.label = S2 Measured Current on PV String Side +thing-type.ferroamp.energyhub.channel.s2-measured-voltage-pv-string.label = S2 Measured Voltage on PV String Side +thing-type.ferroamp.energyhub.channel.s3-measured-current-pv-string.label = S3 Measured Current on PV String Side +thing-type.ferroamp.energyhub.channel.s3-measured-voltage-pv-string.label = S3 Measured Voltage on PV String Side +thing-type.ferroamp.energyhub.channel.total-rated-capacity-all-batteries.label = Total Rated Capacity of All Batteries + +# channel group types + +channel-group-type.ferroamp.date-time.label = Date Time +channel-group-type.ferroamp.dimensionless.label = Dimensionless +channel-group-type.ferroamp.electric-current.label = Electric Current +channel-group-type.ferroamp.electric-potential.label = Electrical Potential +channel-group-type.ferroamp.energy.label = Energy +channel-group-type.ferroamp.frequency.label = Frequency +channel-group-type.ferroamp.power.label = Power +channel-group-type.ferroamp.string.label = String +channel-group-type.ferroamp.temperature.label = Temperature + # channel types channel-type.ferroamp.ehub-gridfreq.label = EHUB, Estimated Grid Frequency diff --git a/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/channels.xml b/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/channels.xml deleted file mode 100644 index 32cf435834826..0000000000000 --- a/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/channels.xml +++ /dev/null @@ -1,101 +0,0 @@ - - - - Number:Energy - - Energy - - - - - - - Number:ElectricCurrent - - Energy - - - - - - - Number:Power - - Energy - - - - - - - DateTime - - Energy - - - - - - - Number:ElectricPotential - - Energy - - - - - - - Number:Frequency - - Energy - - - - - - - Number:Dimensionless - - Energy - - - - - - - Number:Temperature - - Energy - - - - - - - String - - Energy - - - - - - - String - - Used for control of system - Energy - - - - String - - Returns Extapi Version - Energy - - - diff --git a/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/ferroamp.xml b/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/ferroamp.xml deleted file mode 100644 index 211d5c8902ee9..0000000000000 --- a/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/ferroamp.xml +++ /dev/null @@ -1,449 +0,0 @@ - - - - - Represents the Ferroamp EnergyHub - Energy - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Ferroamp - - - - diff --git a/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/thing-types.xml b/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/thing-types.xml index af1e4cf3291a1..4671b26f16ff7 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/thing-types.xml +++ b/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/thing-types.xml @@ -1,57 +1,573 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0" + xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd"> - - - Thing for Ferroamp Binding - - - network-address - - Hostname or IP address of the device - - - username - - Username to access the device - - - password - - Password to access the device - - - - Ehub type, with/without battery - false - - - - First SSO Unit Available - - - - Second SSO Unit Available - - - - Third SSO Unit Available - - - - Fourth SSO Unit Available - - - - ESO Module Available - - - - ESM Module Available - - - + + + Provides information from Ferroamp EnergyHub + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + network-address + + Hostname or IP address of the device + + + username + + Username to access the device + + + password + + Password to access the device + + + + Ehub type, with/without battery + false + + + + First SSO Unit Available + + + + Second SSO Unit Available + + + + Third SSO Unit Available + + + + Fourth SSO Unit Available + + + + ESO Module Available + + + + ESM Module Available + + + + + + Number:Energy + + Energy + + + + + Number:ElectricCurrent + + Energy + + + + + Number:Power + + Energy + + + + + DateTime + + Energy + + + + + Number:ElectricPotential + + Energy + + + + + Number:Frequency + + Energy + + + + + Number:Dimensionless + + Energy + + + + + Number:Temperature + + Energy + + + + + String + + Energy + + + + + String + + Used for control of system + Energy + + + + + String + + Returns Extapi Version + Energy + + + diff --git a/bundles/pom.xml b/bundles/pom.xml index eb74ebaacecd5..73c4d5e9775ad 100644 --- a/bundles/pom.xml +++ b/bundles/pom.xml @@ -477,8 +477,6 @@ org.openhab.voice.rustpotterks org.openhab.voice.voicerss org.openhab.voice.voskstt - org.openhab.voice.watsonstt - org.openhab.voice.whisperstt target/dependency From 1d50b746a7b66e6bbffd8f914234a2a4692e3988 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96rjan=20Backsell?= Date: Thu, 24 Oct 2024 19:19:53 +0200 Subject: [PATCH 08/16] [ferroamp] Binding for ferroamp 20241024_1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes done in FerroampHandler.java Signed-off-by: Örjan Backsell --- .../org/openhab/binding/ferroamp/internal/FerroampHandler.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java index 24d1f9c88d3e9..753e543965063 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java @@ -121,9 +121,7 @@ public void initialize() { // Start channel-update as configured scheduler.scheduleWithFixedDelay(() -> { - System.out.println("ffff = " + getFerroampConnection().connectionState()); if (getFerroampConnection().connectionState().toString().equals("DISCONNECTED")) { - System.out.println("aaaaa = " + getFerroampConnection().connectionState()); updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR); logger.debug("Problem connection to MqttBroker"); } else { From a68234a31c498a1caeb432d29ec944199dbe5da6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96rjan=20Backsell?= Date: Thu, 24 Oct 2024 19:50:34 +0200 Subject: [PATCH 09/16] [ferroamp] Binding for ferroamp 20241024_2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Please, see each Conversion for latest answers Signed-off-by: Örjan Backsell --- .../internal/FerroampMqttCommunication.java | 1 - .../resources/OH-INF/thing/thing-types.xml | 1138 ++++++++--------- 2 files changed, 569 insertions(+), 570 deletions(-) diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampMqttCommunication.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampMqttCommunication.java index ca7adb7a9fc8b..0134f470d273d 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampMqttCommunication.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampMqttCommunication.java @@ -749,7 +749,6 @@ void processIncomingJsonMessageEsm(String topic, String messageJsonEsm) { esmChannelPostsValue[6] = ts.getVal(); esmChannelsUpdateValues = esmChannelPostsValue; - } public @Nullable static String[] getEhubChannelUpdateValues() { diff --git a/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/thing-types.xml b/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/thing-types.xml index 4671b26f16ff7..fd0729ce90af8 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/thing-types.xml +++ b/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/thing-types.xml @@ -1,573 +1,573 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0" + xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd"> + + + + Provides information from Ferroamp EnergyHub + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + network-address + + Hostname or IP address of the device + + + username + + Username to access the device + + + password + + Password to access the device + + + + Ehub type, with/without battery + false + + + + First SSO Unit Available + + + + Second SSO Unit Available + + + + Third SSO Unit Available + + + + Fourth SSO Unit Available + + + + ESO Module Available + + + + ESM Module Available + + + + + + Number:Energy + + Energy + + + + + Number:ElectricCurrent + + Energy + + + + + Number:Power + + Energy + + + + + DateTime + + Energy + + + + + Number:ElectricPotential + + Energy + + + + + Number:Frequency + + Energy + + + + + Number:Dimensionless + + Energy + + + + + Number:Temperature + + Energy + + + + + String + + Energy + + + + + String + + Used for control of system + Energy + + + + + String + + Returns Extapi Version + Energy + + - - - Provides information from Ferroamp EnergyHub - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - network-address - - Hostname or IP address of the device - - - username - - Username to access the device - - - password - - Password to access the device - - - - Ehub type, with/without battery - false - - - - First SSO Unit Available - - - - Second SSO Unit Available - - - - Third SSO Unit Available - - - - Fourth SSO Unit Available - - - - ESO Module Available - - - - ESM Module Available - - - - - - Number:Energy - - Energy - - - - - Number:ElectricCurrent - - Energy - - - - - Number:Power - - Energy - - - - - DateTime - - Energy - - - - - Number:ElectricPotential - - Energy - - - - - Number:Frequency - - Energy - - - - - Number:Dimensionless - - Energy - - - - - Number:Temperature - - Energy - - - - - String - - Energy - - - - - String - - Used for control of system - Energy - - - - - String - - Returns Extapi Version - Energy - - - From 2cd249119a81667195323a96a69bde2871e2bb2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96rjan=20Backsell?= Date: Thu, 7 Nov 2024 17:27:03 +0100 Subject: [PATCH 10/16] [ferroamp] Binding for ferroamp 20241107 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes done in: EhubJsonElements.java EsmJsonElements.java EsoJsonElements.java ferroamp.properties FerroampBindingConstants.java FerroampChannelConfiguration.java FerroampConfiguration.java FerroampHandler.java FerroampMqttCommunication.java SsoJsonElements.java thing-types.xml Signed-off-by: Örjan Backsell --- .../org.openhab.binding.ferroamp/README.md | 330 +++++++++--------- .../ferroamp/internal/EhubJsonElements.java | 2 +- .../ferroamp/internal/EsmJsonElements.java | 2 +- .../ferroamp/internal/EsoJsonElements.java | 2 +- .../internal/FerroampBindingConstants.java | 61 ++-- .../FerroampChannelConfiguration.java | 96 +++-- .../internal/FerroampConfiguration.java | 4 - .../ferroamp/internal/FerroampHandler.java | 173 ++++----- .../internal/FerroampMqttCommunication.java | 231 ++++++------ .../ferroamp/internal/SsoJsonElements.java | 2 +- .../resources/OH-INF/i18n/ferroamp.properties | 158 +++++---- .../resources/OH-INF/thing/thing-types.xml | 215 +++++------- 12 files changed, 606 insertions(+), 670 deletions(-) diff --git a/bundles/org.openhab.binding.ferroamp/README.md b/bundles/org.openhab.binding.ferroamp/README.md index db2812ad2c113..6359f332512d5 100644 --- a/bundles/org.openhab.binding.ferroamp/README.md +++ b/bundles/org.openhab.binding.ferroamp/README.md @@ -1,4 +1,4 @@ -## Ferroamp Binding +# Ferroamp Binding The Ferroamp binding is used to get live data from Ferroamp EnergyHub @@ -7,16 +7,19 @@ Data and commands are received/sent using MQTT where the user connects to the MQ *note* Contact Ferroamp support to enable MQTT in the EnergyHub and to get the Username and Password: -https://ferroamp.com/om-ferroamp/ + + +Every Sso has a unique serial number which is marked on the side of the SSO unit. Ex. PS00990-A04-S20120476. +This number is to identify the respective Sso Pv-string. ## Supported Things The binding retrieves data from the different parts of the Ferroamp EnergyHub such as: - `ehub`: EnergyHub Wall and EnergyHub XL. -- `sso`: Solar string optimizer. -- `eso`: Bidirectional DC/DC converter for connection of battery. -- `esm`: Energy Storage Module. +- `sso` : Solar string optimizer. +- `eso` : Bidirectional DC/DC converter for connection of battery. +- `esm` : Energy Storage Module. ## Discovery @@ -32,178 +35,170 @@ The following configuration parameters are available. | userName | text | Username to access the device | N/A | yes | no | | password | text | Password to access the device | N/A | yes | no | | hasBattery | boolean | Has the system a battery connected? | N/A | no | yes | -| ssoS0 | boolean | Has the system, the 1'st Sso Pv-string connected? | N/A | no | no | -| ssoS1 | boolean | Has the system, the 2'nd Sso Pv-string connected? | N/A | no | no | -| ssoS2 | boolean | Has the system, the 3'rd Sso Pv-string connected? | N/A | no | no | -| ssoS3 | boolean | Has the system, the 4'th Sso Pv-string connected? | N/A | no | no | | eso | boolean | Has the system an Eso unit connected? | N/A | no | no | | esm | boolean | Has the system an Esm unit connected? | N/A | no | no | -| The unique serial number is marked on the side of the SSO unit. Ex. PS00990-A04-S20120476 ## Channels -| Channel Type ID | Item Type | Read/Write | Label | Description -|---------------------------------------------------------------------------------------------------------------------------------------------- -| grid-frequency | Number:Frequency | R | Estimated Grid Frequency | Estimated Grid Frequency | -| ace-current-l1 | Number:ElectricCurrent | R | ACE Current L1 | Adaptive Current Equalization (ACE) equalization current set-points in Amps root mean square (Arms) | -| ace-current-l2 | Number:ElectricCurrent | R | ACE Current L2 | Adaptive Current Equalization (ACE) equalization current set-points in Amps root mean square (Arms) | -| ace-current-l3 | Number:ElectricCurrent | R | ACE Current L3 | Adaptive Current Equalization (ACE) equalization current set-points in Amps root mean square (Arms) | -| external-voltage-l1 | Number:ElectricPotential | R | External Voltage L1 | External voltage | -| external-voltage-l2 | Number:ElectricPotential | R | External Voltage L2 | External voltage | -| external-voltage-l3 | Number:ElectricPotential | R | External Voltage L3 | External voltage | -| inverter-rms-current-l1 | Number:ElectricCurrent | R | Inverter RMS Current L1 | Inverter RMS current | -| inverter-rms-current-l2 | Number:ElectricCurrent | R | Inverter RMS Current L2 | Inverter RMS current | -| inverter-rms-current-l3 | Number:ElectricCurrent | R | Inverter RMS Current L3 | Inverter RMS current | -| inverter-current-reactive-l1 | Number:ElectricCurrent | R | Inverter Current Reactive L1 | Inverter reactive current | -| inverter-current-reactive-l2 | Number:ElectricCurrent | R | Inverter Current Reactive L2 | Inverter reactive current | -| inverter-current-reactive-l3 | Number:ElectricCurrent | R | Inverter Current Reactive L3 | Inverter reactive current | -| inverter-current-active-l1 | Number:ElectricCurrent | R | Inverter Active current L1 | Inverter active current | -| inverter-current-active-l2 | Number:ElectricCurrent | R | Inverter Active current L1 | Inverter active current | -| inverter-current-active-l3 | Number:ElectricCurrent | R | Inverter Active current L1 | Inverter active current | -| grid-current-l1 | Number:ElectricCurrent | R | Grid Current L1 | Grid RMS current | -| grid-current-l2 | Number:ElectricCurrent | R | Grid Current L2 | Grid RMS current | -| grid-current-l3 | Number:ElectricCurrent | R | Grid Current L3 | Grid RMS current | -| grid-current-reactive-l1 | Number:ElectricCurrent | R | Grid Current Reactive L1 | Grid current reactive | -| grid-current-reactive-l2 | Number:ElectricCurrent | R | Grid Current Reactive L2 | Grid current reactive | -| grid-current-reactive-l3 | Number:ElectricCurrent | R | Grid Current Reactive L3 | Grid current reactive | -| grid-current-active-l1 | Number:ElectricCurrent | R | Grid Current Active L1 | Grid current active | -| grid-current-active-l2 | Number:ElectricCurrent | R | Grid Current Active L2 | Grid current active | -| grid-current-active-l3 | Number:ElectricCurrent | R | Grid Current Active L3 | Grid current active | -| inverter-reactive-current-l1 | Number:ElectricCurrent | R | Inverter Reactive Current L1 | -| inverter-reactive-current-l2 | Number:ElectricCurrent | R | Inverter Reactive Current L2 | -| inverter-reactive-current-l3 | Number:ElectricCurrent | R | Inverter Reactive Current L3 | -| inverter-load-l1 | Number:ElectricCurrent | R | Inverter Load L1 | -| inverter-load-l2 | Number:ElectricCurrent | R | Inverter Load L2 | -| inverter-load-l3 | Number:ElectricCurrent | R | Inverter Load L3 | -| apparent-power | Number:Energy | R | Apparent Power | Apparent power -| grid-power-active-l1 | Number:Power | R | Grid Power Active L1 | Grid power, active | -| grid-power-active-l2 | Number:Power | R | Grid Power Active L2 | Grid power, active | -| grid-power-active-l3 | Number:Power | R | Grid Power Active L3 | Grid power, active | -| grid-power-reactive-l1 | Number:Power | R | Grid Power Reactive L1 | Grid power, reactive | -| grid-power-reactive-l2 | Number:Power | R | Grid Power Reactive L2 | Grid power, reactive | -| grid-power-reactive-l3 | Number:Power | R | Grid Power Reactive L3 | Grid power, reactive | -| inverter-power-active-l1 | Number:Power | R | Inverter Power Active L1 | Inverter power, active | -| inverter-power-active-l2 | Number:Power | R | Inverter Power Active L2 | Inverter power, active | -| inverter-power-active-l3 | Number:Power | R | Inverter Power Active L3 | Inverter power, active | -| inverter-power-reactive-l1 | Number:Power | R | Inverter Power Reactive L1 | Inverter power, reactive | -| inverter-power-reactive-l1 | Number:Power | R | Inverter Power Reactive L2 | Inverter power, reactive | -| inverter-power-reactive-l1 | Number:Power | R | Inverter Power Reactive L3 | Inverter power, reactive | -| consumption-power-l1 | Number:Power | R | Consumption Power L1 | -| consumption-power-l2 | Number:Power | R | Consumption Power L2 | -| consumption-power-l3 | Number:Power | R | Consumption Power L3 | -| consumption-power-reactive-l1 | Number:Power | R | Consumption Power Reactive L1 | -| consumption-power-reactive-l2 | Number:Power | R | Consumption Power Reactive L2 | -| consumption-power-reactive-l3 | Number:Power | R | Consumption Power Reactive L3 | -| solar-pv | Number:Power | R | Solar Power | Only sent when system has PV | -| positive-dc-link-voltage | Number:ElectricPotential | R | Positiv DC Link Voltage | Positiv DC link voltage | -| negative-dc-link-voltage | Number:ElectricPotential | R | Negative DC Link Voltage | Negative DC link voltage | -| grid-energy-produced-l1 | Number:Energy | R | Grid Energy Produced L1 | -| grid-energy-produced-l2 | Number:Energy | R | Grid Energy Produced L2 | -| grid-energy-produced-l3 | Number:Energy | R | Grid Energy Produced L3 | -| grid-energy-consumed-l1 | Number:Energy | R | Grid Energy Consumed L1 | -| grid-energy-consumed-l2 | Number:Energy | R | Grid Energy Consumed L2 | -| grid-energy-consumed-l3 | Number:Energy | R | Grid Energy Consumed L3 | -| inverter-energy-produced-l1 | Number:Energy | R | Inverter Energy Produced L1 | -| inverter-energy-produced-l2 | Number:Energy | R | Inverter Energy Produced L2 | -| inverter-energy-produced-l3 | Number:Energy | R | Inverter Energy Produced L3 | -| inverter-energy-consumed-l1 | Number:ElectricCurrent | R | Inverter Energy Consumed L1 | -| inverter-energy-consumed-l2 | Number:ElectricCurrent | R | Inverter Energy Consumed L2 | -| inverter-energy-consumed-l3 | Number:ElectricCurrent | R | Inverter Energy Consumed L3 | -| load-energy-produced-l1 | Number:Energy | R | Load Energy Produced L1 | -| load-energy-produced-l2 | Number:Energy | R | Load Energy Produced L2 | -| load-energy-produced-l3 | Number:Energy | R | Load Energy Produced L3 | -| load-energy-consumed-l1 | Number:Energy | R | Load Energy Consumed L1 | -| load-energy-consumed-l2 | Number:Energy | R | Load Energy Consumed L2 | -| load-energy-consumed-l3 | Number:Energy | R | Load Energy Consumed L3 | -| total-grid-energy-produced | Number:Energy | R | Total produced grid energy | -| total-grid-energy-consumed | Number:Energy | R | Total consumed grid energy | -| total-inverter-energy-produced | Number:Energy | R | Total produced inverter energy | -| total-inverter-energy-consumed | Number:Energy | R | Total consumed inverter energy | -| total-load-energy-produced | Number:Energy | R | Total produced load energy | -| total-load-energy-consumed | Number:Energy | R | Total consumed load energy | -| total-solar-energy | Number:Energy | R | Total Solar Energy | Only sent when system has PV | -| state | String | R | State of the System | -| timestamp | DateTime | R | Time Stamp When Message was Published | Time stamp when message was published | -| battery-energy-produced | Number:Energy | R | Battery Energy Produced | Only sent when system has batteries | -| battery-energy-consumed | Number:Energy | R | Battery Energy Consumed | Only sent when system has batteries | -| soc | Number:Dimensionless | R | System State of Check | State of the system | -| soh | Number:Dimensionless | R | System State of Health | -| power-battery | Number:Power | R | Battery Power | Only sent when system has batteries | -| total-capacity-batteries | Number:Energy | R | Total Rated Capacity of All Batteries | - -| s0-id | String | R | S0 ID | Unique identifier of SSO-0 | -| s0-pv-voltage | Number:ElectricPotential | R | S0 Measured Voltage on PV String Side | Measured on PV string side | -| s0-pv-current | Number:ElectricCurrent | R | S0 Measured Current on PV String Side | Measured on PV string side | -| s0-total-solar-energy | Number:Energy | R | S0 Total Solar Energy | Total energy produced by SSO-0 | -| s0-relay-status | Contact | R | S0 Relay Status | 0 = relay closed (i.e running power), 1 = relay open/disconnected, 2 = precharge | -| s0-temperature | Number:Temperature | R | S0 Temperature Measured on PCB | Temperature Measured on PCB | -| s0-fault-code | String | R | S0 FaultCode | 0x00 = OK. For all other values Please contact Ferroamp support | -| s0-dc-link-voltage | Number:ElectricPotential | R | S0 DC Link Voltage | DC link voltage as measured by SSO-0 | -| s0-timestamp | DateTime | R | S0 Time Stamp When Message was Published | Time stamp when message was published | - | -| s1-id | String | R | S1 ID | Unique identifier of SSO-1 | -| s1-pv-voltage | Number:ElectricPotential | R | S1 easured Voltage on PV String Side | Measured on PV string side | -| s1-pv-current | Number:ElectricCurrent | R | S1 Measured Current on PV String Side | Measured on PV string side | -| s1-total-solar-energy | Number:Energy | R | S1 Total Solar Energy | Total energy produced by SSO-1 | -| s1-relay-status | Contact | R | S1 Relay Status | 0 = relay closed (i.e running power), 1 = relay open/disconnected, 2 = precharge | -| s1-temperature | Number:Temperature | R | S1 Temperature Measured on PCB | Temperature Measured on PCB | -| s1-fault-code | String | R | S1 FaultCode | 0x00 = OK. For all other values Please contact Ferroamp support | -| s1-dc-link-voltage | Number:ElectricPotential | R | S1 DC Link Voltage | DC link voltage as measured by SSO-1 | -| s1-timestamp | DateTime | R | S1 Time Stamp When Message was Published | Time stamp when message was published | - | +| Channel Type ID | Item Type | Read/Write | Label | Description | +|--------------------------------------------------------------------|------------|------------------------------------------|------------------------------------------------------------------------------------------------------| +| grid-frequency | Number:Frequency | R | Grid Frequency | Grid frequency | +| ace-current-l1 | Number:ElectricCurrent | R | ACE Current L1 | Adaptive Current Equalization (ACE) equalization current set-points in Amps root mean square (Arms) | +| ace-current-l2 | Number:ElectricCurrent | R | ACE Current L2 | Adaptive Current Equalization (ACE) equalization current set-points in Amps root mean square (Arms) | +| ace-current-l3 | Number:ElectricCurrent | R | ACE Current L3 | Adaptive Current Equalization (ACE) equalization current set-points in Amps root mean square (Arms) | +| grid-voltage-l1 | Number:ElectricPotential | R | Grid Voltage L1 | Grid voltage | +| grid-voltage-l2 | Number:ElectricPotential | R | Grid Voltage L2 | Grid voltage | +| grid-voltage-l3 | Number:ElectricPotential | R | Grid Voltage L3 | Grid voltage | +| inverter-rms-current-l1 | Number:ElectricCurrent | R | Inverter RMS Current L1 | Inverter RMS current | +| inverter-rms-current-l2 | Number:ElectricCurrent | R | Inverter RMS Current L2 | Inverter RMS current | +| inverter-rms-current-l3 | Number:ElectricCurrent | R | Inverter RMS Current L3 | Inverter RMS current | +| inverter-reactive-current-l1 | Number:ElectricCurrent | R | Inverter Reactive Current L1 | Inverter reactive current | +| inverter-reactive-current-l2 | Number:ElectricCurrent | R | Inverter Reactive Current L2 | Inverter reactive current | +| inverter-reactive-current-l3 | Number:ElectricCurrent | R | Inverter Reactive Current L3 | Inverter reactive current | +| inverter-active-current-l1 | Number:ElectricCurrent | R | Inverter Active current L1 | Inverter active current | +| inverter-active-current-l2 | Number:ElectricCurrent | R | Inverter Active current L2 | Inverter active current | +| inverter-active-current-l3 | Number:ElectricCurrent | R | Inverter Active current L3 | Inverter active current | +| grid-current-l1 | Number:ElectricCurrent | R | Grid Current L1 | Grid RMS current | +| grid-current-l2 | Number:ElectricCurrent | R | Grid Current L2 | Grid RMS current | +| grid-current-l3 | Number:ElectricCurrent | R | Grid Current L3 | Grid RMS current | +| grid-reactive-current-l1 | Number:ElectricCurrent | R | Grid Reactive Current L1 | Grid reactive current | +| grid-reactive-current-l2 | Number:ElectricCurrent | R | Grid Reactive Current L2 | Grid reactive current | +| grid-reactive-current-l3 | Number:ElectricCurrent | R | Grid Reactive Current L3 | Grid reactive current | +| grid-active-current-l1 | Number:ElectricCurrent | R | Grid Active Current L1 | Grid active current | +| grid-active-current-l2 | Number:ElectricCurrent | R | Grid Active Current L2 | Grid active current | +| grid-active-current-l3 | Number:ElectricCurrent | R | Grid Active Current L3 | Grid active current | +| inverter-load-reactive-current-l1 | Number:ElectricCurrent | R | Inverter Load Reactive Current L1 | | +| inverter-load-reactive-current-l2 | Number:ElectricCurrent | R | Inverter Load Reactive Current L2 | | +| inverter-load-reactive-current-l3 | Number:ElectricCurrent | R | Inverter Load Reactive Current L3 | | +| inverter-load-active-current-l1 | Number:ElectricCurrent | R | Inverter Load Active Current L1 | | +| inverter-load-active-current-l2 | Number:ElectricCurrent | R | Inverter Load Active Current L2 | | +| inverter-load-active-current-l3 | Number:ElectricCurrent | R | Inverter Load Active Current L3 | | +| apparent-power | Number:Energy | R | Apparent Power | Apparent power | +| grid-power-active-l1 | Number:Power | R | Grid Power Active L1 | Grid power, active | +| grid-power-active-l2 | Number:Power | R | Grid Power Active L2 | Grid power, active | +| grid-power-active-l3 | Number:Power | R | Grid Power Active L3 | Grid power, active | +| grid-power-reactive-l1 | Number:Power | R | Grid Power Reactive L1 | Grid power, reactive | +| grid-power-reactive-l2 | Number:Power | R | Grid Power Reactive L2 | Grid power, reactive | +| grid-power-reactive-l3 | Number:Power | R | Grid Power Reactive L3 | Grid power, reactive | +| inverter-power-active-l1 | Number:Power | R | Inverter Power Active L1 | Inverter power, active | +| inverter-power-active-l2 | Number:Power | R | Inverter Power Active L2 | Inverter power, active | +| inverter-power-active-l3 | Number:Power | R | Inverter Power Active L3 | Inverter power, active | +| inverter-power-reactive-l1 | Number:Power | R | Inverter Power Reactive L1 | Inverter power, reactive | +| inverter-power-reactive-l1 | Number:Power | R | Inverter Power Reactive L2 | Inverter power, reactive | +| inverter-power-reactive-l1 | Number:Power | R | Inverter Power Reactive L3 | Inverter power, reactive | +| consumption-power-l1 | Number:Power | R | Consumption Power L1 | | +| consumption-power-l2 | Number:Power | R | Consumption Power L2 | | +| consumption-power-l3 | Number:Power | R | Consumption Power L3 | | +| consumption-power-reactive-l1 | Number:Power | R | Consumption Power Reactive L1 | | +| consumption-power-reactive-l2 | Number:Power | R | Consumption Power Reactive L2 | | +| consumption-power-reactive-l3 | Number:Power | R | Consumption Power Reactive L3 | | +| solar-pv | Number:Power | R | Solar Power | Only sent when system has PV | +| positive-dc-link-voltage | Number:ElectricPotential | R | Positiv DC Link Voltage | Positiv DC link voltage | +| negative-dc-link-voltage | Number:ElectricPotential | R | Negative DC Link Voltage | Negative DC link voltage | +| grid-energy-produced-l1 | Number:Energy | R | Grid Energy Produced L1 | | +| grid-energy-produced-l2 | Number:Energy | R | Grid Energy Produced L2 | | +| grid-energy-produced-l3 | Number:Energy | R | Grid Energy Produced L3 | | +| grid-energy-consumed-l1 | Number:Energy | R | Grid Energy Consumed L1 | | +| grid-energy-consumed-l2 | Number:Energy | R | Grid Energy Consumed L2 | | +| grid-energy-consumed-l3 | Number:Energy | R | Grid Energy Consumed L3 | | +| inverter-energy-produced-l1 | Number:Energy | R | Inverter Energy Produced L1 | | +| inverter-energy-produced-l2 | Number:Energy | R | Inverter Energy Produced L2 | | +| inverter-energy-produced-l3 | Number:Energy | R | Inverter Energy Produced L3 | | +| inverter-energy-consumed-l1 | Number:ElectricCurrent | R | Inverter Energy Consumed L1 | | +| inverter-energy-consumed-l2 | Number:ElectricCurrent | R | Inverter Energy Consumed L2 | | +| inverter-energy-consumed-l3 | Number:ElectricCurrent | R | Inverter Energy Consumed L3 | | +| load-energy-produced-l1 | Number:Energy | R | Load Energy Produced L1 | | +| load-energy-produced-l2 | Number:Energy | R | Load Energy Produced L2 | | +| load-energy-produced-l3 | Number:Energy | R | Load Energy Produced L3 | | +| load-energy-consumed-l1 | Number:Energy | R | Load Energy Consumed L1 | | +| load-energy-consumed-l2 | Number:Energy | R | Load Energy Consumed L2 | | +| load-energy-consumed-l3 | Number:Energy | R | Load Energy Consumed L3 | | +| grid-energy-produced-total | Number:Energy | R | Grid Energy Produced Total | | +| grid-energy-consumed-total | Number:Energy | R | Grid Energy Consumed Total | | +| inverter-energy-produced-total | Number:Energy | R | Inverter Energy Produced Total | | +| inverter-energy-consumed-total | Number:Energy | R | Inverter Energy Consumed Total | | +| load-energy-produced-total | Number:Energy | R | Load Energy Produced Total | | +| load-energy-consumed-total | Number:Energy | R | Load Energy Consumed Total | | +| total-solar-energy | Number:Energy | R | Total Solar Energy | Only sent when system has PV | +| state | String | R | State of the System | | +| timestamp | DateTime | R | Time Stamp | Time stamp when message was published | +| battery-energy-produced | Number:Energy | R | Battery Energy Produced | Only sent when system has batteries | +| battery-energy-consumed | Number:Energy | R | Battery Energy Consumed | Only sent when system has batteries | +| soc | Number:Dimensionless | R | System State of Check | State of the system | +| soh | Number:Dimensionless | R | System State of Health | | +| power-battery | Number:Power | R | Battery Power | Only sent when system has batteries | +| total-capacity-batteries | Number:Energy | R | Total Capacity Batteries | Total rated capacity of all batteries | + +| s1-id | String | R | S1 ID | Unique identifier of SSO-1 | +| s1-pv-voltage | Number:ElectricPotential | R | S1 Voltage on PV String Side | Measured on PV string side | +| s1-pv-current | Number:ElectricCurrent | R | S1 Current on PV String Side | Measured on PV string side | +| s1-total-solar-energy | Number:Energy | R | S1 Total Solar Energy | Total energy produced by SSO-1 | +| s1-relay-status | Contact | R | S1 Relay Status | 0 = relay closed (i.e running power), 1 = relay open/disconnected, 2 = precharge | +| s1-temperature | Number:Temperature | R | S1 Temperature on PCB | Temperature Measured on PCB | +| s1-fault-code | String | R | S1 FaultCode | 0x00 = OK. For all other values Please contact Ferroamp support | +| s1-dc-link-voltage | Number:ElectricPotential | R | S1 DC Link Voltage | DC link voltage as measured by SSO-1 | +| s1-timestamp | DateTime | R | S1 Time Stamp | Time stamp when message was published | + +| s2-id | String | R | S2 ID | Unique identifier of SSO-2 | +| s2-pv-voltage | Number:ElectricPotential | R | S2 Voltage on PV String Side | Measured on PV string side | +| s2-pv-current | Number:ElectricCurrent | R | S2 Current on PV String Side | Measured on PV string side | +| s2-total-solar-energy | Number:Energy | R | S2 Total Solar Energy | Total energy produced by SSO-2 | +| s2-relay-status | Contact | R | S2 Relay Status | 0 = relay closed (i.e running power), 1 = relay open/disconnected, 2 = precharge | +| s2-temperature | Number:Temperature | R | S2 Temperature on PCB | Temperature Measured on PCB | +| s2-fault-code | String | R | S2 FaultCode | 0x00 = OK. For all other values Please contact Ferroamp support | +| s2-dc-link-voltage | Number:ElectricPotential | R | S2 DC Link Voltage | DC link voltage as measured by SSO-2 | +| s2-timestamp | DateTime | R | S2 Time Stamp | Time stamp when message was published | -| s2-id | String | R | S2 ID | Unique identifier of SSO-2 | -| s2-pv-voltage | Number:ElectricPotential | R | S2 Measured Voltage on PV String Side | Measured on PV string side | -| s2-pv-current | Number:ElectricCurrent | R | S2 Measured Current on PV String Side | Measured on PV string side | -| s2-total-solar-energy | Number:Energy | R | S2 Total Solar Energy | Total energy produced by SSO-2 | -| s2-relay-status | Contact | R | S2 Relay Status | 0 = relay closed (i.e running power), 1 = relay open/disconnected, 2 = precharge | -| s2-temperature | Number:Temperature | R | S2 Temperature Measured on PCB | Temperature Measured on PCB | -| s2-fault-code | String | R | S2 FaultCode | 0x00 = OK. For all other values Please contact Ferroamp support | -| s2-dc-link-voltage | Number:ElectricPotential | R | S2 DC Link Voltage | DC link voltage as measured by SSO-2 | -| s2-timestamp | DateTime | R | S2 Time Stamp When Message was Published | Time stamp when message was published | - | - -| s3-id | String | R | S3 ID | Unique identifier of SSO-3 | -| s3-pv-voltage | Number:ElectricPotential | R | S3 Measured Voltage on PV String Side | Measured on PV string side | -| s3-pv-current | Number:ElectricCurrent | R | S3 Measured Current on PV String Side | Measured on PV string side | -| s3-total-solar-energy | Number:Energy | R | S3 Total Solar Energy | Total energy produced by SSO-3 | -| s3-relay-status | Contact | R | S3 Relay Status | 0 = relay closed (i.e running power), 1 = relay open/disconnected, 2 = precharge | -| s3-temperature | Number:Temperature | R | S3 Temperature Measured on PCB | Temperature Measured on PCB | -| s3-fault-code | String | R | S3 FaultCode | 0x00 = OK. For all other values Please contact Ferroamp support | -| s3-dc-link-voltage | Number:ElectricPotential | R | S3 DC Link Voltage | DC link voltage as measured by SSO-3 | -| s3-timestamp | DateTime | R | S3 Time Stamp When Message was Published | Time stamp when message was published | - | - -| eso-id | String | R | Eso Unique Identifier | Unique identifier | -| eso-voltage-battery | Number:ElectricPotential | R | Eso Voltage Measured on Battery Side | Measured on battery side | -| eso-current-battery | Number:ElectricCurrent | R | Eso Current Measured on Battery Side | Measured on battery side | -| eso-battery-energy-produced | Number:Energy | R | Eso Battery Energy Produced | Total energy produced by ESO, i.e total energy charged | -| eso-battery-energy-consumed | Number:Energy | R | Eso Battery Energy Consumed | Total energy consumed by ESO, i.e total energy discharged | -| eso-soc | Number:Dimensionless | R | Eso State of Charge | State of Charge for ESO | -| eso-relay-status | Contact | R | Eso Relay Status | 0 = relay closed, 1 = relay open | -| eso-temperature | Number:Temperature | R | Eso Temperature Measured on PCB | Measured inside ESO | -| eso-fault-code | String | R | Eso FaultCode | See section 4.1.3.1 in Ferroamp-External-API-specifikation | -| eso-battery-energy-produced | Number:Energy | R | Eso Battery Energy Produced | Total energy produced by ESO, i.e total energy charged | -| eso-dc-link-voltage | Number:ElectricPotential | R | Eso Dc Link Voltage | DC link voltage as measured by ESO | -| eso-timestamp | DateTime | R | Eso Time Stamp When Message was Published| Time stamp when message was published | - - -| esm-id | String | R | Esm Unique Identifier | Unique identifier of battery. If available, this will be the unique id that the battery reports.| -| esm-soh | Number:Dimensionless | R | Esm System State of Health | State of Health for ESM | -| esm-soc | Number:Dimensionless | R | Esm System State of Charge | State of Charge for ESM | -| esm-total-capacity | Number:Energy | R | Esm Rated Capacity | Rated capacity of all batteries | -| esm-power-battery | Number:Power | R | Esm Rated power of battery | Rated power of battery | -| esm-status | String | R | Esm Status | Dependent on battery manufacturer | -| esm-timestamp | DateTime | R | Esm Time Stamp When Message was Published| Time stamp when message was published | +| s3-id | String | R | S3 ID | Unique identifier of SSO-3 | +| s3-pv-voltage | Number:ElectricPotential | R | S3 Voltage on PV String Side | Measured on PV string side | +| s3-pv-current | Number:ElectricCurrent | R | S3 Current on PV String Side | Measured on PV string side | +| s3-total-solar-energy | Number:Energy | R | S3 Total Solar Energy | Total energy produced by SSO-3 | +| s3-relay-status | Contact | R | S3 Relay Status | 0 = relay closed (i.e running power), 1 = relay open/disconnected, 2 = precharge | +| s3-temperature | Number:Temperature | R | S3 Temperature on PCB | Temperature Measured on PCB | +| s3-fault-code | String | R | S3 FaultCode | 0x00 = OK. For all other values Please contact Ferroamp support | +| s3-dc-link-voltage | Number:ElectricPotential | R | S3 DC Link Voltage | DC link voltage as measured by SSO-3 | +| s3-timestamp | DateTime | R | S3 Time Stamp | Time stamp when message was published | + +| s4-id | String | R | S4 ID | Unique identifier of SSO-4 | +| s4-pv-voltage | Number:ElectricPotential | R | S4 Voltage on PV String Side | Measured on PV string side | +| s4-pv-current | Number:ElectricCurrent | R | S4 Current on PV String Side | Measured on PV string side | +| s4-total-solar-energy | Number:Energy | R | S4 Total Solar Energy | Total energy produced by SSO-4 | +| s4-relay-status | Contact | R | S4 Relay Status | 0 = relay closed (i.e running power), 1 = relay open/disconnected, 2 = precharge | +| s4-temperature | Number:Temperature | R | S4 Temperature on PCB | Temperature Measured on PCB | +| s4-fault-code | String | R | S4 FaultCode | 0x00 = OK. For all other values Please contact Ferroamp support | +| s4-dc-link-voltage | Number:ElectricPotential | R | S4 DC Link Voltage | DC link voltage as measured by SSO-4 | +| s4-timestamp | DateTime | R | S4 Time Stamp | Time stamp when message was published | + +| eso-id | String | R | Eso Unique Identifier | Unique identifier of ESO | +| eso-voltage-battery | Number:ElectricPotential | R | Eso Voltage on Battery Side | Measured on battery side | +| eso-current-battery | Number:ElectricCurrent | R | Eso Current on Battery Side | Measured on battery side | +| eso-battery-energy-produced | Number:Energy | R | Eso Battery Energy Produced | Total energy produced by ESO, i.e total energy charged | +| eso-battery-energy-consumed | Number:Energy | R | Eso Battery Energy Consumed | Total energy consumed by ESO, i.e total energy discharged | +| eso-soc | Number:Dimensionless | R | Eso State of Charge | State of Charge for ESO | +| eso-relay-status | Contact | R | Eso Relay Status | 0 = relay closed, 1 = relay open | +| eso-temperature | Number:Temperature | R | Eso Temperature on PCB | Measured inside ESO | +| eso-fault-code | String | R | Eso FaultCode | See section 4.1.3.1 in Ferroamp-External-API-specifikation | +| eso-battery-energy-produced | Number:Energy | R | Eso Battery Energy Produced | Total energy produced by ESO, i.e total energy charged | +| eso-dc-link-voltage | Number:ElectricPotential | R | Eso Dc Link Voltage | DC link voltage as measured by ESO | +| eso-timestamp | DateTime | R | Eso Time Stamp | Time stamp when message was published | + + +| esm-id | String | R | Esm Unique Identifier | Unique identifier of battery. If available, this will be the unique id that the battery reports | +| esm-soh | Number:Dimensionless | R | Esm System State of Health | State of Health for ESM | +| esm-soc | Number:Dimensionless | R | Esm System State of Charge | State of Charge for ESM | +| esm-total-capacity | Number:Energy | R | Esm Rated Capacity | Rated capacity of all batteries | +| esm-power-battery | Number:Power | R | Esm Rated Power of Battery | Rated power of battery | +| esm-status | String | R | Esm Status | Dependent on battery manufacturer | +| esm-timestamp | DateTime | R | Esm Time Stamp | Time stamp when message was published | The following channels are available for `Ferroamp` EnergyHub configuration. Please, see Ferroamp documentation for more details. -| Channel Type ID | Item Type | Read/Write | Description | -|---------------------------------------------------|------------|-------------------------------------------------------------------------| -| request-charge | String | W | Set charge power, value in Watt | -| request-discharge | String | W | Set discharge power, value in Watt | -| request-auto | String | W | Set auto power. Returning control of batteries to system, value as auto.| +| Channel Type ID | Item Type | Read/Write | Description | +|----------------------|----------------------------|------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| request-charge | String | W | Set charge power, value in Watt | +| request-discharge | String | W | Set discharge power, value in Watt | +| request-auto | String | W | Set auto power. Returning control of batteries to system, value as auto # Full Example @@ -222,7 +217,6 @@ Thing ferroamp:energyhub:myenergyhub [ hostName="energyhub-ip", userName="myUser ``` - ## `demo.items` Example ```java diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EhubJsonElements.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EhubJsonElements.java index d3cb78daf4fef..8e392991d4b13 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EhubJsonElements.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EhubJsonElements.java @@ -18,7 +18,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault; /** - * The {@link EhubParameters} is responsible for all parameters regarded to EHUB + * The {@link EhubParameters1} is responsible for all parameters regarded to EHUB * * @author Örjan Backsell - Initial contribution * diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EsmJsonElements.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EsmJsonElements.java index 699c3a1d8c8f2..f74da39f04368 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EsmJsonElements.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EsmJsonElements.java @@ -19,7 +19,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault; /** - * The {@link EhubParameters} is responsible for all parameters regarded to EHUB + * The {@link EhubParameters1} is responsible for all parameters regarded to EHUB * * @author Örjan Backsell - Initial contribution * diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EsoJsonElements.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EsoJsonElements.java index 6468f8bc7c831..d08d038c61655 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EsoJsonElements.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/EsoJsonElements.java @@ -18,7 +18,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault; /** - * The {@link EhubParameters} is responsible for all parameters regarded to EHUB + * The {@link EhubParameters1} is responsible for all parameters regarded to EHUB * * @author Örjan Backsell - Initial contribution * diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampBindingConstants.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampBindingConstants.java index cbfe21e041eba..9e84f3b99e912 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampBindingConstants.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampBindingConstants.java @@ -53,33 +53,33 @@ public class FerroampBindingConstants { public static final String CHANNEL_ACECURRENTL1 = "ace-current-l1"; public static final String CHANNEL_ACECURRENTL2 = "ace-current-l2"; public static final String CHANNEL_ACECURRENTL3 = "ace-current-l3"; - public static final String CHANNEL_EXTERNALVOLTAGEL1 = "external-voltage-l1"; - public static final String CHANNEL_EXTERNALVOLTAGEL2 = "external-voltage-l2"; - public static final String CHANNEL_EXTERNALVOLTAGEL3 = "external-voltage-l3"; + public static final String CHANNEL_GRIDVOLTAGEL1 = "grid-voltage-l1"; + public static final String CHANNEL_GRIDVOLTAGEL2 = "grid-voltage-l2"; + public static final String CHANNEL_GRIDVOLTAGEL3 = "grid-voltage-l3"; public static final String CHANNEL_INVERTERRMSCURRENTL1 = "inverter-rms-current-l1"; public static final String CHANNEL_INVERTERRMSCURRENTL2 = "inverter-rms-current-l2"; public static final String CHANNEL_INVERTERRMSCURRENTL3 = "inverter-rms-current-l3"; - public static final String CHANNEL_INVERTERCURRENTREACTIVEL1 = "inverter-current-reactive-l1"; - public static final String CHANNEL_INVERTERCURRENTREACTIVEL2 = "inverter-current-reactive-l2"; - public static final String CHANNEL_INVERTERCURRENTREACTIVEL3 = "inverter-current-reactive-l3"; - public static final String CHANNEL_INVERTERCURRENTACTIVEL1 = "inverter-current-active-l1"; - public static final String CHANNEL_INVERTERCURRENTACTIVEL2 = "inverter-current-active-l2"; - public static final String CHANNEL_INVERTERCURRENTACTIVEL3 = "inverter-current-active-l3"; - public static final String CHANNEL_GRIDCURRENTL1 = "grid-current-l1"; - public static final String CHANNEL_GRIDCURRENTL2 = "grid-current-l2"; - public static final String CHANNEL_GRIDCURRENTL3 = "grid-current-l3"; - public static final String CHANNEL_GRIDCURRENTREACTIVEL1 = "grid-current-reactive-l1"; - public static final String CHANNEL_GRIDCURRENTREACTIVEL2 = "grid-current-reactive-l2"; - public static final String CHANNEL_GRIDCURRENTREACTIVEL3 = "grid-current-reactive-l3"; - public static final String CHANNEL_GRIDCURRENTACTIVEL1 = "grid-current-active-l1"; - public static final String CHANNEL_GRIDCURRENTACTIVEL2 = "grid-current-active-l2"; - public static final String CHANNEL_GRIDCURRENTACTIVEL3 = "grid-current-active-l3"; public static final String CHANNEL_INVERTERREACTIVECURRENTL1 = "inverter-reactive-current-l1"; public static final String CHANNEL_INVERTERREACTIVECURRENTL2 = "inverter-reactive-current-l2"; public static final String CHANNEL_INVERTERREACTIVECURRENTL3 = "inverter-reactive-current-l3"; - public static final String CHANNEL_INVERTERLOADL1 = "inverter-load-l1"; - public static final String CHANNEL_INVERTERLOADL2 = "inverter-load-l2"; - public static final String CHANNEL_INVERTERLOADL3 = "inverter-load-l3"; + public static final String CHANNEL_INVERTERACTIVECURRENTL1 = "inverter-active-current-l1"; + public static final String CHANNEL_INVERTERACTIVECURRENTL2 = "inverter-active-current-l2"; + public static final String CHANNEL_INVERTERACTIVECURRENTL3 = "inverter-active-current-l3"; + public static final String CHANNEL_GRIDCURRENTL1 = "grid-current-l1"; + public static final String CHANNEL_GRIDCURRENTL2 = "grid-current-l2"; + public static final String CHANNEL_GRIDCURRENTL3 = "grid-current-l3"; + public static final String CHANNEL_GRIDREACTIVECURRENTL1 = "grid-reactive-current-l1"; + public static final String CHANNEL_GRIDREACTIVECURRENTL2 = "grid-reactive-current-l2"; + public static final String CHANNEL_GRIDREACTIVECURRENTL3 = "grid-reactive-current-l3"; + public static final String CHANNEL_GRIDACTIVECURRENTL1 = "grid-active-current-l1"; + public static final String CHANNEL_GRIDACTIVECURRENTL2 = "grid-active-current-l2"; + public static final String CHANNEL_GRIDACTIVECURRENTL3 = "grid-active-current-l3"; + public static final String CHANNEL_INVERTERLOADREACTIVECURRENTL1 = "inverter-load-reactive-current-l1"; + public static final String CHANNEL_INVERTERLOADREACTIVECURRENTL2 = "inverter-load-reactive-current-l2"; + public static final String CHANNEL_INVERTERLOADREACTIVECURRENTL3 = "inverter-load-reactive-current-l3"; + public static final String CHANNEL_INVERTERLOADACTIVECURRENTL1 = "inverter-load-active-current-l1"; + public static final String CHANNEL_INVERTERLOADACTIVECURRENTL2 = "inverter-load-active-current-l2"; + public static final String CHANNEL_INVERTERLOADACTIVECURRENTL3 = "inverter-load-active-current-l3"; public static final String CHANNEL_APPARENTPOWER = "apparent-power"; public static final String CHANNEL_GRIDPOWERACTIVEL1 = "grid-power-active-l1"; public static final String CHANNEL_GRIDPOWERACTIVEL2 = "grid-power-active-l2"; @@ -139,15 +139,6 @@ public class FerroampBindingConstants { public static final String CHANNEL_TOTALCAPACITYBATTERIES = "total-capacity-batteries"; // List of SSO Channel ids - public static final String CHANNEL_S0ID = "s0-id"; - public static final String CHANNEL_S0PVVOLTAGE = "s0-pv-voltage"; - public static final String CHANNEL_S0PVCURRENT = "s0-pv-current"; - public static final String CHANNEL_S0TOTALSOLARENERGY = "s0-total-solar-energy"; - public static final String CHANNEL_S0RELAYSTATUS = "s0-relay-status"; - public static final String CHANNEL_S0TEMPERATURE = "s0-temperature"; - public static final String CHANNEL_S0FAULTCODE = "s0-fault-code"; - public static final String CHANNEL_S0DCLINKVOLTAGE = "s0-dc-link-voltage"; - public static final String CHANNEL_S0TIMESTAMP = "s0-timestamp"; public static final String CHANNEL_S1ID = "s1-id"; public static final String CHANNEL_S1PVVOLTAGE = "s1-pv-voltage"; public static final String CHANNEL_S1PVCURRENT = "s1-pv-current"; @@ -175,6 +166,15 @@ public class FerroampBindingConstants { public static final String CHANNEL_S3FAULTCODE = "s3-fault-code"; public static final String CHANNEL_S3DCLINKVOLTAGE = "s3-dc-link-voltage"; public static final String CHANNEL_S3TIMESTAMP = "s3-timestamp"; + public static final String CHANNEL_S4ID = "s4-id"; + public static final String CHANNEL_S4PVVOLTAGE = "s4-pv-voltage"; + public static final String CHANNEL_S4PVCURRENT = "s4-pv-current"; + public static final String CHANNEL_S4TOTALSOLARENERGY = "s4-total-solar-energy"; + public static final String CHANNEL_S4RELAYSTATUS = "s4-relay-status"; + public static final String CHANNEL_S4TEMPERATURE = "s4-temperature"; + public static final String CHANNEL_S4FAULTCODE = "s4-fault-code"; + public static final String CHANNEL_S4DCLINKVOLTAGE = "s4-dc-link-voltage"; + public static final String CHANNEL_S4TIMESTAMP = "s4-timestamp"; // List of ESO Channel ids public static final String CHANNEL_ESOID = "eso-id"; @@ -202,7 +202,6 @@ public class FerroampBindingConstants { public static final String CHANNEL_REQUESTCHARGE = "request-charge"; public static final String CHANNEL_REQUESTDISCHARGE = "request-discharge"; public static final String CHANNEL_AUTO = "request-auto"; - public static final String CHANNEL_REQUESTEXTAPIVERSION = "request-extapi-version"; public static final Set SUPPORTED_THING_TYPES_UIDS = Set.of(THING_TYPE_ENERGYHUB); } diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampChannelConfiguration.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampChannelConfiguration.java index df98b94a87fec..a139e4c8f2f83 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampChannelConfiguration.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampChannelConfiguration.java @@ -48,11 +48,11 @@ public static List getChannelConfigurationEhub() { channelConfigurationEhub .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_ACECURRENTL3, Units.AMPERE)); channelConfigurationEhub - .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_EXTERNALVOLTAGEL1, Units.VOLT)); + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_GRIDVOLTAGEL1, Units.VOLT)); channelConfigurationEhub - .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_EXTERNALVOLTAGEL2, Units.VOLT)); + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_GRIDVOLTAGEL2, Units.VOLT)); channelConfigurationEhub - .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_EXTERNALVOLTAGEL3, Units.VOLT)); + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_GRIDVOLTAGEL3, Units.VOLT)); channelConfigurationEhub.add( new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_INVERTERRMSCURRENTL1, Units.AMPERE)); channelConfigurationEhub.add( @@ -60,17 +60,17 @@ public static List getChannelConfigurationEhub() { channelConfigurationEhub.add( new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_INVERTERRMSCURRENTL3, Units.AMPERE)); channelConfigurationEhub.add(new FerroampChannelConfiguration( - FerroampBindingConstants.CHANNEL_INVERTERCURRENTREACTIVEL1, Units.AMPERE)); + FerroampBindingConstants.CHANNEL_INVERTERREACTIVECURRENTL1, Units.AMPERE)); channelConfigurationEhub.add(new FerroampChannelConfiguration( - FerroampBindingConstants.CHANNEL_INVERTERCURRENTREACTIVEL2, Units.AMPERE)); + FerroampBindingConstants.CHANNEL_INVERTERREACTIVECURRENTL2, Units.AMPERE)); channelConfigurationEhub.add(new FerroampChannelConfiguration( - FerroampBindingConstants.CHANNEL_INVERTERCURRENTREACTIVEL3, Units.AMPERE)); + FerroampBindingConstants.CHANNEL_INVERTERREACTIVECURRENTL3, Units.AMPERE)); channelConfigurationEhub.add(new FerroampChannelConfiguration( - FerroampBindingConstants.CHANNEL_INVERTERCURRENTACTIVEL1, Units.AMPERE)); + FerroampBindingConstants.CHANNEL_INVERTERACTIVECURRENTL1, Units.AMPERE)); channelConfigurationEhub.add(new FerroampChannelConfiguration( - FerroampBindingConstants.CHANNEL_INVERTERCURRENTACTIVEL2, Units.AMPERE)); + FerroampBindingConstants.CHANNEL_INVERTERACTIVECURRENTL2, Units.AMPERE)); channelConfigurationEhub.add(new FerroampChannelConfiguration( - FerroampBindingConstants.CHANNEL_INVERTERCURRENTACTIVEL3, Units.AMPERE)); + FerroampBindingConstants.CHANNEL_INVERTERACTIVECURRENTL3, Units.AMPERE)); channelConfigurationEhub .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_GRIDCURRENTL1, Units.AMPERE)); channelConfigurationEhub @@ -78,29 +78,29 @@ public static List getChannelConfigurationEhub() { channelConfigurationEhub .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_GRIDCURRENTL3, Units.AMPERE)); channelConfigurationEhub.add( - new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_GRIDCURRENTREACTIVEL1, Units.AMPERE)); + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_GRIDREACTIVECURRENTL1, Units.AMPERE)); channelConfigurationEhub.add( - new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_GRIDCURRENTREACTIVEL2, Units.AMPERE)); + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_GRIDREACTIVECURRENTL2, Units.AMPERE)); channelConfigurationEhub.add( - new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_GRIDCURRENTREACTIVEL3, Units.AMPERE)); + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_GRIDREACTIVECURRENTL3, Units.AMPERE)); channelConfigurationEhub.add( - new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_GRIDCURRENTACTIVEL1, Units.AMPERE)); + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_GRIDACTIVECURRENTL1, Units.AMPERE)); channelConfigurationEhub.add( - new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_GRIDCURRENTACTIVEL2, Units.AMPERE)); + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_GRIDACTIVECURRENTL2, Units.AMPERE)); channelConfigurationEhub.add( - new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_GRIDCURRENTACTIVEL3, Units.AMPERE)); + new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_GRIDACTIVECURRENTL3, Units.AMPERE)); channelConfigurationEhub.add(new FerroampChannelConfiguration( - FerroampBindingConstants.CHANNEL_INVERTERREACTIVECURRENTL1, Units.AMPERE)); + FerroampBindingConstants.CHANNEL_INVERTERLOADREACTIVECURRENTL1, Units.AMPERE)); channelConfigurationEhub.add(new FerroampChannelConfiguration( - FerroampBindingConstants.CHANNEL_INVERTERREACTIVECURRENTL2, Units.AMPERE)); + FerroampBindingConstants.CHANNEL_INVERTERLOADREACTIVECURRENTL2, Units.AMPERE)); channelConfigurationEhub.add(new FerroampChannelConfiguration( - FerroampBindingConstants.CHANNEL_INVERTERREACTIVECURRENTL3, Units.AMPERE)); - channelConfigurationEhub - .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_INVERTERLOADL1, Units.AMPERE)); - channelConfigurationEhub - .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_INVERTERLOADL2, Units.AMPERE)); - channelConfigurationEhub - .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_INVERTERLOADL3, Units.AMPERE)); + FerroampBindingConstants.CHANNEL_INVERTERLOADREACTIVECURRENTL3, Units.AMPERE)); + channelConfigurationEhub.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_INVERTERLOADACTIVECURRENTL1, Units.AMPERE)); + channelConfigurationEhub.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_INVERTERLOADACTIVECURRENTL2, Units.AMPERE)); + channelConfigurationEhub.add(new FerroampChannelConfiguration( + FerroampBindingConstants.CHANNEL_INVERTERLOADACTIVECURRENTL3, Units.AMPERE)); channelConfigurationEhub.add( new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_APPARENTPOWER, Units.VOLT_AMPERE)); channelConfigurationEhub.add( @@ -214,29 +214,6 @@ public static List getChannelConfigurationEhub() { return channelConfigurationEhub; } - public static List getChannelConfigurationSsoS0() { - final List channelConfigurationSsoS0 = new ArrayList<>(); - channelConfigurationSsoS0 - .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S0ID, Units.ONE)); - channelConfigurationSsoS0 - .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S0PVVOLTAGE, Units.VOLT)); - channelConfigurationSsoS0 - .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S0PVCURRENT, Units.AMPERE)); - channelConfigurationSsoS0 - .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S0TOTALSOLARENERGY, Units.WATT)); - channelConfigurationSsoS0 - .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S0RELAYSTATUS, Units.ONE)); - channelConfigurationSsoS0 - .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S0TEMPERATURE, Units.ONE)); - channelConfigurationSsoS0 - .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S0FAULTCODE, Units.ONE)); - channelConfigurationSsoS0 - .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S0DCLINKVOLTAGE, Units.VOLT)); - channelConfigurationSsoS0 - .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S0TIMESTAMP, Units.ONE)); - return channelConfigurationSsoS0; - } - public static List getChannelConfigurationSsoS1() { final List channelConfigurationSsoS1 = new ArrayList<>(); channelConfigurationSsoS1 @@ -306,6 +283,29 @@ public static List getChannelConfigurationSsoS3() return channelConfigurationSsoS3; } + public static List getChannelConfigurationSsoS4() { + final List channelConfigurationSsoS4 = new ArrayList<>(); + channelConfigurationSsoS4 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S4ID, Units.ONE)); + channelConfigurationSsoS4 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S4PVVOLTAGE, Units.VOLT)); + channelConfigurationSsoS4 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S4PVCURRENT, Units.AMPERE)); + channelConfigurationSsoS4 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S4TOTALSOLARENERGY, Units.WATT)); + channelConfigurationSsoS4 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S4RELAYSTATUS, Units.ONE)); + channelConfigurationSsoS4 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S4TEMPERATURE, Units.ONE)); + channelConfigurationSsoS4 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S4FAULTCODE, Units.ONE)); + channelConfigurationSsoS4 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S4DCLINKVOLTAGE, Units.VOLT)); + channelConfigurationSsoS4 + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_S4TIMESTAMP, Units.ONE)); + return channelConfigurationSsoS4; + } + public static List getChannelConfigurationEso() { final List channelConfigurationEso = new ArrayList<>(); channelConfigurationEso @@ -360,8 +360,6 @@ public static List getChannelConfigurationRequest( .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_REQUESTDISCHARGE, Units.ONE)); channelConfigurationRequest .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_AUTO, Units.ONE)); - channelConfigurationRequest.add( - new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_REQUESTEXTAPIVERSION, Units.ONE)); return channelConfigurationRequest; } } diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampConfiguration.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampConfiguration.java index ccc15d1d3dc46..878afe3df510b 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampConfiguration.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampConfiguration.java @@ -27,10 +27,6 @@ public class FerroampConfiguration { public String userName = ""; public String password = ""; public boolean hasBattery; - public boolean ssoS0; - public boolean ssoS1; - public boolean ssoS2; - public boolean ssoS3; public boolean eso; public boolean esm; } diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java index 753e543965063..8be70518dcb3f 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java @@ -41,16 +41,15 @@ @NonNullByDefault public class FerroampHandler extends BaseThingHandler implements MqttMessageSubscriber { private final static Logger logger = LoggerFactory.getLogger(FerroampHandler.class); - - private static @Nullable FerroampConfiguration ferroampConfig; private @Nullable static MqttBrokerConnection ferroampConnection; FerroampMqttCommunication ferroampMqttCommunication = new FerroampMqttCommunication(thing); + final FerroampConfiguration ferroampConfig = getConfigAs(FerroampConfiguration.class); private List channelConfigEhub = new ArrayList<>(); - private static List channelConfigSsoS0 = new ArrayList<>(); private static List channelConfigSsoS1 = new ArrayList<>(); private static List channelConfigSsoS2 = new ArrayList<>(); private static List channelConfigSsoS3 = new ArrayList<>(); + private static List channelConfigSsoS4 = new ArrayList<>(); private static List channelConfigEso = new ArrayList<>(); private static List channelConfigEsm = new ArrayList<>(); @@ -66,79 +65,64 @@ public FerroampHandler(Thing thing) { public void handleCommand(ChannelUID channelUID, Command command) { String transId = UUID.randomUUID().toString(); String valueConfiguration = command.toString(); - if (FerroampBindingConstants.CHANNEL_REQUESTCHARGE.equals(channelUID.getId())) { String requestCmdJsonCharge = "{\"" + "transId" + "\":\"" + transId + "\",\"cmd\":{\"name\":\"charge\",\"arg\":\"" + valueConfiguration + "\"}}"; - sendMQTT(requestCmdJsonCharge); + FerroampMqttCommunication.sendMQTT(requestCmdJsonCharge, ferroampConfig); } if (FerroampBindingConstants.CHANNEL_REQUESTDISCHARGE.equals(channelUID.getId())) { String requestCmdJsonDisCharge = "{\"" + "transId" + "\":\"" + transId + "\",\"cmd\":{\"name\":\"discharge\",\"arg\":\"" + valueConfiguration + "\"}}"; - sendMQTT(requestCmdJsonDisCharge); + FerroampMqttCommunication.sendMQTT(requestCmdJsonDisCharge, ferroampConfig); } if (FerroampBindingConstants.CHANNEL_AUTO.equals(channelUID.getId())) { String requestCmdJsonAuto = "{\"" + "transId" + "\":\"" + transId + "\",\"cmd\":{\"name\":\"auto\"}}"; - sendMQTT(requestCmdJsonAuto); + FerroampMqttCommunication.sendMQTT(requestCmdJsonAuto, ferroampConfig); } } - @SuppressWarnings("null") @Override public void initialize() { // Set channel configuration parameters channelConfigEhub = FerroampChannelConfiguration.getChannelConfigurationEhub(); - channelConfigSsoS0 = FerroampChannelConfiguration.getChannelConfigurationSsoS0(); channelConfigSsoS1 = FerroampChannelConfiguration.getChannelConfigurationSsoS1(); channelConfigSsoS2 = FerroampChannelConfiguration.getChannelConfigurationSsoS2(); channelConfigSsoS3 = FerroampChannelConfiguration.getChannelConfigurationSsoS3(); + channelConfigSsoS4 = FerroampChannelConfiguration.getChannelConfigurationSsoS4(); channelConfigEso = FerroampChannelConfiguration.getChannelConfigurationEso(); channelConfigEsm = FerroampChannelConfiguration.getChannelConfigurationEsm(); - ferroampConfig = getConfigAs(FerroampConfiguration.class); - - @SuppressWarnings("null") final MqttBrokerConnection ferroampConnection = new MqttBrokerConnection(ferroampConfig.hostName, FerroampBindingConstants.BROKER_PORT, false, false, ferroampConfig.userName); - updateStatus(ThingStatus.UNKNOWN); - scheduler.execute(() -> { - boolean thingReachable = true; - - if (thingReachable) { - updateStatus(ThingStatus.ONLINE); - try { - startMqttConnection(); - } catch (InterruptedException e) { - logger.debug("Connection to MqttBroker disturbed during configuration"); - } - } else { - updateStatus(ThingStatus.OFFLINE); - thingReachable = false; + try { + startMqttConnection(); + } catch (InterruptedException e) { + logger.debug("Faulty startMqttConnection()"); } }); - // Start channel-update as configured - scheduler.scheduleWithFixedDelay(() -> { - if (getFerroampConnection().connectionState().toString().equals("DISCONNECTED")) { - updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR); - logger.debug("Problem connection to MqttBroker"); - } else { - try { - channelUpdate(); - updateStatus(ThingStatus.ONLINE); - } catch (RuntimeException scheduleWithFixedDelayException) { - updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, - scheduleWithFixedDelayException.getClass().getName() + ":" - + scheduleWithFixedDelayException.getMessage()); - } - } - }, 60, refreshInterval, TimeUnit.SECONDS); - + scheduler.scheduleWithFixedDelay(this::pollTask, 60, refreshInterval, TimeUnit.SECONDS); this.setFerroampConnection(ferroampConnection); } + private void pollTask() { + if (getFerroampConnection().connectionState().toString().equals("DISCONNECTED")) { + updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR); + logger.debug("Problem connection to MqttBroker"); + } else { + try { + channelUpdate(); + updateStatus(ThingStatus.ONLINE); + } catch (RuntimeException scheduleWithFixedDelayException) { + updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, + scheduleWithFixedDelayException.getClass().getName() + ":" + + scheduleWithFixedDelayException.getMessage()); + } + } + } + private void startMqttConnection() throws InterruptedException { try { TimeUnit.SECONDS.sleep(10); @@ -151,7 +135,6 @@ private void startMqttConnection() throws InterruptedException { ferroampMqttCommunication.getMQTT("esmTopic", ferroampConfig); } - @SuppressWarnings("null") private void channelUpdate() { String[] ehubUpdateChannels; ehubUpdateChannels = FerroampMqttCommunication.getEhubChannelUpdateValues(); @@ -163,59 +146,51 @@ private void channelUpdate() { channelValuesCounterEhub++; } - if (ferroampConfig.ssoS0 == true) { - String[] ssoS0UpdateChannels = new String[9]; - ssoS0UpdateChannels = FerroampMqttCommunication.getSsoS0ChannelUpdateValues(); - int channelValuesCounterSsoS0 = 0; - if (ssoS0UpdateChannels.length <= 9) { - for (FerroampChannelConfiguration cConfig : channelConfigSsoS0) { - String ssoS0Channel = cConfig.id; - State ssoS0State = StringType.valueOf(ssoS0UpdateChannels[channelValuesCounterSsoS0]); - updateState(ssoS0Channel, ssoS0State); - channelValuesCounterSsoS0++; - } + String[] ssoS1UpdateChannels = new String[9]; + ssoS1UpdateChannels = FerroampMqttCommunication.getSsoS1ChannelUpdateValues(); + int channelValuesCounterSsoS1 = 0; + if (ssoS1UpdateChannels.length <= 9) { + for (FerroampChannelConfiguration cConfig : channelConfigSsoS1) { + String ssoS1Channel = cConfig.id; + State ssoS1State = StringType.valueOf(ssoS1UpdateChannels[channelValuesCounterSsoS1]); + updateState(ssoS1Channel, ssoS1State); + channelValuesCounterSsoS1++; } } - if (ferroampConfig.ssoS1 == true) { - String[] ssoS1UpdateChannels = new String[9]; - ssoS1UpdateChannels = FerroampMqttCommunication.getSsoS1ChannelUpdateValues(); - int channelValuesCounterSsoS1 = 0; - if (ssoS1UpdateChannels.length <= 9) { - for (FerroampChannelConfiguration cConfig : channelConfigSsoS1) { - String ssoS1Channel = cConfig.id; - State ssoS1State = StringType.valueOf(ssoS1UpdateChannels[channelValuesCounterSsoS1]); - updateState(ssoS1Channel, ssoS1State); - channelValuesCounterSsoS1++; - } + String[] ssoS2UpdateChannels = new String[9]; + ssoS2UpdateChannels = FerroampMqttCommunication.getSsoS2ChannelUpdateValues(); + int channelValuesCounterSsoS2 = 0; + if (ssoS2UpdateChannels.length <= 9) { + for (FerroampChannelConfiguration cConfig : channelConfigSsoS2) { + String ssoS2Channel = cConfig.id; + State ssoS2State = StringType.valueOf(ssoS2UpdateChannels[channelValuesCounterSsoS2]); + updateState(ssoS2Channel, ssoS2State); + channelValuesCounterSsoS2++; } } - if (ferroampConfig.ssoS2 == true) { - String[] ssoS2UpdateChannels = new String[9]; - ssoS2UpdateChannels = FerroampMqttCommunication.getSsoS2ChannelUpdateValues(); - int channelValuesCounterSsoS2 = 0; - if (ssoS2UpdateChannels.length <= 9) { - for (FerroampChannelConfiguration cConfig : channelConfigSsoS2) { - String ssoS2Channel = cConfig.id; - State ssoS2State = StringType.valueOf(ssoS2UpdateChannels[channelValuesCounterSsoS2]); - updateState(ssoS2Channel, ssoS2State); - channelValuesCounterSsoS2++; - } + String[] ssoS3UpdateChannels = new String[9]; + ssoS3UpdateChannels = FerroampMqttCommunication.getSsoS3ChannelUpdateValues(); + int channelValuesCounterSsoS3 = 0; + if (ssoS3UpdateChannels.length <= 9) { + for (FerroampChannelConfiguration cConfig : channelConfigSsoS3) { + String ssoS3Channel = cConfig.id; + State ssoS3State = StringType.valueOf(ssoS3UpdateChannels[channelValuesCounterSsoS3]); + updateState(ssoS3Channel, ssoS3State); + channelValuesCounterSsoS3++; } } - if (ferroampConfig.ssoS3 == true) { - String[] ssoS3UpdateChannels = new String[9]; - ssoS3UpdateChannels = FerroampMqttCommunication.getSsoS3ChannelUpdateValues(); - int channelValuesCounterSsoS3 = 0; - if (ssoS3UpdateChannels.length <= 9) { - for (FerroampChannelConfiguration cConfig : channelConfigSsoS3) { - String ssoS3Channel = cConfig.id; - State ssoS3State = StringType.valueOf(ssoS3UpdateChannels[channelValuesCounterSsoS3]); - updateState(ssoS3Channel, ssoS3State); - channelValuesCounterSsoS3++; - } + String[] ssoS4UpdateChannels = new String[9]; + ssoS4UpdateChannels = FerroampMqttCommunication.getSsoS4ChannelUpdateValues(); + int channelValuesCounterSsoS4 = 0; + if (ssoS4UpdateChannels.length <= 9) { + for (FerroampChannelConfiguration cConfig : channelConfigSsoS4) { + String ssoS4Channel = cConfig.id; + State ssoS4State = StringType.valueOf(ssoS4UpdateChannels[channelValuesCounterSsoS4]); + updateState(ssoS4Channel, ssoS4State); + channelValuesCounterSsoS4++; } } @@ -244,18 +219,6 @@ private void channelUpdate() { } } - // Handles request topic - @SuppressWarnings("null") - private void sendMQTT(String payload) { - MqttBrokerConnection localConfigurationConnection = getFerroampConnection(); - localConfigurationConnection.start(); - localConfigurationConnection.setCredentials(ferroampConfig.userName, ferroampConfig.password); - - if (localConfigurationConnection != null) { - localConfigurationConnection.publish(FerroampBindingConstants.REQUEST_TOPIC, payload.getBytes(), 1, false); - } - } - // Capture actual Json-topic message @Override public void processMessage(String topic, byte[] payload) { @@ -273,14 +236,4 @@ public void processMessage(String topic, byte[] payload) { public void setFerroampConnection(@Nullable MqttBrokerConnection ferroampConnection) { FerroampHandler.ferroampConnection = ferroampConnection; } - - @SuppressWarnings({ "null" }) - public static boolean gethasBattery() { - try { - return ferroampConfig.hasBattery; - } catch (Exception e) { - logger.debug("Failed at check of configuration-parameter, hasBattery"); - } - return ferroampConfig.hasBattery; - } } diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampMqttCommunication.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampMqttCommunication.java index 0134f470d273d..5c6acc0fb9316 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampMqttCommunication.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampMqttCommunication.java @@ -13,7 +13,6 @@ package org.openhab.binding.ferroamp.internal; import java.nio.charset.StandardCharsets; -import java.util.concurrent.TimeUnit; import org.eclipse.jdt.annotation.Nullable; import org.openhab.binding.ferroamp.dto.GetGeneralLx; @@ -37,22 +36,19 @@ public class FerroampMqttCommunication implements MqttMessageSubscriber { - private @Nullable FerroampConfiguration ferroampConfig; - private @Nullable static MqttBrokerConnection ferroampConnection; - static String[] ehubChannelsUpdateValues; - static String[] ssoS0ChannelsUpdateValues; static String[] ssoS1ChannelsUpdateValues; static String[] ssoS2ChannelsUpdateValues; static String[] ssoS3ChannelsUpdateValues; + static String[] ssoS4ChannelsUpdateValues; static String[] esoChannelsUpdateValues; static String[] esmChannelsUpdateValues; static boolean isSsoChecked = false; - static String ssoS0IdCheck = ""; static String ssoS1IdCheck = ""; static String ssoS2IdCheck = ""; static String ssoS3IdCheck = ""; + static String ssoS4IdCheck = ""; static boolean isEsoAvailable = false; static boolean isEsmAvailable = false; @@ -64,29 +60,20 @@ public FerroampMqttCommunication(Thing thing) { } // Handles request topic - @SuppressWarnings("null") - void sendMQTT(String payload) { - MqttBrokerConnection localConfigurationConnection = ferroampConnection; - if (FerroampHandler.getFerroampConnection() == null) { - try { - TimeUnit.SECONDS.sleep(10); - } catch (InterruptedException e) { - logger.debug("Failed during waiting for connection to setup"); - } - } + static void sendMQTT(String payload, FerroampConfiguration ferroampConfig) { + + MqttBrokerConnection localConfigurationConnection = FerroampHandler.getFerroampConnection(); localConfigurationConnection.start(); localConfigurationConnection.setCredentials(ferroampConfig.userName, ferroampConfig.password); - - if (localConfigurationConnection != null) { - localConfigurationConnection.publish(FerroampBindingConstants.REQUEST_TOPIC, payload.getBytes(), 1, false); - } + localConfigurationConnection.publish(FerroampBindingConstants.REQUEST_TOPIC, payload.getBytes(), 1, false); } // Handles respective topic type - @SuppressWarnings("null") - void getMQTT(String topic, FerroampConfiguration ferroampConfig) throws InterruptedException { + void getMQTT(String topic, FerroampConfiguration ferroampConfig) { + MqttBrokerConnection localSubscribeConnection = FerroampHandler.getFerroampConnection(); + localSubscribeConnection.start(); localSubscribeConnection.setCredentials(ferroampConfig.userName, ferroampConfig.password); @@ -121,12 +108,14 @@ public void processMessage(String topic, byte[] payload) { } } - @SuppressWarnings("null") + // @SuppressWarnings("null") // Prepare actual Json-topic Ehub-message and update values for channels void processIncomingJsonMessageEhub(String topic, String messageJsonEhub) { String[] ehubChannelPostsValue = new String[86]; // Array for EHUB (Energy Hub) Posts + JsonObject jsonElementsObject = new Gson().fromJson(new Gson().fromJson(messageJsonEhub, JsonObject.class), JsonObject.class); + String jsonElementsStringTemp = ""; Gson gson = new Gson(); @@ -352,41 +341,41 @@ void processIncomingJsonMessageEhub(String topic, String messageJsonEhub) { } // Prepare actual Json-topic Sso-messages and update values for channels - @SuppressWarnings("null") + // @SuppressWarnings("null") void processIncomingJsonMessageSso(String topic, String messageJsonSso) { - String[] ssoS0ChannelPostsValue = new String[9]; // Array for SSOS0 ( Solar String Optimizer ) Posts String[] ssoS1ChannelPostsValue = new String[9]; // Array for SSOS1 ( Solar String Optimizer ) Posts String[] ssoS2ChannelPostsValue = new String[9]; // Array for SSOS2 ( Solar String Optimizer ) Posts String[] ssoS3ChannelPostsValue = new String[9]; // Array for SSOS3 ( Solar String Optimizer ) Posts + String[] ssoS4ChannelPostsValue = new String[9]; // Array for SSOS4 ( Solar String Optimizer ) Posts - String jsonElementsStringTempS0 = ""; String jsonElementsStringTempS1 = ""; String jsonElementsStringTempS2 = ""; String jsonElementsStringTempS3 = ""; + String jsonElementsStringTempS4 = ""; Gson gson = new Gson(); - JsonObject jsonElementsObjectSsoS0 = new Gson().fromJson(new Gson().fromJson(messageJsonSso, JsonObject.class), + JsonObject jsonElementsObjectSsoS1 = new Gson().fromJson(new Gson().fromJson(messageJsonSso, JsonObject.class), JsonObject.class); - jsonElementsStringTempS0 = jsonElementsObjectSsoS0.get(SsoJsonElements.getJsonElementsSso().get(0)).toString(); - GetGeneralValues idS0 = gson.fromJson(jsonElementsStringTempS0, GetGeneralValues.class); - GetGeneralValues idSso = gson.fromJson(jsonElementsStringTempS0, GetGeneralValues.class); + jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(0)).toString(); + GetGeneralValues idS1 = gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class); + GetGeneralValues idSso = gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class); if (isSsoChecked == false) { - if (ssoS0IdCheck.isEmpty() && ssoS1IdCheck.isEmpty() && ssoS2IdCheck.isEmpty() && ssoS3IdCheck.isEmpty()) { - ssoS0IdCheck = idSso.getVal(); + if (ssoS1IdCheck.isEmpty() && ssoS2IdCheck.isEmpty() && ssoS3IdCheck.isEmpty() && ssoS4IdCheck.isEmpty()) { + ssoS1IdCheck = idSso.getVal(); } else { - if (!ssoS0IdCheck.isEmpty() && ssoS1IdCheck.isEmpty() && ssoS2IdCheck.isEmpty() - && ssoS3IdCheck.isEmpty()) { - ssoS1IdCheck = idSso.getVal(); + if (!ssoS1IdCheck.isEmpty() && ssoS2IdCheck.isEmpty() && ssoS3IdCheck.isEmpty() + && ssoS4IdCheck.isEmpty()) { + ssoS2IdCheck = idSso.getVal(); // isSsoChecked = true; } else { - if (!ssoS0IdCheck.isEmpty() && !ssoS1IdCheck.isEmpty() && ssoS2IdCheck.isEmpty() - && ssoS3IdCheck.isEmpty()) { - ssoS2IdCheck = idSso.getVal(); + if (!ssoS1IdCheck.isEmpty() && !ssoS2IdCheck.isEmpty() && ssoS3IdCheck.isEmpty() + && ssoS4IdCheck.isEmpty()) { + ssoS3IdCheck = idSso.getVal(); } else { - if (!ssoS0IdCheck.isEmpty() && !ssoS1IdCheck.isEmpty() && !ssoS2IdCheck.isEmpty() - && ssoS3IdCheck.isEmpty()) { - ssoS3IdCheck = idSso.getVal(); + if (!ssoS1IdCheck.isEmpty() && !ssoS2IdCheck.isEmpty() && !ssoS3IdCheck.isEmpty() + && ssoS4IdCheck.isEmpty()) { + ssoS4IdCheck = idSso.getVal(); isSsoChecked = true; } } @@ -394,69 +383,6 @@ void processIncomingJsonMessageSso(String topic, String messageJsonSso) { } } - if (idS0.getVal().equals(ssoS0IdCheck)) { - // id - jsonElementsStringTempS0 = jsonElementsObjectSsoS0.get(SsoJsonElements.getJsonElementsSso().get(0)) - .toString(); - idS0 = gson.fromJson(jsonElementsStringTempS0, GetGeneralValues.class); - ssoS0ChannelPostsValue[0] = idS0.getVal(); - - // upv - jsonElementsStringTempS0 = jsonElementsObjectSsoS0.get(SsoJsonElements.getJsonElementsSso().get(1)) - .toString(); - GetGeneralValues upvS0 = gson.fromJson(jsonElementsStringTempS0, GetGeneralValues.class); - ssoS0ChannelPostsValue[1] = upvS0.getVal(); - - // ipv - jsonElementsStringTempS0 = jsonElementsObjectSsoS0.get(SsoJsonElements.getJsonElementsSso().get(2)) - .toString(); - GetGeneralValues ipvS0 = gson.fromJson(jsonElementsStringTempS0, GetGeneralValues.class); - ssoS0ChannelPostsValue[2] = ipvS0.getVal(); - - // wpv - jsonElementsStringTempS0 = jsonElementsObjectSsoS0.get(SsoJsonElements.getJsonElementsSso().get(3)) - .toString(); - GetGeneralValues wpvS0 = gson.fromJson(jsonElementsStringTempS0, GetGeneralValues.class); - ssoS0ChannelPostsValue[3] = mJTokWh(jsonStripOneLiners(wpvS0.getVal())); - - // relaystatus - jsonElementsStringTempS0 = jsonElementsObjectSsoS0.get(SsoJsonElements.getJsonElementsSso().get(4)) - .toString(); - GetGeneralValues relaystatusS0 = gson.fromJson(jsonElementsStringTempS0, GetGeneralValues.class); - ssoS0ChannelPostsValue[4] = relaystatusS0.getVal(); - - // temp - jsonElementsStringTempS0 = jsonElementsObjectSsoS0.get(SsoJsonElements.getJsonElementsSso().get(5)) - .toString(); - GetGeneralValues tempS0 = gson.fromJson(jsonElementsStringTempS0, GetGeneralValues.class); - ssoS0ChannelPostsValue[5] = tempS0.getVal(); - - // faultcode - jsonElementsStringTempS0 = jsonElementsObjectSsoS0.get(SsoJsonElements.getJsonElementsSso().get(6)) - .toString(); - GetGeneralValues faultcodeS0 = gson.fromJson(jsonElementsStringTempS0, GetGeneralValues.class); - ssoS0ChannelPostsValue[6] = faultcodeS0.getVal(); - - // udc - jsonElementsStringTempS0 = jsonElementsObjectSsoS0.get(SsoJsonElements.getJsonElementsSso().get(7)) - .toString(); - GetGeneralValues udcS0 = gson.fromJson(jsonElementsStringTempS0, GetGeneralValues.class); - ssoS0ChannelPostsValue[7] = udcS0.getVal(); - - // ts - jsonElementsStringTempS0 = jsonElementsObjectSsoS0.get(SsoJsonElements.getJsonElementsSso().get(8)) - .toString(); - GetGeneralValues tsS0 = gson.fromJson(jsonElementsStringTempS0, GetGeneralValues.class); - ssoS0ChannelPostsValue[8] = tsS0.getVal(); - - ssoS0ChannelsUpdateValues = ssoS0ChannelPostsValue; - } - - JsonObject jsonElementsObjectSsoS1 = new Gson().fromJson(new Gson().fromJson(messageJsonSso, JsonObject.class), - JsonObject.class); - jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(0)).toString(); - GetGeneralValues idS1 = gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class); - if (idS1.getVal().equals(ssoS1IdCheck)) { // id jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(0)) @@ -503,8 +429,8 @@ void processIncomingJsonMessageSso(String topic, String messageJsonSso) { // udc jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(7)) .toString(); - GetGeneralValues udc = gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class); - ssoS1ChannelPostsValue[7] = udc.getVal(); + GetGeneralValues udcS1 = gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class); + ssoS1ChannelPostsValue[7] = udcS1.getVal(); // ts jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(8)) @@ -566,8 +492,8 @@ void processIncomingJsonMessageSso(String topic, String messageJsonSso) { // udc jsonElementsStringTempS2 = jsonElementsObjectSsoS2.get(SsoJsonElements.getJsonElementsSso().get(7)) .toString(); - GetGeneralValues udcS2 = gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class); - ssoS2ChannelPostsValue[7] = udcS2.getVal(); + GetGeneralValues udc = gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class); + ssoS2ChannelPostsValue[7] = udc.getVal(); // ts jsonElementsStringTempS2 = jsonElementsObjectSsoS2.get(SsoJsonElements.getJsonElementsSso().get(8)) @@ -623,8 +549,8 @@ void processIncomingJsonMessageSso(String topic, String messageJsonSso) { // faultcode jsonElementsStringTempS3 = jsonElementsObjectSsoS3.get(SsoJsonElements.getJsonElementsSso().get(6)) .toString(); - GetGeneralValues faultcode = gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class); - ssoS3ChannelPostsValue[6] = faultcode.getVal(); + GetGeneralValues faultcodeS3 = gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class); + ssoS3ChannelPostsValue[6] = faultcodeS3.getVal(); // udc jsonElementsStringTempS3 = jsonElementsObjectSsoS3.get(SsoJsonElements.getJsonElementsSso().get(7)) @@ -640,9 +566,72 @@ void processIncomingJsonMessageSso(String topic, String messageJsonSso) { ssoS3ChannelsUpdateValues = ssoS3ChannelPostsValue; } + + JsonObject jsonElementsObjectSsoS4 = new Gson().fromJson(new Gson().fromJson(messageJsonSso, JsonObject.class), + JsonObject.class); + jsonElementsStringTempS4 = jsonElementsObjectSsoS4.get(SsoJsonElements.getJsonElementsSso().get(0)).toString(); + GetGeneralValues idS4 = gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class); + + if (idS4.getVal().equals(ssoS4IdCheck)) { + // id + jsonElementsStringTempS4 = jsonElementsObjectSsoS4.get(SsoJsonElements.getJsonElementsSso().get(0)) + .toString(); + idS4 = gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class); + ssoS4ChannelPostsValue[0] = idS4.getVal(); + + // upv + jsonElementsStringTempS4 = jsonElementsObjectSsoS4.get(SsoJsonElements.getJsonElementsSso().get(1)) + .toString(); + GetGeneralValues upvS4 = gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class); + ssoS4ChannelPostsValue[1] = upvS4.getVal(); + + // ipv + jsonElementsStringTempS4 = jsonElementsObjectSsoS4.get(SsoJsonElements.getJsonElementsSso().get(2)) + .toString(); + GetGeneralValues ipvS4 = gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class); + ssoS4ChannelPostsValue[2] = ipvS4.getVal(); + + // wpv + jsonElementsStringTempS4 = jsonElementsObjectSsoS4.get(SsoJsonElements.getJsonElementsSso().get(3)) + .toString(); + GetGeneralValues wpvS4 = gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class); + ssoS4ChannelPostsValue[3] = mJTokWh(jsonStripOneLiners(wpvS4.getVal())); + + // relaystatus + jsonElementsStringTempS4 = jsonElementsObjectSsoS4.get(SsoJsonElements.getJsonElementsSso().get(4)) + .toString(); + GetGeneralValues relaystatusS4 = gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class); + ssoS4ChannelPostsValue[4] = relaystatusS4.getVal(); + + // temp + jsonElementsStringTempS4 = jsonElementsObjectSsoS4.get(SsoJsonElements.getJsonElementsSso().get(5)) + .toString(); + GetGeneralValues tempS4 = gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class); + ssoS4ChannelPostsValue[5] = tempS4.getVal(); + + // faultcode + jsonElementsStringTempS4 = jsonElementsObjectSsoS4.get(SsoJsonElements.getJsonElementsSso().get(6)) + .toString(); + GetGeneralValues faultcode = gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class); + ssoS4ChannelPostsValue[6] = faultcode.getVal(); + + // udc + jsonElementsStringTempS4 = jsonElementsObjectSsoS4.get(SsoJsonElements.getJsonElementsSso().get(7)) + .toString(); + GetGeneralValues udcS4 = gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class); + ssoS4ChannelPostsValue[7] = udcS4.getVal(); + + // ts + jsonElementsStringTempS4 = jsonElementsObjectSsoS4.get(SsoJsonElements.getJsonElementsSso().get(8)) + .toString(); + GetGeneralValues tsS4 = gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class); + ssoS4ChannelPostsValue[8] = tsS4.getVal(); + + ssoS4ChannelsUpdateValues = ssoS4ChannelPostsValue; + } } - @SuppressWarnings("null") + // @SuppressWarnings("null") // Prepare actual Json-topic Eso-message and update values for channels void processIncomingJsonMessageEso(String topic, String messageJsonEso) { String[] esoChannelPostsValue = new String[10]; // Array for ESO, Energy Storage Optimizer ) Posts @@ -704,7 +693,7 @@ void processIncomingJsonMessageEso(String topic, String messageJsonEso) { esoChannelsUpdateValues = esoChannelPostsValue; } - @SuppressWarnings("null") + // @SuppressWarnings("null") // Prepare actual Json-topic Esm-message and update values for channels void processIncomingJsonMessageEsm(String topic, String messageJsonEsm) { String[] esmChannelPostsValue = new String[7]; // Array for ESM, Energy Storage Module ) Posts @@ -760,15 +749,6 @@ void processIncomingJsonMessageEsm(String topic, String messageJsonEsm) { return ehubChannelsUpdateValues; } - public @Nullable static String[] getSsoS0ChannelUpdateValues() { - try { - return ssoS0ChannelsUpdateValues; - } catch (Exception e) { - logger.debug("Failed at update of SsoS0 channel values"); - } - return ssoS0ChannelsUpdateValues; - } - public @Nullable static String[] getSsoS1ChannelUpdateValues() { try { return ssoS1ChannelsUpdateValues; @@ -796,6 +776,15 @@ void processIncomingJsonMessageEsm(String topic, String messageJsonEsm) { return ssoS3ChannelsUpdateValues; } + public @Nullable static String[] getSsoS4ChannelUpdateValues() { + try { + return ssoS4ChannelsUpdateValues; + } catch (Exception e) { + logger.debug("Failed at update of SsoS4 channel values"); + } + return ssoS4ChannelsUpdateValues; + } + public @Nullable static String[] getEsoChannelUpdateValues() { try { return esoChannelsUpdateValues; diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/SsoJsonElements.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/SsoJsonElements.java index b6af865f37919..4c0365bf0a5aa 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/SsoJsonElements.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/SsoJsonElements.java @@ -18,7 +18,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault; /** - * The {@link EhubParameters} is responsible for all parameters regarded to EHUB + * The {@link EhubParameters1} is responsible for all parameters regarded to EHUB * * @author Örjan Backsell - Initial contribution * diff --git a/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/i18n/ferroamp.properties b/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/i18n/ferroamp.properties index 2044acd4bcc4f..c3d276e687f34 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/i18n/ferroamp.properties +++ b/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/i18n/ferroamp.properties @@ -5,7 +5,7 @@ addon.ferroamp.description = This is the binding for Ferroamp EnergyHub. # thing types -thing-type.ferroamp.energyhub.label = Ferroamp Binding Thing +thing-type.ferroamp.energyhub.label = EnergyHub thing-type.ferroamp.energyhub.description = Provides information from Ferroamp EnergyHub thing-type.ferroamp.energyhub.channel.ace-current-l1.label = ACE Current L1 thing-type.ferroamp.energyhub.channel.ace-current-l2.label = ACE Current L2 @@ -28,59 +28,59 @@ thing-type.ferroamp.energyhub.channel.esm-timestamp.label = Esm Time Stamp When thing-type.ferroamp.energyhub.channel.esm-total-capacity.label = Esm Rated Capacity thing-type.ferroamp.energyhub.channel.eso-battery-energy-consumed.label = Eso Battery Energy Consumed thing-type.ferroamp.energyhub.channel.eso-battery-energy-produced.label = Eso Battery Energy Produced -thing-type.ferroamp.energyhub.channel.eso-current-battery.label = Eso Current Measured on Battery Side +thing-type.ferroamp.energyhub.channel.eso-current-battery.label = Eso Current on Battery Side thing-type.ferroamp.energyhub.channel.eso-dc-link-voltage.label = Eso DC Link Voltage thing-type.ferroamp.energyhub.channel.eso-fault-code.label = Eso FaultCode thing-type.ferroamp.energyhub.channel.eso-id.label = Eso Unique Identifier thing-type.ferroamp.energyhub.channel.eso-relay-status.label = Eso RelayStatus thing-type.ferroamp.energyhub.channel.eso-soc.label = Eso State of Charge -thing-type.ferroamp.energyhub.channel.eso-temperature.label = ESO Temperature Measured on PCB +thing-type.ferroamp.energyhub.channel.eso-temperature.label = ESO Temperature on PCB thing-type.ferroamp.energyhub.channel.eso-timestamp.label = Eso Time Stamp When Message was Published -thing-type.ferroamp.energyhub.channel.eso-voltage-battery.label = Eso Voltage Measured on Battery Side -thing-type.ferroamp.energyhub.channel.external-voltage-l1.label = External Voltage L1 -thing-type.ferroamp.energyhub.channel.external-voltage-l2.label = External Voltage L2 -thing-type.ferroamp.energyhub.channel.external-voltage-l3.label = External Voltage L3 -thing-type.ferroamp.energyhub.channel.grid-current-active-l1.label = Grid Current Active L1 -thing-type.ferroamp.energyhub.channel.grid-current-active-l2.label = Grid Current Active L2 -thing-type.ferroamp.energyhub.channel.grid-current-active-l3.label = Grid Current Active L3 +thing-type.ferroamp.energyhub.channel.eso-voltage-battery.label = Eso Voltage on Battery Side +thing-type.ferroamp.energyhub.channel.grid-active-current-l1.label = Grid Active Current L1 +thing-type.ferroamp.energyhub.channel.grid-active-current-l2.label = Grid Active Current L2 +thing-type.ferroamp.energyhub.channel.grid-active-current-l3.label = Grid Active Current L3 thing-type.ferroamp.energyhub.channel.grid-current-l1.label = Grid Current L1 thing-type.ferroamp.energyhub.channel.grid-current-l2.label = Grid Current L2 thing-type.ferroamp.energyhub.channel.grid-current-l3.label = Grid Current L3 -thing-type.ferroamp.energyhub.channel.grid-current-reactive-l1.label = Grid Reactive Current L1 -thing-type.ferroamp.energyhub.channel.grid-current-reactive-l2.label = Grid Reactive Current L2 -thing-type.ferroamp.energyhub.channel.grid-current-reactive-l3.label = Grid Reactive Current L3 thing-type.ferroamp.energyhub.channel.grid-energy-consumed-l1.label = Grid Energy Consumed L1 thing-type.ferroamp.energyhub.channel.grid-energy-consumed-l2.label = Grid Energy Consumed L2 thing-type.ferroamp.energyhub.channel.grid-energy-consumed-l3.label = Grid Energy Consumed L3 -thing-type.ferroamp.energyhub.channel.grid-energy-consumed-total.label = Total Consumed Grid Energy +thing-type.ferroamp.energyhub.channel.grid-energy-consumed-total.label = Grid Energy Consumed Total thing-type.ferroamp.energyhub.channel.grid-energy-produced-l1.label = Grid Energy Produced L1 thing-type.ferroamp.energyhub.channel.grid-energy-produced-l2.label = Grid Energy Produced L2 thing-type.ferroamp.energyhub.channel.grid-energy-produced-l3.label = Grid Energy Produced L3 -thing-type.ferroamp.energyhub.channel.grid-energy-produced-total.label = Total Produced Grid Energy -thing-type.ferroamp.energyhub.channel.grid-frequency.label = Estimated Grid Frequency +thing-type.ferroamp.energyhub.channel.grid-energy-produced-total.label = Grid Energy Produced Total +thing-type.ferroamp.energyhub.channel.grid-frequency.label = Grid Frequency thing-type.ferroamp.energyhub.channel.grid-power-active-l1.label = Grid Power Active L1 thing-type.ferroamp.energyhub.channel.grid-power-active-l2.label = Grid Power Active L2 thing-type.ferroamp.energyhub.channel.grid-power-active-l3.label = Grid Power Active L3 thing-type.ferroamp.energyhub.channel.grid-power-reactive-l1.label = Grid Power Reactive L1 thing-type.ferroamp.energyhub.channel.grid-power-reactive-l2.label = Grid Power Reactive L2 thing-type.ferroamp.energyhub.channel.grid-power-reactive-l3.label = Grid Power Reactive L3 -thing-type.ferroamp.energyhub.channel.inverter-current-active-l1.label = Inverter Active Current L1 -thing-type.ferroamp.energyhub.channel.inverter-current-active-l2.label = Inverter Active Current L2 -thing-type.ferroamp.energyhub.channel.inverter-current-active-l3.label = Inverter Active Current L3 -thing-type.ferroamp.energyhub.channel.inverter-current-reactive-l1.label = Inverter Reactive Current L1 -thing-type.ferroamp.energyhub.channel.inverter-current-reactive-l2.label = Inverter Reactive Current L2 -thing-type.ferroamp.energyhub.channel.inverter-current-reactive-l3.label = Inverter Reactive Current L3 +thing-type.ferroamp.energyhub.channel.grid-reactive-current-l1.label = Grid Reactive Current L1 +thing-type.ferroamp.energyhub.channel.grid-reactive-current-l2.label = Grid Reactive Current L2 +thing-type.ferroamp.energyhub.channel.grid-reactive-current-l3.label = Grid Reactive Current L3 +thing-type.ferroamp.energyhub.channel.grid-voltage-l1.label = Grid Voltage L1 +thing-type.ferroamp.energyhub.channel.grid-voltage-l2.label = Grid Voltage L2 +thing-type.ferroamp.energyhub.channel.grid-voltage-l3.label = Grid Voltage L3 +thing-type.ferroamp.energyhub.channel.inverter-active-current-l1.label = Inverter Active Current L1 +thing-type.ferroamp.energyhub.channel.inverter-active-current-l2.label = Inverter Active Current L2 +thing-type.ferroamp.energyhub.channel.inverter-active-current-l3.label = Inverter Active Current L3 thing-type.ferroamp.energyhub.channel.inverter-energy-consumed-l1.label = Inverter Energy Consumed L1 thing-type.ferroamp.energyhub.channel.inverter-energy-consumed-l2.label = Inverter Energy Consumed L2 thing-type.ferroamp.energyhub.channel.inverter-energy-consumed-l3.label = Inverter Energy Consumed L3 -thing-type.ferroamp.energyhub.channel.inverter-energy-consumed-total.label = Total Consumed Inverter Energy +thing-type.ferroamp.energyhub.channel.inverter-energy-consumed-total.label = Inverter Energy Consumed Total thing-type.ferroamp.energyhub.channel.inverter-energy-produced-l1.label = Inverter Energy Produced L1 thing-type.ferroamp.energyhub.channel.inverter-energy-produced-l2.label = Inverter Energy Produced L2 thing-type.ferroamp.energyhub.channel.inverter-energy-produced-l3.label = Inverter Energy Produced L3 -thing-type.ferroamp.energyhub.channel.inverter-energy-produced-total.label = Total Produced Inverter Energy -thing-type.ferroamp.energyhub.channel.inverter-load-l1.label = Inverter Load L1 -thing-type.ferroamp.energyhub.channel.inverter-load-l2.label = Inverter Load L2 -thing-type.ferroamp.energyhub.channel.inverter-load-l3.label = Inverter Load L3 +thing-type.ferroamp.energyhub.channel.inverter-energy-produced-total.label = Inverter Energy Produced Total +thing-type.ferroamp.energyhub.channel.inverter-load-active-current-l1.label = Inverter Load Active Current L1 +thing-type.ferroamp.energyhub.channel.inverter-load-active-current-l2.label = Inverter Load Active Current L2 +thing-type.ferroamp.energyhub.channel.inverter-load-active-current-l3.label = Inverter Load Active Current L3 +thing-type.ferroamp.energyhub.channel.inverter-load-reactive-current-l1.label = Inverter Load Reactive Current L1 +thing-type.ferroamp.energyhub.channel.inverter-load-reactive-current-l2.label = Inverter Load Reactive Current L2 +thing-type.ferroamp.energyhub.channel.inverter-load-reactive-current-l3.label = Inverter Load Reactive Current L3 thing-type.ferroamp.energyhub.channel.inverter-power-active-l1.label = Inverter Power Active L1 thing-type.ferroamp.energyhub.channel.inverter-power-active-l2.label = Inverter Power Active L2 thing-type.ferroamp.energyhub.channel.inverter-power-active-l3.label = Inverter Power Active L3 @@ -96,54 +96,53 @@ thing-type.ferroamp.energyhub.channel.inverter-rms-current-l3.label = Inverter R thing-type.ferroamp.energyhub.channel.load-energy-consumed-l1.label = Load Energy Consumed L1 thing-type.ferroamp.energyhub.channel.load-energy-consumed-l2.label = Load Energy Consumed L2 thing-type.ferroamp.energyhub.channel.load-energy-consumed-l3.label = Load Energy Consumed L3 -thing-type.ferroamp.energyhub.channel.load-energy-consumed-total.label = Total Consumed Load Energy +thing-type.ferroamp.energyhub.channel.load-energy-consumed-total.label = Load Energy Consumed Total thing-type.ferroamp.energyhub.channel.load-energy-produced-l1.label = Load Energy Produced L1 thing-type.ferroamp.energyhub.channel.load-energy-produced-l2.label = Load Energy Produced L2 thing-type.ferroamp.energyhub.channel.load-energy-produced-l3.label = Load Energy Produced L3 -thing-type.ferroamp.energyhub.channel.load-energy-produced-total.label = Total Produced Load Energy +thing-type.ferroamp.energyhub.channel.load-energy-produced-total.label = Load Energy Produced Total thing-type.ferroamp.energyhub.channel.negative-dc-link-voltage.label = Negative DC Link Voltage thing-type.ferroamp.energyhub.channel.positive-dc-link-voltage.label = Positive DC Link Voltage thing-type.ferroamp.energyhub.channel.power-battery.label = Battery Power thing-type.ferroamp.energyhub.channel.request-auto.label = RequestAuto thing-type.ferroamp.energyhub.channel.request-charge.label = RequestCharge thing-type.ferroamp.energyhub.channel.request-discharge.label = RequestDischarge -thing-type.ferroamp.energyhub.channel.request-extapi-version.label = RequestExtapiVersion -thing-type.ferroamp.energyhub.channel.s0-dc-link-voltage.label = S0 DC Link Voltage -thing-type.ferroamp.energyhub.channel.s0-fault-code.label = S0 FaultCode -thing-type.ferroamp.energyhub.channel.s0-id.label = S0 ID -thing-type.ferroamp.energyhub.channel.s0-pv-current.label = S0 Measured Current on PV String Side -thing-type.ferroamp.energyhub.channel.s0-pv-voltage.label = S0 Measured Voltage on PV String Side -thing-type.ferroamp.energyhub.channel.s0-relay-status.label = S0 RelayStatus -thing-type.ferroamp.energyhub.channel.s0-temperature.label = S0 Temperature Measured on PCB -thing-type.ferroamp.energyhub.channel.s0-timestamp.label = S0 Time Stamp When Message was Published -thing-type.ferroamp.energyhub.channel.s0-total-solar-energy.label = S0 Total Solar Energy thing-type.ferroamp.energyhub.channel.s1-dc-link-voltage.label = S1 DC Link Voltage thing-type.ferroamp.energyhub.channel.s1-fault-code.label = S1 FaultCode thing-type.ferroamp.energyhub.channel.s1-id.label = S1 ID -thing-type.ferroamp.energyhub.channel.s1-pv-current.label = S1 Measured Current on PV String Side -thing-type.ferroamp.energyhub.channel.s1-pv-voltage.label = S1 Measured Voltage on PV String Side +thing-type.ferroamp.energyhub.channel.s1-pv-current.label = S1 Current on PV String Side +thing-type.ferroamp.energyhub.channel.s1-pv-voltage.label = S1 Voltage on PV String Side thing-type.ferroamp.energyhub.channel.s1-relay-status.label = S1 RelayStatus -thing-type.ferroamp.energyhub.channel.s1-temperature.label = S1 Temperature Measured on PCB +thing-type.ferroamp.energyhub.channel.s1-temperature.label = S1 Temperature on PCB thing-type.ferroamp.energyhub.channel.s1-timestamp.label = S1 Time Stamp When Message was Published thing-type.ferroamp.energyhub.channel.s1-total-solar-energy.label = S1 Total Solar Energy thing-type.ferroamp.energyhub.channel.s2-dc-link-voltage.label = S2 DC Link Voltage thing-type.ferroamp.energyhub.channel.s2-fault-code.label = S2 FaultCode thing-type.ferroamp.energyhub.channel.s2-id.label = S2 ID -thing-type.ferroamp.energyhub.channel.s2-pv-current.label = S2 Measured Current on PV String Side -thing-type.ferroamp.energyhub.channel.s2-pv-voltage.label = S2 Measured Voltage on PV String Side +thing-type.ferroamp.energyhub.channel.s2-pv-current.label = S2 Current on PV String Side +thing-type.ferroamp.energyhub.channel.s2-pv-voltage.label = S2 Voltage on PV String Side thing-type.ferroamp.energyhub.channel.s2-relay-status.label = S2 RelayStatus -thing-type.ferroamp.energyhub.channel.s2-temperature.label = S2 Temperature Measured on PCB +thing-type.ferroamp.energyhub.channel.s2-temperature.label = S2 Temperature on PCB thing-type.ferroamp.energyhub.channel.s2-timestamp.label = S2 Time Stamp When Message was Published thing-type.ferroamp.energyhub.channel.s2-total-solar-energy.label = S2 Total Solar Energy thing-type.ferroamp.energyhub.channel.s3-dc-link-voltage.label = S3 DC Link Voltage thing-type.ferroamp.energyhub.channel.s3-fault-code.label = S3 FaultCode thing-type.ferroamp.energyhub.channel.s3-id.label = S3 ID -thing-type.ferroamp.energyhub.channel.s3-pv-current.label = S3 Measured Current on PV String Side -thing-type.ferroamp.energyhub.channel.s3-pv-voltage.label = S3 Measured Voltage on PV String Side +thing-type.ferroamp.energyhub.channel.s3-pv-current.label = S3 Current on PV String Side +thing-type.ferroamp.energyhub.channel.s3-pv-voltage.label = S3 Voltage on PV String Side thing-type.ferroamp.energyhub.channel.s3-relay-status.label = S3 RelayStatus -thing-type.ferroamp.energyhub.channel.s3-temperature.label = S3 Temperature Measured on PCB +thing-type.ferroamp.energyhub.channel.s3-temperature.label = S3 Temperature on PCB thing-type.ferroamp.energyhub.channel.s3-timestamp.label = S3 Time Stamp When Message was Published thing-type.ferroamp.energyhub.channel.s3-total-solar-energy.label = S3 Total Solar Energy +thing-type.ferroamp.energyhub.channel.s4-dc-link-voltage.label = S4 DC Link Voltage +thing-type.ferroamp.energyhub.channel.s4-fault-code.label = S4 FaultCode +thing-type.ferroamp.energyhub.channel.s4-id.label = S4 ID +thing-type.ferroamp.energyhub.channel.s4-pv-current.label = S4 Current on PV String Side +thing-type.ferroamp.energyhub.channel.s4-pv-voltage.label = S4 Voltage on PV String Side +thing-type.ferroamp.energyhub.channel.s4-relay-status.label = S4 RelayStatus +thing-type.ferroamp.energyhub.channel.s4-temperature.label = S4 Temperature on PCB +thing-type.ferroamp.energyhub.channel.s4-timestamp.label = S4 Time Stamp When Message was Published +thing-type.ferroamp.energyhub.channel.s4-total-solar-energy.label = S4 Total Solar Energy thing-type.ferroamp.energyhub.channel.soc.label = System State of Charge thing-type.ferroamp.energyhub.channel.soh.label = System State of Health thing-type.ferroamp.energyhub.channel.solar-pv.label = Solar Power @@ -155,37 +154,28 @@ thing-type.ferroamp.energyhub.channel.total-solar-energy.label = Total Solar Ene # thing types config thing-type.config.ferroamp.energyhub.esm.label = ESM Module Available -thing-type.config.ferroamp.energyhub.esm.description = ESM Module Available +thing-type.config.ferroamp.energyhub.esm.description = Has the system an Esm unit connected? thing-type.config.ferroamp.energyhub.eso.label = ESO Module Available -thing-type.config.ferroamp.energyhub.eso.description = ESO Module Available -thing-type.config.ferroamp.energyhub.hasBattery.label = Battery Capable -thing-type.config.ferroamp.energyhub.hasBattery.description = Ehub type, with/without battery +thing-type.config.ferroamp.energyhub.eso.description = Has the system an Eso unit connected? +thing-type.config.ferroamp.energyhub.hasBattery.label = Battery Available +thing-type.config.ferroamp.energyhub.hasBattery.description = Has the system a battery connected? thing-type.config.ferroamp.energyhub.hostName.label = Hostname thing-type.config.ferroamp.energyhub.hostName.description = Hostname or IP address of the device thing-type.config.ferroamp.energyhub.password.label = Password thing-type.config.ferroamp.energyhub.password.description = Password to access the device -thing-type.config.ferroamp.energyhub.ssoS0.label = SSO String S0 Available -thing-type.config.ferroamp.energyhub.ssoS0.description = First SSO Unit Available -thing-type.config.ferroamp.energyhub.ssoS1.label = SSO String S1 Available -thing-type.config.ferroamp.energyhub.ssoS1.description = Second SSO Unit Available -thing-type.config.ferroamp.energyhub.ssoS2.label = SSO String S2 Available -thing-type.config.ferroamp.energyhub.ssoS2.description = Third SSO Unit Available -thing-type.config.ferroamp.energyhub.ssoS3.label = SSO String S3 Available -thing-type.config.ferroamp.energyhub.ssoS3.description = Fourth SSO Unit Available thing-type.config.ferroamp.energyhub.userName.label = Username thing-type.config.ferroamp.energyhub.userName.description = Username to access the device # channel types channel-type.ferroamp.date-time.label = Date Time -channel-type.ferroamp.dimensionless.label = Dimensionless +channel-type.ferroamp.date-time.state.pattern = %1$tc channel-type.ferroamp.electric-current.label = Electric Current channel-type.ferroamp.electric-potential.label = Electrical Potential channel-type.ferroamp.energy.label = Energy channel-type.ferroamp.frequency.label = Frequency +channel-type.ferroamp.percentage.label = Percentage channel-type.ferroamp.power.label = Power -channel-type.ferroamp.request-extapiversion.label = Request-ExtapiVersion -channel-type.ferroamp.request-extapiversion.description = Returns Extapi Version channel-type.ferroamp.request.label = String channel-type.ferroamp.request.description = Used for control of system channel-type.ferroamp.string.label = String @@ -193,6 +183,48 @@ channel-type.ferroamp.temperature.label = Temperature # thing types +thing-type.ferroamp.energyhub.channel.grid-current-active-l1.label = Grid Current Active L1 +thing-type.ferroamp.energyhub.channel.grid-current-active-l2.label = Grid Current Active L2 +thing-type.ferroamp.energyhub.channel.grid-current-active-l3.label = Grid Current Active L3 +thing-type.ferroamp.energyhub.channel.grid-current-reactive-l1.label = Grid Reactive Current L1 +thing-type.ferroamp.energyhub.channel.grid-current-reactive-l2.label = Grid Reactive Current L2 +thing-type.ferroamp.energyhub.channel.grid-current-reactive-l3.label = Grid Reactive Current L3 +thing-type.ferroamp.energyhub.channel.inverter-current-active-l1.label = Inverter Active Current L1 +thing-type.ferroamp.energyhub.channel.inverter-current-active-l2.label = Inverter Active Current L2 +thing-type.ferroamp.energyhub.channel.inverter-current-active-l3.label = Inverter Active Current L3 +thing-type.ferroamp.energyhub.channel.inverter-current-reactive-l1.label = Inverter Reactive Current L1 +thing-type.ferroamp.energyhub.channel.inverter-current-reactive-l2.label = Inverter Reactive Current L2 +thing-type.ferroamp.energyhub.channel.inverter-current-reactive-l3.label = Inverter Reactive Current L3 +thing-type.ferroamp.energyhub.channel.inverter-load-l1.label = Inverter Load L1 +thing-type.ferroamp.energyhub.channel.inverter-load-l2.label = Inverter Load L2 +thing-type.ferroamp.energyhub.channel.inverter-load-l3.label = Inverter Load L3 +thing-type.ferroamp.energyhub.channel.s0-dc-link-voltage.label = S0 DC Link Voltage +thing-type.ferroamp.energyhub.channel.s0-fault-code.label = S0 FaultCode +thing-type.ferroamp.energyhub.channel.s0-id.label = S0 ID +thing-type.ferroamp.energyhub.channel.s0-pv-current.label = S0 Measured Current on PV String Side +thing-type.ferroamp.energyhub.channel.s0-pv-voltage.label = S0 Measured Voltage on PV String Side +thing-type.ferroamp.energyhub.channel.s0-relay-status.label = S0 RelayStatus +thing-type.ferroamp.energyhub.channel.s0-temperature.label = S0 Temperature Measured on PCB +thing-type.ferroamp.energyhub.channel.s0-timestamp.label = S0 Time Stamp When Message was Published +thing-type.ferroamp.energyhub.channel.s0-total-solar-energy.label = S0 Total Solar Energy + +# thing types config + +thing-type.config.ferroamp.energyhub.ssoS0.label = SSO String S0 Available +thing-type.config.ferroamp.energyhub.ssoS0.description = First SSO Unit Available +thing-type.config.ferroamp.energyhub.ssoS1.label = SSO String S1 Available +thing-type.config.ferroamp.energyhub.ssoS1.description = Second SSO Unit Available +thing-type.config.ferroamp.energyhub.ssoS2.label = SSO String S2 Available +thing-type.config.ferroamp.energyhub.ssoS2.description = Third SSO Unit Available +thing-type.config.ferroamp.energyhub.ssoS3.label = SSO String S3 Available +thing-type.config.ferroamp.energyhub.ssoS3.description = Fourth SSO Unit Available + +# channel types + +channel-type.ferroamp.dimensionless.label = Dimensionless + +# thing types + thing-type.ferroamp.energyhub.channel.esm-rated-power-battery.label = Esm Rated Power of Battery thing-type.ferroamp.energyhub.channel.esm-total-rated-capacity-all-batteries.label = Esm Rated Capacity thing-type.ferroamp.energyhub.channel.esm-unique-identifier.label = Esm Unique Identifier diff --git a/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/thing-types.xml b/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/thing-types.xml index fd0729ce90af8..4524250bed09a 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/thing-types.xml +++ b/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/thing-types.xml @@ -5,12 +5,12 @@ xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd"> - + Provides information from Ferroamp EnergyHub - + @@ -21,14 +21,14 @@ - - + + - - + + - - + + @@ -39,22 +39,22 @@ - + - + - + - + - + - + @@ -66,41 +66,41 @@ - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + @@ -223,22 +223,22 @@ - + - + - + - + - + - + @@ -255,10 +255,10 @@ - + - + @@ -267,41 +267,14 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + @@ -310,7 +283,7 @@ - + @@ -325,10 +298,10 @@ - + - + @@ -337,7 +310,7 @@ - + @@ -352,10 +325,10 @@ - + - + @@ -364,7 +337,7 @@ - + @@ -375,14 +348,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + @@ -390,14 +390,14 @@ - + - + @@ -411,10 +411,10 @@ - + - + @@ -438,9 +438,6 @@ - - - @@ -460,33 +457,19 @@ Password to access the device - - Ehub type, with/without battery + + Has the system a battery connected? false - - - First SSO Unit Available - - - - Second SSO Unit Available - - - - Third SSO Unit Available - - - - Fourth SSO Unit Available - - ESO Module Available + Has the system an Eso unit connected? + false - ESM Module Available + Has the system an Esm unit connected? + false @@ -516,7 +499,7 @@ DateTime Energy - + @@ -533,9 +516,9 @@ - - Number:Dimensionless - + + Number:Dimensionless + Energy @@ -562,12 +545,4 @@ - - String - - Returns Extapi Version - Energy - - - From 70688ede67df4cc9cd39224eec437ce89c5da2a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96rjan=20Backsell?= Date: Mon, 11 Nov 2024 19:49:10 +0100 Subject: [PATCH 11/16] [ferroamp] Binding for ferroamp 20241111 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes done in: FerroampHandler.java FerroampMqttCommunication.java README.md Signed-off-by: Örjan Backsell --- .../org.openhab.binding.ferroamp/README.md | 27 ++++++------ .../ferroamp/internal/FerroampHandler.java | 42 +++++++++---------- .../internal/FerroampMqttCommunication.java | 8 ++-- 3 files changed, 38 insertions(+), 39 deletions(-) diff --git a/bundles/org.openhab.binding.ferroamp/README.md b/bundles/org.openhab.binding.ferroamp/README.md index 6359f332512d5..ba51464bb0db1 100644 --- a/bundles/org.openhab.binding.ferroamp/README.md +++ b/bundles/org.openhab.binding.ferroamp/README.md @@ -4,6 +4,8 @@ The Ferroamp binding is used to get live data from Ferroamp EnergyHub The Ferroamp binding is compatible with EnergyHub Wall and EnergyHub XL, and connects to your local EnergyHub via LAN. Data and commands are received/sent using MQTT where the user connects to the MQTT broker residing on the EnergyHub. +The communication with the broker might take some minute to establish, so Please just be patient. The Thing will be +in state INITIALIZATION during this time and ONLINE once connection is established. *note* Contact Ferroamp support to enable MQTT in the EnergyHub and to get the Username and Password: @@ -209,11 +211,7 @@ Thing ferroamp:energyhub:myenergyhub [ hostName="energyhub-ip", userName="myUser ``` ```java -Thing ferroamp:energyhub:myenergyhub [ hostName="energyhub-ip", userName="myUserName", password="myPassword", hasBattery=false, ssoS0=true ] -``` - -```java -Thing ferroamp:energyhub:myenergyhub [ hostName="energyhub-ip", userName="myUserName", password="myPassword", hasBattery=true, ssoS0=true, eso=true ] +Thing ferroamp:energyhub:myenergyhub [ hostName="energyhub-ip", userName="myUserName", password="myPassword", hasBattery=true, eso=true ] ``` @@ -226,20 +224,21 @@ String Ferroamp "RequestCharge" { channel="ferroamp:energyhub:myenergyh ## Rules -Ex. Set Charging with 5000W with cron trigger: +Ex. Rule name: Set Charge Level. +Set charging level to 5000W when item RequestCharge is updated. ```yaml +configuration: {} triggers: - id: "1" + - id: "1" configuration: - cronExpression: 0 0/2 * * * ? * - type: timer.GenericCronTrigger + itemName: EnergyHub_RequestCharge + type: core.ItemStateUpdateTrigger conditions: [] actions: - inputs: {} - id: "2" + - id: "2" configuration: - type: application/vnd.openhab.dsl.rule - script: ChargingWith5000W.sendCommand("5000") - type: script.ScriptAction + itemName: EnergyHub_RequestCharge + command: "5000" + type: core.ItemCommandAction ``` diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java index 8be70518dcb3f..9528f38eca096 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java @@ -68,16 +68,16 @@ public void handleCommand(ChannelUID channelUID, Command command) { if (FerroampBindingConstants.CHANNEL_REQUESTCHARGE.equals(channelUID.getId())) { String requestCmdJsonCharge = "{\"" + "transId" + "\":\"" + transId + "\",\"cmd\":{\"name\":\"charge\",\"arg\":\"" + valueConfiguration + "\"}}"; - FerroampMqttCommunication.sendMQTT(requestCmdJsonCharge, ferroampConfig); + FerroampMqttCommunication.sendPublishedTopic(requestCmdJsonCharge, ferroampConfig); } if (FerroampBindingConstants.CHANNEL_REQUESTDISCHARGE.equals(channelUID.getId())) { String requestCmdJsonDisCharge = "{\"" + "transId" + "\":\"" + transId + "\",\"cmd\":{\"name\":\"discharge\",\"arg\":\"" + valueConfiguration + "\"}}"; - FerroampMqttCommunication.sendMQTT(requestCmdJsonDisCharge, ferroampConfig); + FerroampMqttCommunication.sendPublishedTopic(requestCmdJsonDisCharge, ferroampConfig); } if (FerroampBindingConstants.CHANNEL_AUTO.equals(channelUID.getId())) { String requestCmdJsonAuto = "{\"" + "transId" + "\":\"" + transId + "\",\"cmd\":{\"name\":\"auto\"}}"; - FerroampMqttCommunication.sendMQTT(requestCmdJsonAuto, ferroampConfig); + FerroampMqttCommunication.sendPublishedTopic(requestCmdJsonAuto, ferroampConfig); } } @@ -95,26 +95,26 @@ public void initialize() { final MqttBrokerConnection ferroampConnection = new MqttBrokerConnection(ferroampConfig.hostName, FerroampBindingConstants.BROKER_PORT, false, false, ferroampConfig.userName); - scheduler.execute(() -> { - try { - startMqttConnection(); - } catch (InterruptedException e) { - logger.debug("Faulty startMqttConnection()"); - } - }); - scheduler.scheduleWithFixedDelay(this::pollTask, 60, refreshInterval, TimeUnit.SECONDS); this.setFerroampConnection(ferroampConnection); } private void pollTask() { + try { + startMqttConnection(); + } catch (InterruptedException e) { + logger.debug("Problems with startMqttConnection()"); + } if (getFerroampConnection().connectionState().toString().equals("DISCONNECTED")) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR); logger.debug("Problem connection to MqttBroker"); - } else { + // } else { + } + if (getFerroampConnection().connectionState().toString().equals("CONNECTED")) { try { channelUpdate(); updateStatus(ThingStatus.ONLINE); + } catch (RuntimeException scheduleWithFixedDelayException) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, scheduleWithFixedDelayException.getClass().getName() + ":" @@ -124,15 +124,15 @@ private void pollTask() { } private void startMqttConnection() throws InterruptedException { - try { - TimeUnit.SECONDS.sleep(10); - } catch (InterruptedException e) { - logger.debug("Connection to MqttBroker disturbed during startup of MqttConnection"); - } - ferroampMqttCommunication.getMQTT("ehubTopic", ferroampConfig); - ferroampMqttCommunication.getMQTT("ssoTopic", ferroampConfig); - ferroampMqttCommunication.getMQTT("esoTopic", ferroampConfig); - ferroampMqttCommunication.getMQTT("esmTopic", ferroampConfig); + MqttBrokerConnection localSubscribeConnection = FerroampHandler.getFerroampConnection(); + + localSubscribeConnection.start(); + localSubscribeConnection.setCredentials(ferroampConfig.userName, ferroampConfig.password); + + ferroampMqttCommunication.getSubscribedTopic("ehubTopic", ferroampConfig); + ferroampMqttCommunication.getSubscribedTopic("ssoTopic", ferroampConfig); + ferroampMqttCommunication.getSubscribedTopic("esoTopic", ferroampConfig); + ferroampMqttCommunication.getSubscribedTopic("esmTopic", ferroampConfig); } private void channelUpdate() { diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampMqttCommunication.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampMqttCommunication.java index 5c6acc0fb9316..c99880494f325 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampMqttCommunication.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampMqttCommunication.java @@ -60,7 +60,7 @@ public FerroampMqttCommunication(Thing thing) { } // Handles request topic - static void sendMQTT(String payload, FerroampConfiguration ferroampConfig) { + static void sendPublishedTopic(String payload, FerroampConfiguration ferroampConfig) { MqttBrokerConnection localConfigurationConnection = FerroampHandler.getFerroampConnection(); @@ -70,12 +70,12 @@ static void sendMQTT(String payload, FerroampConfiguration ferroampConfig) { } // Handles respective topic type - void getMQTT(String topic, FerroampConfiguration ferroampConfig) { + void getSubscribedTopic(String topic, FerroampConfiguration ferroampConfig) { MqttBrokerConnection localSubscribeConnection = FerroampHandler.getFerroampConnection(); - localSubscribeConnection.start(); - localSubscribeConnection.setCredentials(ferroampConfig.userName, ferroampConfig.password); + // localSubscribeConnection.start(); + // localSubscribeConnection.setCredentials(ferroampConfig.userName, ferroampConfig.password); if ("ehubTopic".equals(topic)) { localSubscribeConnection.subscribe(FerroampBindingConstants.EHUB_TOPIC, this); From 23df24b0768fc6bcbf092a6e6732d87b4bc039af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96rjan=20Backsell?= Date: Fri, 15 Nov 2024 12:42:18 +0100 Subject: [PATCH 12/16] [ferroamp] Binding for ferroamp 20241115 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Done changes in: FerroampConfiguration.java FerroampHandler.java FerroampMqttCommunication.java README.md Signed-off-by: Örjan Backsell --- .../org.openhab.binding.ferroamp/README.md | 2 +- .../internal/FerroampConfiguration.java | 6 +- .../ferroamp/internal/FerroampHandler.java | 14 +- .../internal/FerroampMqttCommunication.java | 318 +++++++++++------- 4 files changed, 215 insertions(+), 125 deletions(-) diff --git a/bundles/org.openhab.binding.ferroamp/README.md b/bundles/org.openhab.binding.ferroamp/README.md index ba51464bb0db1..862b319b31523 100644 --- a/bundles/org.openhab.binding.ferroamp/README.md +++ b/bundles/org.openhab.binding.ferroamp/README.md @@ -5,7 +5,7 @@ The Ferroamp binding is used to get live data from Ferroamp EnergyHub The Ferroamp binding is compatible with EnergyHub Wall and EnergyHub XL, and connects to your local EnergyHub via LAN. Data and commands are received/sent using MQTT where the user connects to the MQTT broker residing on the EnergyHub. The communication with the broker might take some minute to establish, so Please just be patient. The Thing will be -in state INITIALIZATION during this time and ONLINE once connection is established. +in state INITIALIZATION during this time and then change to state ONLINE once connection is established. *note* Contact Ferroamp support to enable MQTT in the EnergyHub and to get the Username and Password: diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampConfiguration.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampConfiguration.java index 878afe3df510b..caf42b7f33257 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampConfiguration.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampConfiguration.java @@ -26,7 +26,7 @@ public class FerroampConfiguration { public String hostName = ""; public String userName = ""; public String password = ""; - public boolean hasBattery; - public boolean eso; - public boolean esm; + public boolean hasBattery = false; + public boolean eso = false; + public boolean esm = false; } diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java index 9528f38eca096..1900904a3ba78 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java @@ -14,6 +14,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.Objects; import java.util.UUID; import java.util.concurrent.TimeUnit; @@ -105,12 +106,15 @@ private void pollTask() { } catch (InterruptedException e) { logger.debug("Problems with startMqttConnection()"); } - if (getFerroampConnection().connectionState().toString().equals("DISCONNECTED")) { + + Objects.requireNonNull(ferroampConnection, "MqttBrokerConnection ferroampConnection cannot be null"); + if (ferroampConnection.connectionState().toString().equals("DISCONNECTED")) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR); logger.debug("Problem connection to MqttBroker"); - // } else { } - if (getFerroampConnection().connectionState().toString().equals("CONNECTED")) { + + Objects.requireNonNull(ferroampConnection, "MqttBrokerConnection ferroampConnection cannot be null"); + if (ferroampConnection.connectionState().toString().equals("CONNECTED")) { try { channelUpdate(); updateStatus(ThingStatus.ONLINE); @@ -126,6 +130,9 @@ private void pollTask() { private void startMqttConnection() throws InterruptedException { MqttBrokerConnection localSubscribeConnection = FerroampHandler.getFerroampConnection(); + Objects.requireNonNull(localSubscribeConnection, + "MqttBrokerConnection localSubscribeConnection cannot be null"); + localSubscribeConnection.start(); localSubscribeConnection.setCredentials(ferroampConfig.userName, ferroampConfig.password); @@ -226,6 +233,7 @@ public void processMessage(String topic, byte[] payload) { public @Nullable static MqttBrokerConnection getFerroampConnection() { try { + return ferroampConnection; } catch (Exception e) { logger.debug("Connection to MqttBroker disturbed during startup of MqttConnection"); diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampMqttCommunication.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampMqttCommunication.java index c99880494f325..16fac672f1391 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampMqttCommunication.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampMqttCommunication.java @@ -13,6 +13,7 @@ package org.openhab.binding.ferroamp.internal; import java.nio.charset.StandardCharsets; +import java.util.Objects; import org.eclipse.jdt.annotation.Nullable; import org.openhab.binding.ferroamp.dto.GetGeneralLx; @@ -64,6 +65,9 @@ static void sendPublishedTopic(String payload, FerroampConfiguration ferroampCon MqttBrokerConnection localConfigurationConnection = FerroampHandler.getFerroampConnection(); + Objects.requireNonNull(localConfigurationConnection, + "MqttBrokerConnection localConfigurationConnection cannot be null"); + localConfigurationConnection.start(); localConfigurationConnection.setCredentials(ferroampConfig.userName, ferroampConfig.password); localConfigurationConnection.publish(FerroampBindingConstants.REQUEST_TOPIC, payload.getBytes(), 1, false); @@ -74,8 +78,8 @@ void getSubscribedTopic(String topic, FerroampConfiguration ferroampConfig) { MqttBrokerConnection localSubscribeConnection = FerroampHandler.getFerroampConnection(); - // localSubscribeConnection.start(); - // localSubscribeConnection.setCredentials(ferroampConfig.userName, ferroampConfig.password); + Objects.requireNonNull(localSubscribeConnection, + "MqttBrokerConnection localSubscribeConnection cannot be null"); if ("ehubTopic".equals(topic)) { localSubscribeConnection.subscribe(FerroampBindingConstants.EHUB_TOPIC, this); @@ -108,7 +112,6 @@ public void processMessage(String topic, byte[] payload) { } } - // @SuppressWarnings("null") // Prepare actual Json-topic Ehub-message and update values for channels void processIncomingJsonMessageEhub(String topic, String messageJsonEhub) { String[] ehubChannelPostsValue = new String[86]; // Array for EHUB (Energy Hub) Posts @@ -116,232 +119,240 @@ void processIncomingJsonMessageEhub(String topic, String messageJsonEhub) { JsonObject jsonElementsObject = new Gson().fromJson(new Gson().fromJson(messageJsonEhub, JsonObject.class), JsonObject.class); + Objects.requireNonNull(jsonElementsObject, "JsonObject jsonElementsObject cannot be null"); + String jsonElementsStringTemp = ""; Gson gson = new Gson(); // gridfreq jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(0)).toString(); - GetGeneralValues gridfreq = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + GetGeneralValues gridfreq = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); ehubChannelPostsValue[0] = gridfreq.getVal(); // iace jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(1)).toString(); - GetGeneralLx iace = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + GetGeneralLx iace = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); ehubChannelPostsValue[1] = iace.getL1(); ehubChannelPostsValue[2] = iace.getL2(); ehubChannelPostsValue[3] = iace.getL3(); // ul jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(2)).toString(); - GetGeneralLx ul = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + GetGeneralLx ul = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); ehubChannelPostsValue[4] = ul.getL1(); ehubChannelPostsValue[5] = ul.getL2(); ehubChannelPostsValue[6] = ul.getL3(); // il jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(3)).toString(); - GetGeneralLx il = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + GetGeneralLx il = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); ehubChannelPostsValue[7] = il.getL1(); ehubChannelPostsValue[8] = il.getL2(); ehubChannelPostsValue[9] = il.getL3(); // ild jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(4)).toString(); - GetGeneralLx ild = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + GetGeneralLx ild = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); ehubChannelPostsValue[10] = ild.getL1(); ehubChannelPostsValue[11] = ild.getL2(); ehubChannelPostsValue[12] = ild.getL3(); // ilq jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(5)).toString(); - GetGeneralLx ilq = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + GetGeneralLx ilq = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); ehubChannelPostsValue[13] = ilq.getL1(); ehubChannelPostsValue[14] = ilq.getL2(); ehubChannelPostsValue[15] = ilq.getL3(); // iext jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(6)).toString(); - GetGeneralLx iext = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + GetGeneralLx iext = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); ehubChannelPostsValue[16] = iext.getL1(); ehubChannelPostsValue[17] = iext.getL2(); ehubChannelPostsValue[18] = iext.getL3(); // iextd jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(7)).toString(); - GetGeneralLx iextd = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + GetGeneralLx iextd = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); ehubChannelPostsValue[19] = iextd.getL1(); ehubChannelPostsValue[20] = iextd.getL2(); ehubChannelPostsValue[21] = iextd.getL3(); // iextq jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(8)).toString(); - GetGeneralLx iextq = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + GetGeneralLx iextq = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); ehubChannelPostsValue[22] = iextq.getL1(); ehubChannelPostsValue[23] = iextq.getL2(); ehubChannelPostsValue[24] = iextq.getL3(); // iloadd jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(9)).toString(); - GetGeneralLx iloadd = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + GetGeneralLx iloadd = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); ehubChannelPostsValue[25] = iloadd.getL1(); ehubChannelPostsValue[26] = iloadd.getL2(); ehubChannelPostsValue[27] = iloadd.getL3(); // iloadq jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(10)).toString(); - GetGeneralLx iloadq = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + GetGeneralLx iloadq = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); ehubChannelPostsValue[28] = iloadq.getL1(); ehubChannelPostsValue[29] = iloadq.getL2(); ehubChannelPostsValue[30] = iloadq.getL3(); // sext jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(11)).toString(); - GetGeneralValues sext = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + GetGeneralValues sext = checkNullGeneralValues(gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); ehubChannelPostsValue[31] = sext.getVal(); // pext jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(12)).toString(); - GetGeneralLx pext = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + GetGeneralLx pext = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); ehubChannelPostsValue[32] = pext.getL1(); ehubChannelPostsValue[33] = pext.getL2(); ehubChannelPostsValue[34] = pext.getL3(); // pextreactive jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(13)).toString(); - GetGeneralLx pextreactive = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + GetGeneralLx pextreactive = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); ehubChannelPostsValue[35] = pextreactive.getL1(); ehubChannelPostsValue[36] = pextreactive.getL2(); ehubChannelPostsValue[37] = pextreactive.getL3(); // pinv jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(14)).toString(); - GetGeneralLx pinv = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + GetGeneralLx pinv = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); ehubChannelPostsValue[38] = pinv.getL1(); ehubChannelPostsValue[39] = pinv.getL2(); ehubChannelPostsValue[40] = pinv.getL3(); // pinvreactive jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(15)).toString(); - GetGeneralLx pinvreactive = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + GetGeneralLx pinvreactive = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); ehubChannelPostsValue[41] = pinvreactive.getL1(); ehubChannelPostsValue[42] = pinvreactive.getL2(); ehubChannelPostsValue[43] = pinvreactive.getL3(); // pload jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(16)).toString(); - GetGeneralLx pload = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + GetGeneralLx pload = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); ehubChannelPostsValue[44] = pload.getL1(); ehubChannelPostsValue[45] = pload.getL2(); ehubChannelPostsValue[46] = pload.getL3(); // ploadreactive jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(17)).toString(); - GetGeneralLx ploadreactive = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + GetGeneralLx ploadreactive = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); ehubChannelPostsValue[47] = ploadreactive.getL1(); ehubChannelPostsValue[48] = ploadreactive.getL2(); ehubChannelPostsValue[49] = ploadreactive.getL3(); // ppv jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(18)).toString(); - GetGeneralValues ppv = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + GetGeneralValues ppv = checkNullGeneralValues(gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(19)).toString(); - GetUdc udc = gson.fromJson(jsonElementsStringTemp, GetUdc.class); + GetUdc udc = checkNullUdc(gson.fromJson(jsonElementsStringTemp, GetUdc.class)); ehubChannelPostsValue[50] = ppv.getVal(); ehubChannelPostsValue[51] = udc.getPos(); ehubChannelPostsValue[52] = udc.getNeg(); // wextprodq jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(20)).toString(); - GetGeneralLx wextprodq = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + GetGeneralLx wextprodq = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); ehubChannelPostsValue[53] = mJTokWh(jsonStripEhub(wextprodq.getL1())); ehubChannelPostsValue[54] = mJTokWh(jsonStripEhub(wextprodq.getL2())); ehubChannelPostsValue[55] = mJTokWh(jsonStripEhub(wextprodq.getL3())); // wextconsq jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(21)).toString(); - GetGeneralLx wextconsq = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + GetGeneralLx wextconsq = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); ehubChannelPostsValue[56] = mJTokWh(jsonStripEhub(wextconsq.getL1())); ehubChannelPostsValue[57] = mJTokWh(jsonStripEhub(wextconsq.getL2())); ehubChannelPostsValue[58] = mJTokWh(jsonStripEhub(wextconsq.getL3())); // winvprodq jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(22)).toString(); - GetGeneralLx winvprodq = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + GetGeneralLx winvprodq = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); ehubChannelPostsValue[59] = mJTokWh(jsonStripEhub(winvprodq.getL1())); ehubChannelPostsValue[60] = mJTokWh(jsonStripEhub(winvprodq.getL2())); ehubChannelPostsValue[61] = mJTokWh(jsonStripEhub(winvprodq.getL3())); // winvconsq jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(23)).toString(); - GetGeneralLx winvconsq = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + GetGeneralLx winvconsq = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); ehubChannelPostsValue[62] = mJTokWh(jsonStripEhub(winvconsq.getL1())); ehubChannelPostsValue[63] = mJTokWh(jsonStripEhub(winvconsq.getL2())); ehubChannelPostsValue[64] = mJTokWh(jsonStripEhub(winvconsq.getL3())); // wloadprodq jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(24)).toString(); - GetGeneralLx wloadprodq = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + GetGeneralLx wloadprodq = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); ehubChannelPostsValue[65] = mJTokWh(jsonStripEhub(wloadprodq.getL1())); ehubChannelPostsValue[66] = mJTokWh(jsonStripEhub(wloadprodq.getL2())); ehubChannelPostsValue[67] = mJTokWh(jsonStripEhub(wloadprodq.getL3())); // wloadconsq jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(25)).toString(); - GetGeneralLx wloadconsq = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + GetGeneralLx wloadconsq = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); ehubChannelPostsValue[68] = mJTokWh(jsonStripEhub(wloadconsq.getL1())); ehubChannelPostsValue[69] = mJTokWh(jsonStripEhub(wloadconsq.getL2())); ehubChannelPostsValue[70] = mJTokWh(jsonStripEhub(wloadconsq.getL3())); // wextprodq_3p jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(26)).toString(); - GetGeneralValues wextprodq_3p = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + GetGeneralValues wextprodq_3p = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); ehubChannelPostsValue[71] = mJTokWh(jsonStripOneLiners(wextprodq_3p.getVal())); // wextconsq_3p jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(27)).toString(); - GetGeneralValues wextconsq3p = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + GetGeneralValues wextconsq3p = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); ehubChannelPostsValue[72] = mJTokWh(jsonStripOneLiners(wextconsq3p.getVal())); // winvprodq_3p jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(28)).toString(); - GetGeneralValues winvprodq3p = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + GetGeneralValues winvprodq3p = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); ehubChannelPostsValue[73] = mJTokWh(jsonStripOneLiners(winvprodq3p.getVal())); // winvconsq_3p jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(29)).toString(); - GetGeneralValues winvconsq3p = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + GetGeneralValues winvconsq3p = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); ehubChannelPostsValue[74] = mJTokWh(jsonStripOneLiners(winvconsq3p.getVal())); // wloadprodq_3p jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(30)).toString(); - GetGeneralValues wloadprodq3p = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + GetGeneralValues wloadprodq3p = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); ehubChannelPostsValue[75] = mJTokWh(jsonStripOneLiners(wloadprodq3p.getVal())); // wloadconsq_3p jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(31)).toString(); - GetGeneralValues wloadconsq3p = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + GetGeneralValues wloadconsq3p = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); ehubChannelPostsValue[76] = mJTokWh(jsonStripOneLiners(wloadconsq3p.getVal())); // wpv jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(32)).toString(); - GetGeneralValues wpv = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + GetGeneralValues wpv = checkNullGeneralValues(gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); ehubChannelPostsValue[77] = mJTokWh(jsonStripOneLiners(wpv.getVal())); // state jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(33)).toString(); - GetGeneralValues state = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + GetGeneralValues state = checkNullGeneralValues(gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); ehubChannelPostsValue[78] = jsonStripOneLiners(state.getVal()); // ts jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(34)).toString(); - GetGeneralValues ts = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + GetGeneralValues ts = checkNullGeneralValues(gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); ehubChannelPostsValue[79] = ts.getVal(); ehubChannelsUpdateValues = ehubChannelPostsValue; } // Prepare actual Json-topic Sso-messages and update values for channels - // @SuppressWarnings("null") void processIncomingJsonMessageSso(String topic, String messageJsonSso) { String[] ssoS1ChannelPostsValue = new String[9]; // Array for SSOS1 ( Solar String Optimizer ) Posts String[] ssoS2ChannelPostsValue = new String[9]; // Array for SSOS2 ( Solar String Optimizer ) Posts @@ -356,9 +367,13 @@ void processIncomingJsonMessageSso(String topic, String messageJsonSso) { JsonObject jsonElementsObjectSsoS1 = new Gson().fromJson(new Gson().fromJson(messageJsonSso, JsonObject.class), JsonObject.class); + + Objects.requireNonNull(jsonElementsObjectSsoS1, "JsonObject jsonElementsObjectSsoS1 cannot be null"); + jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(0)).toString(); - GetGeneralValues idS1 = gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class); - GetGeneralValues idSso = gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class); + GetGeneralValues idS1 = checkNullGeneralValues(gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class)); + GetGeneralValues idSso = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class)); if (isSsoChecked == false) { if (ssoS1IdCheck.isEmpty() && ssoS2IdCheck.isEmpty() && ssoS3IdCheck.isEmpty() && ssoS4IdCheck.isEmpty()) { @@ -387,55 +402,63 @@ void processIncomingJsonMessageSso(String topic, String messageJsonSso) { // id jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(0)) .toString(); - idS1 = gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class); + idS1 = checkNullGeneralValues(gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class)); ssoS1ChannelPostsValue[0] = idS1.getVal(); // upv jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(1)) .toString(); - GetGeneralValues upvS1 = gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class); + GetGeneralValues upvS1 = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class)); ssoS1ChannelPostsValue[1] = upvS1.getVal(); // ipv jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(2)) .toString(); - GetGeneralValues ipvS1 = gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class); + GetGeneralValues ipvS1 = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class)); ssoS1ChannelPostsValue[2] = ipvS1.getVal(); // wpv jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(3)) .toString(); - GetGeneralValues wpvS1 = gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class); + GetGeneralValues wpvS1 = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class)); ssoS1ChannelPostsValue[3] = mJTokWh(jsonStripOneLiners(wpvS1.getVal())); // relaystatus jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(4)) .toString(); - GetGeneralValues relaystatusS1 = gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class); + GetGeneralValues relaystatusS1 = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class)); ssoS1ChannelPostsValue[4] = relaystatusS1.getVal(); // temp jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(5)) .toString(); - GetGeneralValues tempS1 = gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class); + GetGeneralValues tempS1 = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class)); ssoS1ChannelPostsValue[5] = tempS1.getVal(); // faultcode jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(6)) .toString(); - GetGeneralValues faultcodeS1 = gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class); + GetGeneralValues faultcodeS1 = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class)); ssoS1ChannelPostsValue[6] = faultcodeS1.getVal(); // udc jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(7)) .toString(); - GetGeneralValues udcS1 = gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class); + GetGeneralValues udcS1 = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class)); ssoS1ChannelPostsValue[7] = udcS1.getVal(); // ts jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(8)) .toString(); - GetGeneralValues tsS1 = gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class); + GetGeneralValues tsS1 = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class)); ssoS1ChannelPostsValue[8] = tsS1.getVal(); ssoS1ChannelsUpdateValues = ssoS1ChannelPostsValue; @@ -443,62 +466,73 @@ void processIncomingJsonMessageSso(String topic, String messageJsonSso) { JsonObject jsonElementsObjectSsoS2 = new Gson().fromJson(new Gson().fromJson(messageJsonSso, JsonObject.class), JsonObject.class); + + Objects.requireNonNull(jsonElementsObjectSsoS2, "JsonObject jsonElementsObjectSsoS2 cannot be null"); + jsonElementsStringTempS2 = jsonElementsObjectSsoS2.get(SsoJsonElements.getJsonElementsSso().get(0)).toString(); - GetGeneralValues idS2 = gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class); + GetGeneralValues idS2 = checkNullGeneralValues(gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class)); if (idS2.getVal().equals(ssoS2IdCheck)) { // id jsonElementsStringTempS2 = jsonElementsObjectSsoS2.get(SsoJsonElements.getJsonElementsSso().get(0)) .toString(); - idS2 = gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class); + idS2 = checkNullGeneralValues(gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class)); ssoS2ChannelPostsValue[0] = idS2.getVal(); // upv jsonElementsStringTempS2 = jsonElementsObjectSsoS2.get(SsoJsonElements.getJsonElementsSso().get(1)) .toString(); - GetGeneralValues upvS2 = gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class); + GetGeneralValues upvS2 = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class)); ssoS2ChannelPostsValue[1] = upvS2.getVal(); // ipv jsonElementsStringTempS2 = jsonElementsObjectSsoS2.get(SsoJsonElements.getJsonElementsSso().get(2)) .toString(); - GetGeneralValues ipvS2 = gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class); + GetGeneralValues ipvS2 = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class)); ssoS2ChannelPostsValue[2] = ipvS2.getVal(); // wpv jsonElementsStringTempS2 = jsonElementsObjectSsoS2.get(SsoJsonElements.getJsonElementsSso().get(3)) .toString(); - GetGeneralValues wpvS2 = gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class); + GetGeneralValues wpvS2 = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class)); ssoS2ChannelPostsValue[3] = mJTokWh(jsonStripOneLiners(wpvS2.getVal())); // relaystatus jsonElementsStringTempS2 = jsonElementsObjectSsoS2.get(SsoJsonElements.getJsonElementsSso().get(4)) .toString(); - GetGeneralValues relaystatusS2 = gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class); + GetGeneralValues relaystatusS2 = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class)); ssoS2ChannelPostsValue[4] = relaystatusS2.getVal(); // temp jsonElementsStringTempS2 = jsonElementsObjectSsoS2.get(SsoJsonElements.getJsonElementsSso().get(5)) .toString(); - GetGeneralValues tempS2 = gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class); + GetGeneralValues tempS2 = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class)); ssoS2ChannelPostsValue[5] = tempS2.getVal(); // faultcode jsonElementsStringTempS2 = jsonElementsObjectSsoS2.get(SsoJsonElements.getJsonElementsSso().get(6)) .toString(); - GetGeneralValues faultcodeS2 = gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class); + GetGeneralValues faultcodeS2 = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class)); ssoS2ChannelPostsValue[6] = faultcodeS2.getVal(); // udc jsonElementsStringTempS2 = jsonElementsObjectSsoS2.get(SsoJsonElements.getJsonElementsSso().get(7)) .toString(); - GetGeneralValues udc = gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class); + GetGeneralValues udc = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class)); ssoS2ChannelPostsValue[7] = udc.getVal(); // ts jsonElementsStringTempS2 = jsonElementsObjectSsoS2.get(SsoJsonElements.getJsonElementsSso().get(8)) .toString(); - GetGeneralValues tsS2 = gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class); + GetGeneralValues tsS2 = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class)); ssoS2ChannelPostsValue[8] = tsS2.getVal(); ssoS2ChannelsUpdateValues = ssoS2ChannelPostsValue; @@ -506,62 +540,73 @@ void processIncomingJsonMessageSso(String topic, String messageJsonSso) { JsonObject jsonElementsObjectSsoS3 = new Gson().fromJson(new Gson().fromJson(messageJsonSso, JsonObject.class), JsonObject.class); + + Objects.requireNonNull(jsonElementsObjectSsoS3, "JsonObject jsonElementsObjectSsoS3 cannot be null"); + jsonElementsStringTempS3 = jsonElementsObjectSsoS3.get(SsoJsonElements.getJsonElementsSso().get(0)).toString(); - GetGeneralValues idS3 = gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class); + GetGeneralValues idS3 = checkNullGeneralValues(gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class)); if (idS3.getVal().equals(ssoS3IdCheck)) { // id jsonElementsStringTempS3 = jsonElementsObjectSsoS3.get(SsoJsonElements.getJsonElementsSso().get(0)) .toString(); - idS3 = gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class); + idS3 = checkNullGeneralValues(gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class)); ssoS3ChannelPostsValue[0] = idS3.getVal(); // upv jsonElementsStringTempS3 = jsonElementsObjectSsoS3.get(SsoJsonElements.getJsonElementsSso().get(1)) .toString(); - GetGeneralValues upvS3 = gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class); + GetGeneralValues upvS3 = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class)); ssoS3ChannelPostsValue[1] = upvS3.getVal(); // ipv jsonElementsStringTempS3 = jsonElementsObjectSsoS3.get(SsoJsonElements.getJsonElementsSso().get(2)) .toString(); - GetGeneralValues ipvS3 = gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class); + GetGeneralValues ipvS3 = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class)); ssoS3ChannelPostsValue[2] = ipvS3.getVal(); // wpv jsonElementsStringTempS3 = jsonElementsObjectSsoS3.get(SsoJsonElements.getJsonElementsSso().get(3)) .toString(); - GetGeneralValues wpvS3 = gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class); + GetGeneralValues wpvS3 = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class)); ssoS3ChannelPostsValue[3] = mJTokWh(jsonStripOneLiners(wpvS3.getVal())); // relaystatus jsonElementsStringTempS3 = jsonElementsObjectSsoS3.get(SsoJsonElements.getJsonElementsSso().get(4)) .toString(); - GetGeneralValues relaystatusS3 = gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class); + GetGeneralValues relaystatusS3 = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class)); ssoS3ChannelPostsValue[4] = relaystatusS3.getVal(); // temp jsonElementsStringTempS3 = jsonElementsObjectSsoS3.get(SsoJsonElements.getJsonElementsSso().get(5)) .toString(); - GetGeneralValues tempS3 = gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class); + GetGeneralValues tempS3 = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class)); ssoS3ChannelPostsValue[5] = tempS3.getVal(); // faultcode jsonElementsStringTempS3 = jsonElementsObjectSsoS3.get(SsoJsonElements.getJsonElementsSso().get(6)) .toString(); - GetGeneralValues faultcodeS3 = gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class); + GetGeneralValues faultcodeS3 = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class)); ssoS3ChannelPostsValue[6] = faultcodeS3.getVal(); // udc jsonElementsStringTempS3 = jsonElementsObjectSsoS3.get(SsoJsonElements.getJsonElementsSso().get(7)) .toString(); - GetGeneralValues udcS3 = gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class); + GetGeneralValues udcS3 = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class)); ssoS3ChannelPostsValue[7] = udcS3.getVal(); // ts jsonElementsStringTempS3 = jsonElementsObjectSsoS3.get(SsoJsonElements.getJsonElementsSso().get(8)) .toString(); - GetGeneralValues tsS3 = gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class); + GetGeneralValues tsS3 = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class)); ssoS3ChannelPostsValue[8] = tsS3.getVal(); ssoS3ChannelsUpdateValues = ssoS3ChannelPostsValue; @@ -569,172 +614,193 @@ void processIncomingJsonMessageSso(String topic, String messageJsonSso) { JsonObject jsonElementsObjectSsoS4 = new Gson().fromJson(new Gson().fromJson(messageJsonSso, JsonObject.class), JsonObject.class); + + Objects.requireNonNull(jsonElementsObjectSsoS4, "JsonObject jsonElementsObjectSsoS4 cannot be null"); + jsonElementsStringTempS4 = jsonElementsObjectSsoS4.get(SsoJsonElements.getJsonElementsSso().get(0)).toString(); - GetGeneralValues idS4 = gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class); + GetGeneralValues idS4 = checkNullGeneralValues(gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class)); if (idS4.getVal().equals(ssoS4IdCheck)) { // id jsonElementsStringTempS4 = jsonElementsObjectSsoS4.get(SsoJsonElements.getJsonElementsSso().get(0)) .toString(); - idS4 = gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class); + idS4 = checkNullGeneralValues(gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class)); ssoS4ChannelPostsValue[0] = idS4.getVal(); // upv jsonElementsStringTempS4 = jsonElementsObjectSsoS4.get(SsoJsonElements.getJsonElementsSso().get(1)) .toString(); - GetGeneralValues upvS4 = gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class); + GetGeneralValues upvS4 = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class)); ssoS4ChannelPostsValue[1] = upvS4.getVal(); // ipv jsonElementsStringTempS4 = jsonElementsObjectSsoS4.get(SsoJsonElements.getJsonElementsSso().get(2)) .toString(); - GetGeneralValues ipvS4 = gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class); + GetGeneralValues ipvS4 = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class)); ssoS4ChannelPostsValue[2] = ipvS4.getVal(); // wpv jsonElementsStringTempS4 = jsonElementsObjectSsoS4.get(SsoJsonElements.getJsonElementsSso().get(3)) .toString(); - GetGeneralValues wpvS4 = gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class); + GetGeneralValues wpvS4 = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class)); ssoS4ChannelPostsValue[3] = mJTokWh(jsonStripOneLiners(wpvS4.getVal())); // relaystatus jsonElementsStringTempS4 = jsonElementsObjectSsoS4.get(SsoJsonElements.getJsonElementsSso().get(4)) .toString(); - GetGeneralValues relaystatusS4 = gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class); + GetGeneralValues relaystatusS4 = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class)); ssoS4ChannelPostsValue[4] = relaystatusS4.getVal(); // temp jsonElementsStringTempS4 = jsonElementsObjectSsoS4.get(SsoJsonElements.getJsonElementsSso().get(5)) .toString(); - GetGeneralValues tempS4 = gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class); + GetGeneralValues tempS4 = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class)); ssoS4ChannelPostsValue[5] = tempS4.getVal(); // faultcode jsonElementsStringTempS4 = jsonElementsObjectSsoS4.get(SsoJsonElements.getJsonElementsSso().get(6)) .toString(); - GetGeneralValues faultcode = gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class); + GetGeneralValues faultcode = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class)); ssoS4ChannelPostsValue[6] = faultcode.getVal(); // udc jsonElementsStringTempS4 = jsonElementsObjectSsoS4.get(SsoJsonElements.getJsonElementsSso().get(7)) .toString(); - GetGeneralValues udcS4 = gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class); + GetGeneralValues udcS4 = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class)); ssoS4ChannelPostsValue[7] = udcS4.getVal(); // ts jsonElementsStringTempS4 = jsonElementsObjectSsoS4.get(SsoJsonElements.getJsonElementsSso().get(8)) .toString(); - GetGeneralValues tsS4 = gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class); + GetGeneralValues tsS4 = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class)); ssoS4ChannelPostsValue[8] = tsS4.getVal(); ssoS4ChannelsUpdateValues = ssoS4ChannelPostsValue; } } - // @SuppressWarnings("null") // Prepare actual Json-topic Eso-message and update values for channels void processIncomingJsonMessageEso(String topic, String messageJsonEso) { String[] esoChannelPostsValue = new String[10]; // Array for ESO, Energy Storage Optimizer ) Posts - JsonObject jsonElementsObject = new Gson().fromJson(new Gson().fromJson(messageJsonEso, JsonObject.class), + JsonObject jsonElementsObjectEso = new Gson().fromJson(new Gson().fromJson(messageJsonEso, JsonObject.class), JsonObject.class); + + Objects.requireNonNull(jsonElementsObjectEso, "JsonObject jsonElementsObjectEso cannot be null"); + String jsonElementsStringTemp = ""; Gson gson = new Gson(); // faultcode - jsonElementsStringTemp = jsonElementsObject.get(EsoJsonElements.getJsonElementsEso().get(0)).toString(); - GetGeneralValues faultcode = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + jsonElementsStringTemp = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(0)).toString(); + + GetGeneralValues faultcode = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); esoChannelPostsValue[0] = faultcode.getVal(); // id - jsonElementsStringTemp = jsonElementsObject.get(EsoJsonElements.getJsonElementsEso().get(1)).toString(); - GetGeneralValues id = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + jsonElementsStringTemp = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(1)).toString(); + GetGeneralValues id = checkNullGeneralValues(gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); esoChannelPostsValue[1] = id.getVal(); // ibat - jsonElementsStringTemp = jsonElementsObject.get(EsoJsonElements.getJsonElementsEso().get(2)).toString(); - GetGeneralValues ibat = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + jsonElementsStringTemp = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(2)).toString(); + GetGeneralValues ibat = checkNullGeneralValues(gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); esoChannelPostsValue[2] = ibat.getVal(); // ubat - jsonElementsStringTemp = jsonElementsObject.get(EsoJsonElements.getJsonElementsEso().get(3)).toString(); - GetGeneralValues ubat = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + jsonElementsStringTemp = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(3)).toString(); + GetGeneralValues ubat = checkNullGeneralValues(gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); esoChannelPostsValue[3] = ubat.getVal(); // relaystatus - jsonElementsStringTemp = jsonElementsObject.get(EsoJsonElements.getJsonElementsEso().get(4)).toString(); - GetGeneralValues relaystatus = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + jsonElementsStringTemp = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(4)).toString(); + GetGeneralValues relaystatus = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); esoChannelPostsValue[4] = relaystatus.getVal(); // soc - jsonElementsStringTemp = jsonElementsObject.get(EsoJsonElements.getJsonElementsEso().get(5)).toString(); - GetGeneralValues soc = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + jsonElementsStringTemp = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(5)).toString(); + GetGeneralValues soc = checkNullGeneralValues(gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); esoChannelPostsValue[5] = soc.getVal(); // temp - jsonElementsStringTemp = jsonElementsObject.get(EsoJsonElements.getJsonElementsEso().get(6)).toString(); - GetGeneralValues temp = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + jsonElementsStringTemp = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(6)).toString(); + GetGeneralValues temp = checkNullGeneralValues(gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); esoChannelPostsValue[6] = temp.getVal(); // wbatprod - jsonElementsStringTemp = jsonElementsObject.get(EsoJsonElements.getJsonElementsEso().get(7)).toString(); - GetGeneralValues wbatprod = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + jsonElementsStringTemp = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(7)).toString(); + GetGeneralValues wbatprod = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); esoChannelPostsValue[7] = mJTokWh(jsonStripOneLiners(wbatprod.getVal())); // udc - jsonElementsStringTemp = jsonElementsObject.get(EsoJsonElements.getJsonElementsEso().get(8)).toString(); - GetGeneralValues udc = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + jsonElementsStringTemp = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(8)).toString(); + GetGeneralValues udc = checkNullGeneralValues(gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); esoChannelPostsValue[8] = udc.getVal(); // ts - jsonElementsStringTemp = jsonElementsObject.get(EsoJsonElements.getJsonElementsEso().get(9)).toString(); - GetGeneralValues ts = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + jsonElementsStringTemp = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(9)).toString(); + GetGeneralValues ts = checkNullGeneralValues(gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); esoChannelPostsValue[9] = ts.getVal(); esoChannelsUpdateValues = esoChannelPostsValue; } - // @SuppressWarnings("null") // Prepare actual Json-topic Esm-message and update values for channels void processIncomingJsonMessageEsm(String topic, String messageJsonEsm) { String[] esmChannelPostsValue = new String[7]; // Array for ESM, Energy Storage Module ) Posts - JsonObject jsonElementsObject = new Gson().fromJson(new Gson().fromJson(messageJsonEsm, JsonObject.class), + JsonObject jsonElementsObjectEsm = new Gson().fromJson(new Gson().fromJson(messageJsonEsm, JsonObject.class), JsonObject.class); + + Objects.requireNonNull(jsonElementsObjectEsm, "JsonObject jsonElementsObjectEsm cannot be null"); + String jsonElementsStringTemp = ""; Gson gson = new Gson(); // soc - jsonElementsStringTemp = jsonElementsObject.get(EsmJsonElements.getJsonElementsEsm().get(0)).toString(); - GetGeneralValues soc = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + jsonElementsStringTemp = jsonElementsObjectEsm.get(EsmJsonElements.getJsonElementsEsm().get(0)).toString(); + GetGeneralValues soc = checkNullGeneralValues(gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); esmChannelPostsValue[0] = soc.getVal(); // soh - jsonElementsStringTemp = jsonElementsObject.get(EsmJsonElements.getJsonElementsEsm().get(1)).toString(); - GetGeneralValues soh = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + jsonElementsStringTemp = jsonElementsObjectEsm.get(EsmJsonElements.getJsonElementsEsm().get(1)).toString(); + GetGeneralValues soh = checkNullGeneralValues(gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); esmChannelPostsValue[1] = soh.getVal(); // ratedcapacity - jsonElementsStringTemp = jsonElementsObject.get(EsmJsonElements.getJsonElementsEsm().get(2)).toString(); - GetGeneralValues ratedcapacity = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + jsonElementsStringTemp = jsonElementsObjectEsm.get(EsmJsonElements.getJsonElementsEsm().get(2)).toString(); + GetGeneralValues ratedcapacity = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); esmChannelPostsValue[2] = ratedcapacity.getVal(); // id - jsonElementsStringTemp = jsonElementsObject.get(EsmJsonElements.getJsonElementsEsm().get(3)).toString(); - GetGeneralValues id = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + jsonElementsStringTemp = jsonElementsObjectEsm.get(EsmJsonElements.getJsonElementsEsm().get(3)).toString(); + GetGeneralValues id = checkNullGeneralValues(gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); esmChannelPostsValue[3] = id.getVal(); // ratedpower - jsonElementsStringTemp = jsonElementsObject.get(EsmJsonElements.getJsonElementsEsm().get(4)).toString(); - GetGeneralValues ratedpower = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + jsonElementsStringTemp = jsonElementsObjectEsm.get(EsmJsonElements.getJsonElementsEsm().get(4)).toString(); + GetGeneralValues ratedpower = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); esmChannelPostsValue[4] = ratedpower.getVal(); // status - jsonElementsStringTemp = jsonElementsObject.get(EsmJsonElements.getJsonElementsEsm().get(5)).toString(); - GetGeneralValues status = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + jsonElementsStringTemp = jsonElementsObjectEsm.get(EsmJsonElements.getJsonElementsEsm().get(5)).toString(); + GetGeneralValues status = checkNullGeneralValues(gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); esmChannelPostsValue[5] = status.getVal(); // ts - jsonElementsStringTemp = jsonElementsObject.get(EsmJsonElements.getJsonElementsEsm().get(6)).toString(); - GetGeneralValues ts = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + jsonElementsStringTemp = jsonElementsObjectEsm.get(EsmJsonElements.getJsonElementsEsm().get(6)).toString(); + GetGeneralValues ts = checkNullGeneralValues(gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); esmChannelPostsValue[6] = ts.getVal(); esmChannelsUpdateValues = esmChannelPostsValue; @@ -816,4 +882,20 @@ public String mJTokWh(String actualmJ) { Double actualkWhD = (Double.parseDouble(actualmJ) / 3600000000.0); return actualkWhD.toString(); } + + public GetGeneralValues checkNullGeneralValues(GetGeneralValues checkGeneralValues) { + Objects.requireNonNull(checkGeneralValues, "GeneralValues cannot be null, " + checkGeneralValues.getName()); + return checkGeneralValues; + } + + public GetGeneralLx checkNullGeneralLx(GetGeneralLx checkGeneralLx) { + Objects.requireNonNull(checkGeneralLx, "GeneralLx cannot be null, " + checkGeneralLx.getL1() + ", " + + checkGeneralLx.getL2() + ", " + checkGeneralLx.getL3()); + return checkGeneralLx; + } + + public GetUdc checkNullUdc(GetUdc checkUdc) { + Objects.requireNonNull(checkUdc, "Udc cannot be null, " + checkUdc.getNeg() + ", " + checkUdc.getPos()); + return checkUdc; + } } From c95df50776fd8364d36be666cb41d26ed375f4c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96rjan=20Backsell?= Date: Thu, 21 Nov 2024 11:31:49 +0100 Subject: [PATCH 13/16] [ferroamp] Binding for ferroamp 20241121 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Done changes in: FerroampChannelConfiguration.java, regarded CHANNEL_APPARENTPOWER thing-types.xml, regarded CHANNEL_APPARENTPOWER FerroampHandler.java, regarded Annotation warnings FerroampMqttCommunication.java, regarded Annotation warnings README.md, regarded pointed out changes Signed-off-by: Örjan Backsell --- .../org.openhab.binding.ferroamp/README.md | 20 +++++++++---------- .../FerroampChannelConfiguration.java | 4 ++-- .../ferroamp/internal/FerroampHandler.java | 2 +- .../internal/FerroampMqttCommunication.java | 15 +++++++------- .../resources/OH-INF/thing/thing-types.xml | 2 +- 5 files changed, 21 insertions(+), 22 deletions(-) diff --git a/bundles/org.openhab.binding.ferroamp/README.md b/bundles/org.openhab.binding.ferroamp/README.md index 862b319b31523..a15760afae8e2 100644 --- a/bundles/org.openhab.binding.ferroamp/README.md +++ b/bundles/org.openhab.binding.ferroamp/README.md @@ -40,7 +40,6 @@ The following configuration parameters are available. | eso | boolean | Has the system an Eso unit connected? | N/A | no | no | | esm | boolean | Has the system an Esm unit connected? | N/A | no | no | - ## Channels | Channel Type ID | Item Type | Read/Write | Label | Description | @@ -76,7 +75,7 @@ The following configuration parameters are available. | inverter-load-active-current-l1 | Number:ElectricCurrent | R | Inverter Load Active Current L1 | | | inverter-load-active-current-l2 | Number:ElectricCurrent | R | Inverter Load Active Current L2 | | | inverter-load-active-current-l3 | Number:ElectricCurrent | R | Inverter Load Active Current L3 | | -| apparent-power | Number:Energy | R | Apparent Power | Apparent power | +| apparent-power | Number:Power | R | Apparent Power | Apparent power | | grid-power-active-l1 | Number:Power | R | Grid Power Active L1 | Grid power, active | | grid-power-active-l2 | Number:Power | R | Grid Power Active L2 | Grid power, active | | grid-power-active-l3 | Number:Power | R | Grid Power Active L3 | Grid power, active | @@ -107,9 +106,9 @@ The following configuration parameters are available. | inverter-energy-produced-l1 | Number:Energy | R | Inverter Energy Produced L1 | | | inverter-energy-produced-l2 | Number:Energy | R | Inverter Energy Produced L2 | | | inverter-energy-produced-l3 | Number:Energy | R | Inverter Energy Produced L3 | | -| inverter-energy-consumed-l1 | Number:ElectricCurrent | R | Inverter Energy Consumed L1 | | -| inverter-energy-consumed-l2 | Number:ElectricCurrent | R | Inverter Energy Consumed L2 | | -| inverter-energy-consumed-l3 | Number:ElectricCurrent | R | Inverter Energy Consumed L3 | | +| inverter-energy-consumed-l1 | Number:Energy | R | Inverter Energy Consumed L1 | | +| inverter-energy-consumed-l2 | Number:Energy | R | Inverter Energy Consumed L2 | | +| inverter-energy-consumed-l3 | Number:Energy | R | Inverter Energy Consumed L3 | | | load-energy-produced-l1 | Number:Energy | R | Load Energy Produced L1 | | | load-energy-produced-l2 | Number:Energy | R | Load Energy Produced L2 | | | load-energy-produced-l3 | Number:Energy | R | Load Energy Produced L3 | | @@ -127,8 +126,8 @@ The following configuration parameters are available. | timestamp | DateTime | R | Time Stamp | Time stamp when message was published | | battery-energy-produced | Number:Energy | R | Battery Energy Produced | Only sent when system has batteries | | battery-energy-consumed | Number:Energy | R | Battery Energy Consumed | Only sent when system has batteries | -| soc | Number:Dimensionless | R | System State of Check | State of the system | -| soh | Number:Dimensionless | R | System State of Health | | +| soc | Number:Percentage | R | System State of Check | State of the system | +| soh | Number:Percentage | R | System State of Health | | | power-battery | Number:Power | R | Battery Power | Only sent when system has batteries | | total-capacity-batteries | Number:Energy | R | Total Capacity Batteries | Total rated capacity of all batteries | @@ -177,7 +176,7 @@ The following configuration parameters are available. | eso-current-battery | Number:ElectricCurrent | R | Eso Current on Battery Side | Measured on battery side | | eso-battery-energy-produced | Number:Energy | R | Eso Battery Energy Produced | Total energy produced by ESO, i.e total energy charged | | eso-battery-energy-consumed | Number:Energy | R | Eso Battery Energy Consumed | Total energy consumed by ESO, i.e total energy discharged | -| eso-soc | Number:Dimensionless | R | Eso State of Charge | State of Charge for ESO | +| eso-soc | Number:Percentage | R | Eso State of Charge | State of Charge for ESO | | eso-relay-status | Contact | R | Eso Relay Status | 0 = relay closed, 1 = relay open | | eso-temperature | Number:Temperature | R | Eso Temperature on PCB | Measured inside ESO | | eso-fault-code | String | R | Eso FaultCode | See section 4.1.3.1 in Ferroamp-External-API-specifikation | @@ -187,8 +186,8 @@ The following configuration parameters are available. | esm-id | String | R | Esm Unique Identifier | Unique identifier of battery. If available, this will be the unique id that the battery reports | -| esm-soh | Number:Dimensionless | R | Esm System State of Health | State of Health for ESM | -| esm-soc | Number:Dimensionless | R | Esm System State of Charge | State of Charge for ESM | +| esm-soh | Number:Percentage | R | Esm System State of Health | State of Health for ESM | +| esm-soc | Number:Percentage | R | Esm System State of Charge | State of Charge for ESM | | esm-total-capacity | Number:Energy | R | Esm Rated Capacity | Rated capacity of all batteries | | esm-power-battery | Number:Power | R | Esm Rated Power of Battery | Rated power of battery | | esm-status | String | R | Esm Status | Dependent on battery manufacturer | @@ -214,7 +213,6 @@ Thing ferroamp:energyhub:myenergyhub [ hostName="energyhub-ip", userName="myUser Thing ferroamp:energyhub:myenergyhub [ hostName="energyhub-ip", userName="myUserName", password="myPassword", hasBattery=true, eso=true ] ``` - ## `demo.items` Example ```java diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampChannelConfiguration.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampChannelConfiguration.java index a139e4c8f2f83..be87f543d18bf 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampChannelConfiguration.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampChannelConfiguration.java @@ -101,8 +101,8 @@ public static List getChannelConfigurationEhub() { FerroampBindingConstants.CHANNEL_INVERTERLOADACTIVECURRENTL2, Units.AMPERE)); channelConfigurationEhub.add(new FerroampChannelConfiguration( FerroampBindingConstants.CHANNEL_INVERTERLOADACTIVECURRENTL3, Units.AMPERE)); - channelConfigurationEhub.add( - new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_APPARENTPOWER, Units.VOLT_AMPERE)); + channelConfigurationEhub + .add(new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_APPARENTPOWER, Units.WATT)); channelConfigurationEhub.add( new FerroampChannelConfiguration(FerroampBindingConstants.CHANNEL_GRIDPOWERACTIVEL1, Units.AMPERE)); channelConfigurationEhub.add( diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java index 1900904a3ba78..80ba4248be7ea 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java @@ -113,7 +113,7 @@ private void pollTask() { logger.debug("Problem connection to MqttBroker"); } - Objects.requireNonNull(ferroampConnection, "MqttBrokerConnection ferroampConnection cannot be null"); + Objects.requireNonNull(ferroampConnection, "MqttBrokerConnection ferroampConnection cannot be null, "); if (ferroampConnection.connectionState().toString().equals("CONNECTED")) { try { channelUpdate(); diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampMqttCommunication.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampMqttCommunication.java index 16fac672f1391..bba484ec28a16 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampMqttCommunication.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampMqttCommunication.java @@ -37,13 +37,13 @@ public class FerroampMqttCommunication implements MqttMessageSubscriber { - static String[] ehubChannelsUpdateValues; - static String[] ssoS1ChannelsUpdateValues; - static String[] ssoS2ChannelsUpdateValues; - static String[] ssoS3ChannelsUpdateValues; - static String[] ssoS4ChannelsUpdateValues; - static String[] esoChannelsUpdateValues; - static String[] esmChannelsUpdateValues; + static String[] ehubChannelsUpdateValues = new String[0]; + static String[] ssoS1ChannelsUpdateValues = new String[0]; + static String[] ssoS2ChannelsUpdateValues = new String[0]; + static String[] ssoS3ChannelsUpdateValues = new String[0]; + static String[] ssoS4ChannelsUpdateValues = new String[0]; + static String[] esoChannelsUpdateValues = new String[0]; + static String[] esmChannelsUpdateValues = new String[0]; static boolean isSsoChecked = false; static String ssoS1IdCheck = ""; @@ -128,6 +128,7 @@ void processIncomingJsonMessageEhub(String topic, String messageJsonEhub) { jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(0)).toString(); GetGeneralValues gridfreq = checkNullGeneralValues( gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); + ehubChannelPostsValue[0] = gridfreq.getVal(); // iace diff --git a/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/thing-types.xml b/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/thing-types.xml index 4524250bed09a..4b33d693ea5c9 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/thing-types.xml +++ b/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/thing-types.xml @@ -102,7 +102,7 @@ - + From e8ee223cb72372651ae2edb4b204f7347b894a67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96rjan=20Backsell?= Date: Mon, 25 Nov 2024 18:58:14 +0100 Subject: [PATCH 14/16] [ferroamp] Binding for ferroamp 20241125 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes done in: ferroamp.properties FerroampConfiguration.java FerroampHandler.java FerroampMqttCommunication.java README.md thing-types.xml Signed-off-by: Örjan Backsell --- .../org.openhab.binding.ferroamp/README.md | 14 +- .../internal/FerroampConfiguration.java | 2 - .../ferroamp/internal/FerroampHandler.java | 78 ++-- .../internal/FerroampMqttCommunication.java | 196 +++++----- .../resources/OH-INF/i18n/ferroamp.properties | 341 ------------------ .../resources/OH-INF/thing/thing-types.xml | 10 - 6 files changed, 158 insertions(+), 483 deletions(-) diff --git a/bundles/org.openhab.binding.ferroamp/README.md b/bundles/org.openhab.binding.ferroamp/README.md index a15760afae8e2..c482bf8a2ff12 100644 --- a/bundles/org.openhab.binding.ferroamp/README.md +++ b/bundles/org.openhab.binding.ferroamp/README.md @@ -5,7 +5,7 @@ The Ferroamp binding is used to get live data from Ferroamp EnergyHub The Ferroamp binding is compatible with EnergyHub Wall and EnergyHub XL, and connects to your local EnergyHub via LAN. Data and commands are received/sent using MQTT where the user connects to the MQTT broker residing on the EnergyHub. The communication with the broker might take some minute to establish, so Please just be patient. The Thing will be -in state INITIALIZATION during this time and then change to state ONLINE once connection is established. +in state INITIALIZATION and UNKNOWN during this time and then change to state ONLINE once connection is established. *note* Contact Ferroamp support to enable MQTT in the EnergyHub and to get the Username and Password: @@ -37,8 +37,6 @@ The following configuration parameters are available. | userName | text | Username to access the device | N/A | yes | no | | password | text | Password to access the device | N/A | yes | no | | hasBattery | boolean | Has the system a battery connected? | N/A | no | yes | -| eso | boolean | Has the system an Eso unit connected? | N/A | no | no | -| esm | boolean | Has the system an Esm unit connected? | N/A | no | no | ## Channels @@ -126,8 +124,8 @@ The following configuration parameters are available. | timestamp | DateTime | R | Time Stamp | Time stamp when message was published | | battery-energy-produced | Number:Energy | R | Battery Energy Produced | Only sent when system has batteries | | battery-energy-consumed | Number:Energy | R | Battery Energy Consumed | Only sent when system has batteries | -| soc | Number:Percentage | R | System State of Check | State of the system | -| soh | Number:Percentage | R | System State of Health | | +| soc | Number:Dimensionless | R | System State of Check | State of the system | +| soh | Number:Dimensionless | R | System State of Health | | | power-battery | Number:Power | R | Battery Power | Only sent when system has batteries | | total-capacity-batteries | Number:Energy | R | Total Capacity Batteries | Total rated capacity of all batteries | @@ -176,7 +174,7 @@ The following configuration parameters are available. | eso-current-battery | Number:ElectricCurrent | R | Eso Current on Battery Side | Measured on battery side | | eso-battery-energy-produced | Number:Energy | R | Eso Battery Energy Produced | Total energy produced by ESO, i.e total energy charged | | eso-battery-energy-consumed | Number:Energy | R | Eso Battery Energy Consumed | Total energy consumed by ESO, i.e total energy discharged | -| eso-soc | Number:Percentage | R | Eso State of Charge | State of Charge for ESO | +| eso-soc | Number:Dimensionless | R | Eso State of Charge | State of Charge for ESO | | eso-relay-status | Contact | R | Eso Relay Status | 0 = relay closed, 1 = relay open | | eso-temperature | Number:Temperature | R | Eso Temperature on PCB | Measured inside ESO | | eso-fault-code | String | R | Eso FaultCode | See section 4.1.3.1 in Ferroamp-External-API-specifikation | @@ -186,8 +184,8 @@ The following configuration parameters are available. | esm-id | String | R | Esm Unique Identifier | Unique identifier of battery. If available, this will be the unique id that the battery reports | -| esm-soh | Number:Percentage | R | Esm System State of Health | State of Health for ESM | -| esm-soc | Number:Percentage | R | Esm System State of Charge | State of Charge for ESM | +| esm-soh | Number:Dimensionless | R | Esm System State of Health | State of Health for ESM | +| esm-soc | Number:Dimensionless | R | Esm System State of Charge | State of Charge for ESM | | esm-total-capacity | Number:Energy | R | Esm Rated Capacity | Rated capacity of all batteries | | esm-power-battery | Number:Power | R | Esm Rated Power of Battery | Rated power of battery | | esm-status | String | R | Esm Status | Dependent on battery manufacturer | diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampConfiguration.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampConfiguration.java index caf42b7f33257..22bff72fa80ee 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampConfiguration.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampConfiguration.java @@ -27,6 +27,4 @@ public class FerroampConfiguration { public String userName = ""; public String password = ""; public boolean hasBattery = false; - public boolean eso = false; - public boolean esm = false; } diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java index 80ba4248be7ea..c47b20b4b6cb6 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java @@ -44,9 +44,9 @@ public class FerroampHandler extends BaseThingHandler implements MqttMessageSubs private final static Logger logger = LoggerFactory.getLogger(FerroampHandler.class); private @Nullable static MqttBrokerConnection ferroampConnection; FerroampMqttCommunication ferroampMqttCommunication = new FerroampMqttCommunication(thing); - final FerroampConfiguration ferroampConfig = getConfigAs(FerroampConfiguration.class); + private @Nullable FerroampConfiguration ferroampConfig; - private List channelConfigEhub = new ArrayList<>(); + private static List channelConfigEhub = new ArrayList<>(); private static List channelConfigSsoS1 = new ArrayList<>(); private static List channelConfigSsoS2 = new ArrayList<>(); private static List channelConfigSsoS3 = new ArrayList<>(); @@ -55,8 +55,6 @@ public class FerroampHandler extends BaseThingHandler implements MqttMessageSubs private static List channelConfigEsm = new ArrayList<>(); long refreshInterval = 30; - static boolean isEsoAvailable = false; - static boolean isEsmAvailable = false; public FerroampHandler(Thing thing) { super(thing); @@ -84,6 +82,8 @@ public void handleCommand(ChannelUID channelUID, Command command) { @Override public void initialize() { + // Set configuration parameters + ferroampConfig = getConfigAs(FerroampConfiguration.class); // Set channel configuration parameters channelConfigEhub = FerroampChannelConfiguration.getChannelConfigurationEhub(); channelConfigSsoS1 = FerroampChannelConfiguration.getChannelConfigurationSsoS1(); @@ -93,32 +93,39 @@ public void initialize() { channelConfigEso = FerroampChannelConfiguration.getChannelConfigurationEso(); channelConfigEsm = FerroampChannelConfiguration.getChannelConfigurationEsm(); - final MqttBrokerConnection ferroampConnection = new MqttBrokerConnection(ferroampConfig.hostName, - FerroampBindingConstants.BROKER_PORT, false, false, ferroampConfig.userName); + if (ferroampConfig != null && channelConfigEhub != null && channelConfigSsoS1 != null + && channelConfigSsoS2 != null && channelConfigSsoS3 != null && channelConfigSsoS4 != null + && channelConfigEso != null && channelConfigEsm != null) { - scheduler.scheduleWithFixedDelay(this::pollTask, 60, refreshInterval, TimeUnit.SECONDS); - this.setFerroampConnection(ferroampConnection); + final MqttBrokerConnection ferroampConnection = new MqttBrokerConnection(ferroampConfig.hostName, + FerroampBindingConstants.BROKER_PORT, false, false, ferroampConfig.userName); + + scheduler.scheduleWithFixedDelay(this::pollTask, 60, refreshInterval, TimeUnit.SECONDS); + this.setFerroampConnection(ferroampConnection); + updateStatus(ThingStatus.UNKNOWN); + } else { + updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR); + logger.debug("Configuration problems"); + } } private void pollTask() { try { startMqttConnection(); } catch (InterruptedException e) { - logger.debug("Problems with startMqttConnection()"); + logger.debug("Not connected to the MqttBroker"); + return; } - Objects.requireNonNull(ferroampConnection, "MqttBrokerConnection ferroampConnection cannot be null"); - if (ferroampConnection.connectionState().toString().equals("DISCONNECTED")) { + MqttBrokerConnection ferroampConnection = FerroampHandler.ferroampConnection; + + if (ferroampConnection == null || ferroampConnection.connectionState().toString().equals("DISCONNECTED")) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR); logger.debug("Problem connection to MqttBroker"); - } - - Objects.requireNonNull(ferroampConnection, "MqttBrokerConnection ferroampConnection cannot be null, "); - if (ferroampConnection.connectionState().toString().equals("CONNECTED")) { + } else if (ferroampConnection.connectionState().toString().equals("CONNECTED")) { + updateStatus(ThingStatus.ONLINE); try { channelUpdate(); - updateStatus(ThingStatus.ONLINE); - } catch (RuntimeException scheduleWithFixedDelayException) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, scheduleWithFixedDelayException.getClass().getName() + ":" @@ -128,6 +135,7 @@ private void pollTask() { } private void startMqttConnection() throws InterruptedException { + MqttBrokerConnection localSubscribeConnection = FerroampHandler.getFerroampConnection(); Objects.requireNonNull(localSubscribeConnection, @@ -201,27 +209,31 @@ private void channelUpdate() { } } - if (ferroampConfig.eso == true) { - String[] esoUpdateChannels; - esoUpdateChannels = FerroampMqttCommunication.getEsoChannelUpdateValues(); + String[] esoUpdateChannels = new String[11]; + esoUpdateChannels = FerroampMqttCommunication.getEsoChannelUpdateValues(); + if (esoUpdateChannels.length > 0) { int channelValuesCounterEso = 0; - for (FerroampChannelConfiguration cConfig : channelConfigEso) { - String esoChannel = cConfig.id; - State esoState = StringType.valueOf(esoUpdateChannels[channelValuesCounterEso]); - updateState(esoChannel, esoState); - channelValuesCounterEso++; + if (esoUpdateChannels.length <= 9) { + for (FerroampChannelConfiguration cConfig : channelConfigEso) { + String esoChannel = cConfig.id; + State esoState = StringType.valueOf(esoUpdateChannels[channelValuesCounterEso]); + updateState(esoChannel, esoState); + channelValuesCounterEso++; + } } } - if (ferroampConfig.esm == true) { - String[] esmUpdateChannels; - esmUpdateChannels = FerroampMqttCommunication.getEsmChannelUpdateValues(); + String[] esmUpdateChannels = new String[7]; + esmUpdateChannels = FerroampMqttCommunication.getEsmChannelUpdateValues(); + if (esmUpdateChannels.length > 0) { int channelValuesCounterEsm = 0; - for (FerroampChannelConfiguration cConfig : channelConfigEsm) { - String esmChannel = cConfig.id; - State esmState = StringType.valueOf(esmUpdateChannels[channelValuesCounterEsm]); - updateState(esmChannel, esmState); - channelValuesCounterEsm++; + if (esmUpdateChannels.length <= 9) { + for (FerroampChannelConfiguration cConfig : channelConfigEsm) { + String esmChannel = cConfig.id; + State esmState = StringType.valueOf(esmUpdateChannels[channelValuesCounterEsm]); + updateState(esmChannel, esmState); + channelValuesCounterEsm++; + } } } } diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampMqttCommunication.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampMqttCommunication.java index bba484ec28a16..8b580dd6ec6ab 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampMqttCommunication.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampMqttCommunication.java @@ -51,9 +51,6 @@ public class FerroampMqttCommunication implements MqttMessageSubscriber { static String ssoS3IdCheck = ""; static String ssoS4IdCheck = ""; - static boolean isEsoAvailable = false; - static boolean isEsmAvailable = false; - private final static Logger logger = LoggerFactory.getLogger(FerroampMqttCommunication.class); public FerroampMqttCommunication(Thing thing) { @@ -690,7 +687,7 @@ void processIncomingJsonMessageSso(String topic, String messageJsonSso) { // Prepare actual Json-topic Eso-message and update values for channels void processIncomingJsonMessageEso(String topic, String messageJsonEso) { - String[] esoChannelPostsValue = new String[10]; // Array for ESO, Energy Storage Optimizer ) Posts + String[] esoChannelPostsValue = new String[11]; // Array for ESO, Energy Storage Optimizer ) Posts JsonObject jsonElementsObjectEso = new Gson().fromJson(new Gson().fromJson(messageJsonEso, JsonObject.class), JsonObject.class); @@ -699,61 +696,75 @@ void processIncomingJsonMessageEso(String topic, String messageJsonEso) { String jsonElementsStringTemp = ""; Gson gson = new Gson(); - // faultcode - jsonElementsStringTemp = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(0)).toString(); - - GetGeneralValues faultcode = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - esoChannelPostsValue[0] = faultcode.getVal(); - - // id - jsonElementsStringTemp = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(1)).toString(); - GetGeneralValues id = checkNullGeneralValues(gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - esoChannelPostsValue[1] = id.getVal(); - - // ibat - jsonElementsStringTemp = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(2)).toString(); - GetGeneralValues ibat = checkNullGeneralValues(gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - esoChannelPostsValue[2] = ibat.getVal(); - - // ubat - jsonElementsStringTemp = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(3)).toString(); - GetGeneralValues ubat = checkNullGeneralValues(gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - esoChannelPostsValue[3] = ubat.getVal(); - - // relaystatus - jsonElementsStringTemp = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(4)).toString(); - GetGeneralValues relaystatus = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - esoChannelPostsValue[4] = relaystatus.getVal(); + if (!jsonElementsObjectEso.isEmpty()) { + // id + jsonElementsStringTemp = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(0)).toString(); + GetGeneralValues id = checkNullGeneralValues(gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); + esoChannelPostsValue[0] = id.getVal(); + + // ubat + jsonElementsStringTemp = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(1)).toString(); + GetGeneralValues ubat = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); + esoChannelPostsValue[1] = ubat.getVal(); + + // ibat + jsonElementsStringTemp = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(2)).toString(); + GetGeneralValues ibat = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); + esoChannelPostsValue[2] = ibat.getVal(); + + // wbatprod + jsonElementsStringTemp = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(3)).toString(); + GetGeneralValues wbatprod = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); + esoChannelPostsValue[3] = mJTokWh(jsonStripOneLiners(wbatprod.getVal())); + + // wbatcons + jsonElementsStringTemp = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(4)).toString(); + GetGeneralValues wbatcons = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); + esoChannelPostsValue[4] = mJTokWh(jsonStripOneLiners(wbatcons.getVal())); + + // soc + jsonElementsStringTemp = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(5)).toString(); + GetGeneralValues soc = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); + esoChannelPostsValue[5] = soc.getVal(); - // soc - jsonElementsStringTemp = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(5)).toString(); - GetGeneralValues soc = checkNullGeneralValues(gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - esoChannelPostsValue[5] = soc.getVal(); + // relaystatus + jsonElementsStringTemp = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(6)).toString(); + GetGeneralValues relaystatus = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); + esoChannelPostsValue[6] = relaystatus.getVal(); - // temp - jsonElementsStringTemp = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(6)).toString(); - GetGeneralValues temp = checkNullGeneralValues(gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - esoChannelPostsValue[6] = temp.getVal(); + // temp + jsonElementsStringTemp = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(7)).toString(); + GetGeneralValues temp = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); + esoChannelPostsValue[7] = temp.getVal(); - // wbatprod - jsonElementsStringTemp = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(7)).toString(); - GetGeneralValues wbatprod = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - esoChannelPostsValue[7] = mJTokWh(jsonStripOneLiners(wbatprod.getVal())); + // faultcode + jsonElementsStringTemp = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(8)).toString(); + GetGeneralValues faultcode = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); + esoChannelPostsValue[8] = faultcode.getVal(); - // udc - jsonElementsStringTemp = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(8)).toString(); - GetGeneralValues udc = checkNullGeneralValues(gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - esoChannelPostsValue[8] = udc.getVal(); + // udc + jsonElementsStringTemp = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(9)).toString(); + GetGeneralValues udc = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); + esoChannelPostsValue[9] = udc.getVal(); - // ts - jsonElementsStringTemp = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(9)).toString(); - GetGeneralValues ts = checkNullGeneralValues(gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - esoChannelPostsValue[9] = ts.getVal(); + // ts + jsonElementsStringTemp = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(10)).toString(); + GetGeneralValues ts = checkNullGeneralValues(gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); + esoChannelPostsValue[10] = ts.getVal(); - esoChannelsUpdateValues = esoChannelPostsValue; + esoChannelsUpdateValues = esoChannelPostsValue; + } else { + return; + } } // Prepare actual Json-topic Esm-message and update values for channels @@ -767,44 +778,51 @@ void processIncomingJsonMessageEsm(String topic, String messageJsonEsm) { String jsonElementsStringTemp = ""; Gson gson = new Gson(); - // soc - jsonElementsStringTemp = jsonElementsObjectEsm.get(EsmJsonElements.getJsonElementsEsm().get(0)).toString(); - GetGeneralValues soc = checkNullGeneralValues(gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - esmChannelPostsValue[0] = soc.getVal(); - - // soh - jsonElementsStringTemp = jsonElementsObjectEsm.get(EsmJsonElements.getJsonElementsEsm().get(1)).toString(); - GetGeneralValues soh = checkNullGeneralValues(gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - esmChannelPostsValue[1] = soh.getVal(); - - // ratedcapacity - jsonElementsStringTemp = jsonElementsObjectEsm.get(EsmJsonElements.getJsonElementsEsm().get(2)).toString(); - GetGeneralValues ratedcapacity = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - esmChannelPostsValue[2] = ratedcapacity.getVal(); - - // id - jsonElementsStringTemp = jsonElementsObjectEsm.get(EsmJsonElements.getJsonElementsEsm().get(3)).toString(); - GetGeneralValues id = checkNullGeneralValues(gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - esmChannelPostsValue[3] = id.getVal(); - - // ratedpower - jsonElementsStringTemp = jsonElementsObjectEsm.get(EsmJsonElements.getJsonElementsEsm().get(4)).toString(); - GetGeneralValues ratedpower = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - esmChannelPostsValue[4] = ratedpower.getVal(); - - // status - jsonElementsStringTemp = jsonElementsObjectEsm.get(EsmJsonElements.getJsonElementsEsm().get(5)).toString(); - GetGeneralValues status = checkNullGeneralValues(gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - esmChannelPostsValue[5] = status.getVal(); + if (!jsonElementsObjectEsm.isEmpty()) { + // id + jsonElementsStringTemp = jsonElementsObjectEsm.get(EsmJsonElements.getJsonElementsEsm().get(0)).toString(); + GetGeneralValues id = checkNullGeneralValues(gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); + esmChannelPostsValue[0] = id.getVal(); + + // soh + jsonElementsStringTemp = jsonElementsObjectEsm.get(EsmJsonElements.getJsonElementsEsm().get(1)).toString(); + GetGeneralValues soh = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); + esmChannelPostsValue[1] = soh.getVal(); + + // soc + jsonElementsStringTemp = jsonElementsObjectEsm.get(EsmJsonElements.getJsonElementsEsm().get(2)).toString(); + GetGeneralValues soc = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); + esmChannelPostsValue[2] = soc.getVal(); + + // ratedcapacity + jsonElementsStringTemp = jsonElementsObjectEsm.get(EsmJsonElements.getJsonElementsEsm().get(3)).toString(); + GetGeneralValues ratedcapacity = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); + esmChannelPostsValue[3] = ratedcapacity.getVal(); + + // ratedpower + jsonElementsStringTemp = jsonElementsObjectEsm.get(EsmJsonElements.getJsonElementsEsm().get(4)).toString(); + GetGeneralValues ratedpower = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); + esmChannelPostsValue[4] = ratedpower.getVal(); + + // status + jsonElementsStringTemp = jsonElementsObjectEsm.get(EsmJsonElements.getJsonElementsEsm().get(5)).toString(); + GetGeneralValues status = checkNullGeneralValues( + gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); + esmChannelPostsValue[5] = status.getVal(); - // ts - jsonElementsStringTemp = jsonElementsObjectEsm.get(EsmJsonElements.getJsonElementsEsm().get(6)).toString(); - GetGeneralValues ts = checkNullGeneralValues(gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - esmChannelPostsValue[6] = ts.getVal(); + // ts + jsonElementsStringTemp = jsonElementsObjectEsm.get(EsmJsonElements.getJsonElementsEsm().get(6)).toString(); + GetGeneralValues ts = checkNullGeneralValues(gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); + esmChannelPostsValue[6] = ts.getVal(); - esmChannelsUpdateValues = esmChannelPostsValue; + esmChannelsUpdateValues = esmChannelPostsValue; + } else { + return; + } } public @Nullable static String[] getEhubChannelUpdateValues() { diff --git a/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/i18n/ferroamp.properties b/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/i18n/ferroamp.properties index c3d276e687f34..006cdbf9eba97 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/i18n/ferroamp.properties +++ b/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/i18n/ferroamp.properties @@ -153,10 +153,6 @@ thing-type.ferroamp.energyhub.channel.total-solar-energy.label = Total Solar Ene # thing types config -thing-type.config.ferroamp.energyhub.esm.label = ESM Module Available -thing-type.config.ferroamp.energyhub.esm.description = Has the system an Esm unit connected? -thing-type.config.ferroamp.energyhub.eso.label = ESO Module Available -thing-type.config.ferroamp.energyhub.eso.description = Has the system an Eso unit connected? thing-type.config.ferroamp.energyhub.hasBattery.label = Battery Available thing-type.config.ferroamp.energyhub.hasBattery.description = Has the system a battery connected? thing-type.config.ferroamp.energyhub.hostName.label = Hostname @@ -180,340 +176,3 @@ channel-type.ferroamp.request.label = String channel-type.ferroamp.request.description = Used for control of system channel-type.ferroamp.string.label = String channel-type.ferroamp.temperature.label = Temperature - -# thing types - -thing-type.ferroamp.energyhub.channel.grid-current-active-l1.label = Grid Current Active L1 -thing-type.ferroamp.energyhub.channel.grid-current-active-l2.label = Grid Current Active L2 -thing-type.ferroamp.energyhub.channel.grid-current-active-l3.label = Grid Current Active L3 -thing-type.ferroamp.energyhub.channel.grid-current-reactive-l1.label = Grid Reactive Current L1 -thing-type.ferroamp.energyhub.channel.grid-current-reactive-l2.label = Grid Reactive Current L2 -thing-type.ferroamp.energyhub.channel.grid-current-reactive-l3.label = Grid Reactive Current L3 -thing-type.ferroamp.energyhub.channel.inverter-current-active-l1.label = Inverter Active Current L1 -thing-type.ferroamp.energyhub.channel.inverter-current-active-l2.label = Inverter Active Current L2 -thing-type.ferroamp.energyhub.channel.inverter-current-active-l3.label = Inverter Active Current L3 -thing-type.ferroamp.energyhub.channel.inverter-current-reactive-l1.label = Inverter Reactive Current L1 -thing-type.ferroamp.energyhub.channel.inverter-current-reactive-l2.label = Inverter Reactive Current L2 -thing-type.ferroamp.energyhub.channel.inverter-current-reactive-l3.label = Inverter Reactive Current L3 -thing-type.ferroamp.energyhub.channel.inverter-load-l1.label = Inverter Load L1 -thing-type.ferroamp.energyhub.channel.inverter-load-l2.label = Inverter Load L2 -thing-type.ferroamp.energyhub.channel.inverter-load-l3.label = Inverter Load L3 -thing-type.ferroamp.energyhub.channel.s0-dc-link-voltage.label = S0 DC Link Voltage -thing-type.ferroamp.energyhub.channel.s0-fault-code.label = S0 FaultCode -thing-type.ferroamp.energyhub.channel.s0-id.label = S0 ID -thing-type.ferroamp.energyhub.channel.s0-pv-current.label = S0 Measured Current on PV String Side -thing-type.ferroamp.energyhub.channel.s0-pv-voltage.label = S0 Measured Voltage on PV String Side -thing-type.ferroamp.energyhub.channel.s0-relay-status.label = S0 RelayStatus -thing-type.ferroamp.energyhub.channel.s0-temperature.label = S0 Temperature Measured on PCB -thing-type.ferroamp.energyhub.channel.s0-timestamp.label = S0 Time Stamp When Message was Published -thing-type.ferroamp.energyhub.channel.s0-total-solar-energy.label = S0 Total Solar Energy - -# thing types config - -thing-type.config.ferroamp.energyhub.ssoS0.label = SSO String S0 Available -thing-type.config.ferroamp.energyhub.ssoS0.description = First SSO Unit Available -thing-type.config.ferroamp.energyhub.ssoS1.label = SSO String S1 Available -thing-type.config.ferroamp.energyhub.ssoS1.description = Second SSO Unit Available -thing-type.config.ferroamp.energyhub.ssoS2.label = SSO String S2 Available -thing-type.config.ferroamp.energyhub.ssoS2.description = Third SSO Unit Available -thing-type.config.ferroamp.energyhub.ssoS3.label = SSO String S3 Available -thing-type.config.ferroamp.energyhub.ssoS3.description = Fourth SSO Unit Available - -# channel types - -channel-type.ferroamp.dimensionless.label = Dimensionless - -# thing types - -thing-type.ferroamp.energyhub.channel.esm-rated-power-battery.label = Esm Rated Power of Battery -thing-type.ferroamp.energyhub.channel.esm-total-rated-capacity-all-batteries.label = Esm Rated Capacity -thing-type.ferroamp.energyhub.channel.esm-unique-identifier.label = Esm Unique Identifier -thing-type.ferroamp.energyhub.channel.eso-unique-identifier.label = Eso Unique Identifier -thing-type.ferroamp.energyhub.channel.external-energy-consumed-3p.label = External Energy Consumed 3p -thing-type.ferroamp.energyhub.channel.external-energy-consumed-l1.label = External Energy Consumed L1 -thing-type.ferroamp.energyhub.channel.external-energy-consumed-l2.label = External Energy Consumed L2 -thing-type.ferroamp.energyhub.channel.external-energy-consumed-l3.label = External Energy Consumed L3 -thing-type.ferroamp.energyhub.channel.external-energy-produced-3p.label = External Energy Produced 3p -thing-type.ferroamp.energyhub.channel.external-energy-produced-l1.label = External Energy Produced L1 -thing-type.ferroamp.energyhub.channel.external-energy-produced-l2.label = External Energy Produced L2 -thing-type.ferroamp.energyhub.channel.external-energy-produced-l3.label = External Energy Produced L3 -thing-type.ferroamp.energyhub.channel.inverter-energy-consumed-3p.label = Inverter Energy Consumed 3p -thing-type.ferroamp.energyhub.channel.inverter-energy-produced-3p.label = Inverter Energy Produced 3p -thing-type.ferroamp.energyhub.channel.load-energy-consumed-3p.label = Load Energy Consumed 3p -thing-type.ferroamp.energyhub.channel.load-energy-produced-3p.label = Load Energy Produced 3p -thing-type.ferroamp.energyhub.channel.measured-current-battery.label = Eso Current Measured on Battery Side -thing-type.ferroamp.energyhub.channel.measured-voltage-battery.label = Eso Voltage Measured on Battery Side -thing-type.ferroamp.energyhub.channel.s0-measured-current-pv-string.label = S0 Measured Current on PV String Side -thing-type.ferroamp.energyhub.channel.s0-measured-voltage-pv-string.label = S0 Measured Voltage on PV String Side -thing-type.ferroamp.energyhub.channel.s1-measured-current-pv-string.label = S1 Measured Current on PV String Side -thing-type.ferroamp.energyhub.channel.s1-measured-voltage-pv-string.label = S1 Measured Voltage on PV String Side -thing-type.ferroamp.energyhub.channel.s2-measured-current-pv-string.label = S2 Measured Current on PV String Side -thing-type.ferroamp.energyhub.channel.s2-measured-voltage-pv-string.label = S2 Measured Voltage on PV String Side -thing-type.ferroamp.energyhub.channel.s3-measured-current-pv-string.label = S3 Measured Current on PV String Side -thing-type.ferroamp.energyhub.channel.s3-measured-voltage-pv-string.label = S3 Measured Voltage on PV String Side -thing-type.ferroamp.energyhub.channel.total-rated-capacity-all-batteries.label = Total Rated Capacity of All Batteries - -# channel group types - -channel-group-type.ferroamp.date-time.label = Date Time -channel-group-type.ferroamp.dimensionless.label = Dimensionless -channel-group-type.ferroamp.electric-current.label = Electric Current -channel-group-type.ferroamp.electric-potential.label = Electrical Potential -channel-group-type.ferroamp.energy.label = Energy -channel-group-type.ferroamp.frequency.label = Frequency -channel-group-type.ferroamp.power.label = Power -channel-group-type.ferroamp.string.label = String -channel-group-type.ferroamp.temperature.label = Temperature - -# channel types - -channel-type.ferroamp.ehub-gridfreq.label = EHUB, Estimated Grid Frequency -channel-type.ferroamp.ehub-gridfreq.description = Estimated grid frequency -channel-type.ferroamp.ehub-iace-l1.label = EHUB, ACE Equalization L1 -channel-type.ferroamp.ehub-iace-l1.description = ACE equalization l1 -channel-type.ferroamp.ehub-iace-l2.label = EHUB, ACE Equalization L2 -channel-type.ferroamp.ehub-iace-l2.description = ACE equalization l2 -channel-type.ferroamp.ehub-iace-l3.label = EHUB, ACE Equalization L3 -channel-type.ferroamp.ehub-iace-l3.description = ACE equalization l3 -channel-type.ferroamp.ehub-iext-l1.label = EHUB, External/Grid RMS Current L1 -channel-type.ferroamp.ehub-iext-l1.description = External/Grid rms current l1 -channel-type.ferroamp.ehub-iext-l2.label = EHUB, External/Grid RMS Current L2 -channel-type.ferroamp.ehub-iext-l2.description = External/Grid rms current l2 -channel-type.ferroamp.ehub-iext-l3.label = EHUB, External/Grid RMS Current L3 -channel-type.ferroamp.ehub-iext-l3.description = External/Grid rms current l3 -channel-type.ferroamp.ehub-iextd-l1.label = EHUB, External/Grid Reactive Current L1 -channel-type.ferroamp.ehub-iextd-l1.description = External/Grid reactive current l1 -channel-type.ferroamp.ehub-iextd-l2.label = EHUB, External/Grid Reactive Current L2 -channel-type.ferroamp.ehub-iextd-l2.description = External/Grid reactive current l2 -channel-type.ferroamp.ehub-iextd-l3.label = EHUB, External/Grid Reactive Current L3 -channel-type.ferroamp.ehub-iextd-l3.description = External/Grid reactive current l3 -channel-type.ferroamp.ehub-iextq-l1.label = EHUB, External/Grid Active Current L1 -channel-type.ferroamp.ehub-iextq-l1.description = External/Grid active current l1 -channel-type.ferroamp.ehub-iextq-l2.label = EHUB, External/Grid Active Current L2 -channel-type.ferroamp.ehub-iextq-l2.description = External/Grid active current l2 -channel-type.ferroamp.ehub-iextq-l3.label = EHUB, External/Grid Active Current L3 -channel-type.ferroamp.ehub-iextq-l3.description = External/Grid active current l3 -channel-type.ferroamp.ehub-il-l1.label = EHUB, Inverter RMS Current L1 -channel-type.ferroamp.ehub-il-l1.description = Inverter rms current l1 -channel-type.ferroamp.ehub-il-l2.label = EHUB, Inverter RMS Current L2 -channel-type.ferroamp.ehub-il-l2.description = Inverter rms current l2 -channel-type.ferroamp.ehub-il-l3.label = EHUB, Inverter RMS Current L3 -channel-type.ferroamp.ehub-il-l3.description = Inverter rms current l3 -channel-type.ferroamp.ehub-ild-l1.label = EHUB, Inverter Reactive Current L1 -channel-type.ferroamp.ehub-ild-l1.description = Inverter reactive current l1 -channel-type.ferroamp.ehub-ild-l2.label = EHUB, Inverter Reactive Current L2 -channel-type.ferroamp.ehub-ild-l2.description = Inverter reactive current l2 -channel-type.ferroamp.ehub-ild-l3.label = EHUB, Inverter Reactive Current L3 -channel-type.ferroamp.ehub-ild-l3.description = Inverter reactive current l3 -channel-type.ferroamp.ehub-iloadd-l1.label = EHUB, ILoadd L1 -channel-type.ferroamp.ehub-iloadd-l2.label = EHUB, ILoadd L2 -channel-type.ferroamp.ehub-iloadd-l3.label = EHUB, ILoadd L3 -channel-type.ferroamp.ehub-iloadq-l1.label = EHUB, ILoadq L1 -channel-type.ferroamp.ehub-iloadq-l2.label = EHUB, ILoadq L2 -channel-type.ferroamp.ehub-iloadq-l3.label = EHUB, ILoadq L3 -channel-type.ferroamp.ehub-ilq-l1.label = EHUB, Inverter Active Current L1 -channel-type.ferroamp.ehub-ilq-l1.description = Inverter active current l1 -channel-type.ferroamp.ehub-ilq-l2.label = EHUB, Inverter Active Current L2 -channel-type.ferroamp.ehub-ilq-l2.description = Inverter active current l2 -channel-type.ferroamp.ehub-ilq-l3.label = EHUB, Inverter Active Current L3 -channel-type.ferroamp.ehub-ilq-l3.description = Inverter active current l3 -channel-type.ferroamp.ehub-pbat.label = EHUB, Power Batteries -channel-type.ferroamp.ehub-pbat.description = Only sent when system has batteries -channel-type.ferroamp.ehub-pext-l1.label = EHUB, External/Grid Power, Active L1 -channel-type.ferroamp.ehub-pext-l1.description = External/Grid power, active l1 -channel-type.ferroamp.ehub-pext-l2.label = EHUB, External/Grid Power, Active L2 -channel-type.ferroamp.ehub-pext-l2.description = External/Grid power, active l2 -channel-type.ferroamp.ehub-pext-l3.label = EHUB, External/Grid Power, Active L3 -channel-type.ferroamp.ehub-pext-l3.description = External/Grid power, active l3 -channel-type.ferroamp.ehub-pextreactive-l1.label = EHUB, External/Grid Power, Reactive L1 -channel-type.ferroamp.ehub-pextreactive-l1.description = External/Grid power, reactive l1 -channel-type.ferroamp.ehub-pextreactive-l2.label = EHUB, External/Grid Power, Reactive L2 -channel-type.ferroamp.ehub-pextreactive-l2.description = External/Grid power, reactive l2 -channel-type.ferroamp.ehub-pextreactive-l3.label = EHUB, External/Grid Power, Reactive L3 -channel-type.ferroamp.ehub-pextreactive-l3.description = External/Grid power, reactive l3 -channel-type.ferroamp.ehub-pinv-l1.label = EHUB, Inverter Power, Active L1 -channel-type.ferroamp.ehub-pinv-l1.description = Inverter power, active l1 -channel-type.ferroamp.ehub-pinv-l2.label = EHUB, Inverter Power, Active L2 -channel-type.ferroamp.ehub-pinv-l2.description = Inverter power, active l2 -channel-type.ferroamp.ehub-pinv-l3.label = EHUB, Inverter Power, Active L3 -channel-type.ferroamp.ehub-pinv-l3.description = Inverter power, active l3 -channel-type.ferroamp.ehub-pinvreactive-l1.label = EHUB, Inverter Power, Reactive L1 -channel-type.ferroamp.ehub-pinvreactive-l1.description = Inverter power, reactive l1 -channel-type.ferroamp.ehub-pinvreactive-l2.label = EHUB, Inverter Power, Reactive L2 -channel-type.ferroamp.ehub-pinvreactive-l2.description = Inverter power, reactive l2 -channel-type.ferroamp.ehub-pinvreactive-l3.label = EHUB, Inverter Power, Reactive L3 -channel-type.ferroamp.ehub-pinvreactive-l3.description = Inverter power, reactive l3 -channel-type.ferroamp.ehub-pload-l1.label = EHUB, PLoad L1 -channel-type.ferroamp.ehub-pload-l2.label = EHUB, PLoad L2 -channel-type.ferroamp.ehub-pload-l3.label = EHUB, PLoad L3 -channel-type.ferroamp.ehub-ploadreactive-l1.label = EHUB, PLoadReactive L1 -channel-type.ferroamp.ehub-ploadreactive-l2.label = EHUB, PLoadReactive L2 -channel-type.ferroamp.ehub-ploadreactive-l3.label = EHUB, PLoadReactive L3 -channel-type.ferroamp.ehub-ppv.label = EHUB, Power PV -channel-type.ferroamp.ehub-ppv.description = Only sent when system has pv -channel-type.ferroamp.ehub-ratedcap.label = EHUB, Total Rated Capacity Batteries -channel-type.ferroamp.ehub-ratedcap.description = Total rated capacity of all batteries in the system -channel-type.ferroamp.ehub-sext.label = EHUB, Apparent Power -channel-type.ferroamp.ehub-sext.description = Apparent power -channel-type.ferroamp.ehub-soc.label = EHUB, Soc -channel-type.ferroamp.ehub-soc.description = State of charge for the EHUB -channel-type.ferroamp.ehub-soh.label = EHUB, Soh -channel-type.ferroamp.ehub-soh.description = State of health for the EHUB -channel-type.ferroamp.ehub-state.label = EHUB, State Of The System -channel-type.ferroamp.ehub-state.description = State of the system -channel-type.ferroamp.ehub-ts.label = EHUB, Time Stamp -channel-type.ferroamp.ehub-ts.description = Time stamp when message was published -channel-type.ferroamp.ehub-udcneg.label = EHUB, Negativ DC Link Voltage -channel-type.ferroamp.ehub-udcneg.description = Negativ dc link voltage -channel-type.ferroamp.ehub-udcpos.label = EHUB, Positiv DC Link Voltage -channel-type.ferroamp.ehub-udcpos.description = Positiv dc link voltage -channel-type.ferroamp.ehub-ul-l1.label = EHUB, External Voltage L1 -channel-type.ferroamp.ehub-ul-l1.description = External voltage l1 -channel-type.ferroamp.ehub-ul-l2.label = EHUB, External Voltage L2 -channel-type.ferroamp.ehub-ul-l2.description = External voltage l2 -channel-type.ferroamp.ehub-ul-l3.label = EHUB, External Voltage L3 -channel-type.ferroamp.ehub-ul-l3.description = External voltage l3 -channel-type.ferroamp.ehub-wbatprod.label = EHUB, Produced Power Batteries -channel-type.ferroamp.ehub-wbatprod.description = Only sent when system has batteries -channel-type.ferroamp.ehub-wextconsq-l1.label = EHUB, WExtConsq L1 -channel-type.ferroamp.ehub-wextconsq-l2.label = EHUB, WExtConsq L2 -channel-type.ferroamp.ehub-wextconsq-l3.label = EHUB, WExtConsq L3 -channel-type.ferroamp.ehub-wextconsq_3p.label = EHUB, WExtConsq_3p -channel-type.ferroamp.ehub-wextprodq-l1.label = EHUB, WExtProdq L1 -channel-type.ferroamp.ehub-wextprodq-l2.label = EHUB, WExtProdq L2 -channel-type.ferroamp.ehub-wextprodq-l3.label = EHUB, WExtProdq L3 -channel-type.ferroamp.ehub-wextprodq_3p.label = EHUB, WExtProdq_3p -channel-type.ferroamp.ehub-winvconsq-l1.label = EHUB, WInvConsq L1 -channel-type.ferroamp.ehub-winvconsq-l2.label = EHUB, WInvConsq L2 -channel-type.ferroamp.ehub-winvconsq-l3.label = EHUB, WInvConsq L3 -channel-type.ferroamp.ehub-winvconsq_3p.label = EHUB, WInvConsq_3p -channel-type.ferroamp.ehub-winvprodq-l1.label = EHUB, WInvProdq L1 -channel-type.ferroamp.ehub-winvprodq-l2.label = EHUB, WInvProdq L2 -channel-type.ferroamp.ehub-winvprodq-l3.label = EHUB, WInvProdq L3 -channel-type.ferroamp.ehub-winvprodq_3p.label = EHUB, WInvProdq_3p -channel-type.ferroamp.ehub-wloadconsq-l1.label = EHUB, WLoadConsq L1 -channel-type.ferroamp.ehub-wloadconsq-l2.label = EHUB, WLoadConsq L2 -channel-type.ferroamp.ehub-wloadconsq-l3.label = EHUB, WLoadConsq L3 -channel-type.ferroamp.ehub-wloadconsq_3p.label = EHUB, WLoadConsq_3p -channel-type.ferroamp.ehub-wloadprodq-l1.label = EHUB, WLoadProdq L1 -channel-type.ferroamp.ehub-wloadprodq-l2.label = EHUB, WLoadProdq L2 -channel-type.ferroamp.ehub-wloadprodq-l3.label = EHUB, WLoadProdq L3 -channel-type.ferroamp.ehub-wloadprodq_3p.label = EHUB, WLoadProdq_3p -channel-type.ferroamp.ehub-wpbatcons.label = EHUB, Consumed Power Batteries -channel-type.ferroamp.ehub-wpbatcons.description = Only sent when system has batteries -channel-type.ferroamp.ehub-wpv.label = EHUB, PV Power -channel-type.ferroamp.ehub-wpv.description = Only sent when system has pv -channel-type.ferroamp.esm-id.label = ESM, Unique Identifier Of Battery. -channel-type.ferroamp.esm-id.description = Unique identifier of battery. If available, this will be the unique id that the battery reports. -channel-type.ferroamp.esm-rated-capacity.label = ESM, Rated Capacity Of Battery -channel-type.ferroamp.esm-rated-capacity.description = Rated capacity of battery -channel-type.ferroamp.esm-rated-power.label = ESM, Rated Power Of Battery -channel-type.ferroamp.esm-rated-power.description = Rated power of battery -channel-type.ferroamp.esm-soc.label = ESM, Soc -channel-type.ferroamp.esm-soc.description = State of charge for the ESM -channel-type.ferroamp.esm-soh.label = ESM, Soh -channel-type.ferroamp.esm-soh.description = State of health for the ESM -channel-type.ferroamp.esm-status.label = ESM, Battery Status -channel-type.ferroamp.esm-status.description = Dependent on battery manufacturer -channel-type.ferroamp.esm-ts.label = ESM, Time Stamp -channel-type.ferroamp.esm-ts.description = Time stamp when message was published -channel-type.ferroamp.eso-faultcode.label = ESO, Fault Code -channel-type.ferroamp.eso-faultcode.description = See section 4.1.3.1 below for further explanation of fault codes -channel-type.ferroamp.eso-ibat.label = ESO, Current On Battery Side -channel-type.ferroamp.eso-ibat.description = Measured on battery side -channel-type.ferroamp.eso-id.label = ESO, Unique Identifier -channel-type.ferroamp.eso-id.description = Unique identifier -channel-type.ferroamp.eso-relaystatus.label = ESO, Relay Status -channel-type.ferroamp.eso-relaystatus.description = 0 = relay closed, 1 = relay open -channel-type.ferroamp.eso-soc.label = ESO, Soc -channel-type.ferroamp.eso-soc.description = State of charge for ESO -channel-type.ferroamp.eso-temp.label = ESO, Temperature -channel-type.ferroamp.eso-temp.description = Temperature measured inside ESO -channel-type.ferroamp.eso-ts.label = ESO, Time stamp -channel-type.ferroamp.eso-ts.description = Time stamp when message was published -channel-type.ferroamp.eso-ubat.label = ESO, Voltage On Battery Side -channel-type.ferroamp.eso-ubat.description = Measured on battery side -channel-type.ferroamp.eso-udc.label = ESO, DC Link Voltage -channel-type.ferroamp.eso-udc.description = Dc link voltage as measured by ESO -channel-type.ferroamp.eso-wbatprod.label = ESO, Total Energy Produced -channel-type.ferroamp.eso-wbatprod.description = Total energy produced by ESO, i.e total energy discharged -channel-type.ferroamp.eso-wpbatcons.label = ESO, Total Energy Consumed -channel-type.ferroamp.eso-wpbatcons.description = Total energy consumed by ESO, i.e total energy charged -channel-type.ferroamp.request-auto.label = Configure Auto Power -channel-type.ferroamp.request-auto.description = Set auto power -channel-type.ferroamp.request-charge.label = Configure Charge Power -channel-type.ferroamp.request-charge.description = Charge power in watt -channel-type.ferroamp.request-discharge.label = Configure Discharge Power -channel-type.ferroamp.request-discharge.description = Discharge power in watt -channel-type.ferroamp.ssos0-faultcode.label = SSO, String-0, Fault Code -channel-type.ferroamp.ssos0-faultcode.description = 0x00 = OK, For all other values please contact Ferroamp support -channel-type.ferroamp.ssos0-id.label = SSO, String-0, Unique Identifier -channel-type.ferroamp.ssos0-id.description = Unique identifier of SSO -channel-type.ferroamp.ssos0-ipv.label = SSO, String-0, Current On PV String Side -channel-type.ferroamp.ssos0-ipv.description = Measured on pv string side -channel-type.ferroamp.ssos0-relaystatus.label = SSO, String-0, Relay Status -channel-type.ferroamp.ssos0-relaystatus.description = 0 = relay closed (i.e running power), 1 = relay open/disconnected, 2 = precharge -channel-type.ferroamp.ssos0-temp.label = SSO, String-0, Temperature -channel-type.ferroamp.ssos0-temp.description = Temperature measured on pcb of SSO -channel-type.ferroamp.ssos0-ts.label = SSO, String-0, Time Stamp -channel-type.ferroamp.ssos0-ts.description = Time stamp when message was published -channel-type.ferroamp.ssos0-udc.label = SSO, String-0, DC Link Voltage -channel-type.ferroamp.ssos0-udc.description = Dc link voltage as measured by SSO -channel-type.ferroamp.ssos0-upv.label = SSO, String-0, Voltage On PV String Side -channel-type.ferroamp.ssos0-upv.description = Measured on pv string side -channel-type.ferroamp.ssos0-wpv.label = SSO, String-0, Total Energy Produced -channel-type.ferroamp.ssos0-wpv.description = Total energy produced by SSO -channel-type.ferroamp.ssos1-faultcode.label = SSO, String-1, Fault Code -channel-type.ferroamp.ssos1-faultcode.description = 0x00 = OK, For all other values please contact Ferroamp support -channel-type.ferroamp.ssos1-id.label = SSO, String-1, Unique Identifier -channel-type.ferroamp.ssos1-id.description = Unique identifier of SSO -channel-type.ferroamp.ssos1-ipv.label = SSO, String-1, Current On PV String Side -channel-type.ferroamp.ssos1-ipv.description = Measured on pv string side -channel-type.ferroamp.ssos1-relaystatus.label = SSO, String-1, Relay Status -channel-type.ferroamp.ssos1-relaystatus.description = 0 = relay closed (i.e running power), 1 = relay open/disconnected, 2 = precharge -channel-type.ferroamp.ssos1-temp.label = SSO, String-1, Temperature -channel-type.ferroamp.ssos1-temp.description = Temperature measured on pcb of SSO -channel-type.ferroamp.ssos1-ts.label = SSO, String-1, Time Stamp -channel-type.ferroamp.ssos1-ts.description = Time stamp when message was published -channel-type.ferroamp.ssos1-udc.label = SSO, String-1, DC Link Voltage -channel-type.ferroamp.ssos1-udc.description = Dc link voltage as measured by SSO -channel-type.ferroamp.ssos1-upv.label = SSO, String-1, Voltage On PV String Side -channel-type.ferroamp.ssos1-upv.description = Measured on pv string side -channel-type.ferroamp.ssos1-wpv.label = SSO, String-1, Total Energy Produced -channel-type.ferroamp.ssos1-wpv.description = Total energy produced by SSO -channel-type.ferroamp.ssos2-faultcode.label = SSO, String-2, Fault Code -channel-type.ferroamp.ssos2-faultcode.description = 0x00 = OK, For all other values please contact Ferroamp support -channel-type.ferroamp.ssos2-id.label = SSO, String-2, Unique Identifier -channel-type.ferroamp.ssos2-id.description = Unique identifier of SSO -channel-type.ferroamp.ssos2-ipv.label = SSO, String-2, Current On PV String Side -channel-type.ferroamp.ssos2-ipv.description = Measured on pv string side -channel-type.ferroamp.ssos2-relaystatus.label = SSO, String-2, Relay Status -channel-type.ferroamp.ssos2-relaystatus.description = 0 = relay closed (i.e running power), 1 = relay open/disconnected, 2 = precharge -channel-type.ferroamp.ssos2-temp.label = SSO, String-2, Temperature -channel-type.ferroamp.ssos2-temp.description = Temperature measured on pcb of SSO -channel-type.ferroamp.ssos2-ts.label = SSO, String-2, Time Stamp -channel-type.ferroamp.ssos2-ts.description = Time stamp when message was published -channel-type.ferroamp.ssos2-udc.label = SSO, String-2, DC Link Voltage -channel-type.ferroamp.ssos2-udc.description = Dc link voltage as measured by SSO -channel-type.ferroamp.ssos2-upv.label = SSO, String-2, Voltage On PV String Side -channel-type.ferroamp.ssos2-upv.description = Measured on pv string side -channel-type.ferroamp.ssos2-wpv.label = SSO, String-2, Total Energy Produced -channel-type.ferroamp.ssos2-wpv.description = Total energy produced by SSO -channel-type.ferroamp.ssos3-faultcode.label = SSO, String-3, Fault Code -channel-type.ferroamp.ssos3-faultcode.description = 0x00 = OK, For all other values please contact Ferroamp support -channel-type.ferroamp.ssos3-id.label = SSO, String-3, Unique Identifier -channel-type.ferroamp.ssos3-id.description = Unique identifier of SSO -channel-type.ferroamp.ssos3-ipv.label = SSO, String-3, Current On PV String Side -channel-type.ferroamp.ssos3-ipv.description = Measured on pv string side -channel-type.ferroamp.ssos3-relaystatus.label = SSO, String-3, Relay Status -channel-type.ferroamp.ssos3-relaystatus.description = 0 = relay closed (i.e running power), 1 = relay open/disconnected, 2 = precharge -channel-type.ferroamp.ssos3-temp.label = SSO, String-3, Temperature -channel-type.ferroamp.ssos3-temp.description = Temperature measured on pcb of SSO -channel-type.ferroamp.ssos3-ts.label = SSO, String-3, Time Stamp -channel-type.ferroamp.ssos3-ts.description = Time stamp when message was published -channel-type.ferroamp.ssos3-udc.label = SSO, String-3, DC Link Voltage -channel-type.ferroamp.ssos3-udc.description = Dc link voltage as measured by SSO -channel-type.ferroamp.ssos3-upv.label = SSO, String-3, Voltage On PV String Side -channel-type.ferroamp.ssos3-upv.description = Measured on pv string side -channel-type.ferroamp.ssos3-wpv.label = SSO, String-3, Total Energy Produced -channel-type.ferroamp.ssos3-wpv.description = Total energy produced by SSO diff --git a/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/thing-types.xml b/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/thing-types.xml index 4b33d693ea5c9..9b72e538add65 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/thing-types.xml +++ b/bundles/org.openhab.binding.ferroamp/src/main/resources/OH-INF/thing/thing-types.xml @@ -461,16 +461,6 @@ Has the system a battery connected? false - - - Has the system an Eso unit connected? - false - - - - Has the system an Esm unit connected? - false - From eb9a50e953bdee9f1960ad2328c7fae034e72ece Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96rjan=20Backsell?= Date: Tue, 26 Nov 2024 12:10:59 +0100 Subject: [PATCH 15/16] [ferroamp] Binding for ferroamp 20241126 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes done in FerroampHandler.java Signed-off-by: Örjan Backsell --- .../binding/ferroamp/internal/FerroampHandler.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java index c47b20b4b6cb6..82534487bec83 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java @@ -84,6 +84,7 @@ public void handleCommand(ChannelUID channelUID, Command command) { public void initialize() { // Set configuration parameters ferroampConfig = getConfigAs(FerroampConfiguration.class); + // Set channel configuration parameters channelConfigEhub = FerroampChannelConfiguration.getChannelConfigurationEhub(); channelConfigSsoS1 = FerroampChannelConfiguration.getChannelConfigurationSsoS1(); @@ -93,13 +94,11 @@ public void initialize() { channelConfigEso = FerroampChannelConfiguration.getChannelConfigurationEso(); channelConfigEsm = FerroampChannelConfiguration.getChannelConfigurationEsm(); - if (ferroampConfig != null && channelConfigEhub != null && channelConfigSsoS1 != null - && channelConfigSsoS2 != null && channelConfigSsoS3 != null && channelConfigSsoS4 != null - && channelConfigEso != null && channelConfigEsm != null) { + if (ferroampConfig != null) { + FerroampConfiguration ferroampConfig = getConfigAs(FerroampConfiguration.class); final MqttBrokerConnection ferroampConnection = new MqttBrokerConnection(ferroampConfig.hostName, FerroampBindingConstants.BROKER_PORT, false, false, ferroampConfig.userName); - scheduler.scheduleWithFixedDelay(this::pollTask, 60, refreshInterval, TimeUnit.SECONDS); this.setFerroampConnection(ferroampConnection); updateStatus(ThingStatus.UNKNOWN); @@ -111,7 +110,7 @@ public void initialize() { private void pollTask() { try { - startMqttConnection(); + startMqttConnection(getConfigAs(FerroampConfiguration.class)); } catch (InterruptedException e) { logger.debug("Not connected to the MqttBroker"); return; @@ -134,7 +133,7 @@ private void pollTask() { } } - private void startMqttConnection() throws InterruptedException { + private void startMqttConnection(FerroampConfiguration ferroampConfig) throws InterruptedException { MqttBrokerConnection localSubscribeConnection = FerroampHandler.getFerroampConnection(); From 07947b6e5c42118ca7bf0e437311760178b5b951 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96rjan=20Backsell?= Date: Thu, 28 Nov 2024 12:13:19 +0100 Subject: [PATCH 16/16] [ferroamp] Binding for ferroamp 20241128 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes done in: FerroampHandler.java FerroampMqttCommunication.java Signed-off-by: Örjan Backsell --- .../ferroamp/internal/FerroampHandler.java | 21 +- .../internal/FerroampMqttCommunication.java | 1048 ++++++++++------- 2 files changed, 598 insertions(+), 471 deletions(-) diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java index 82534487bec83..5ff5215dc293e 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampHandler.java @@ -44,7 +44,7 @@ public class FerroampHandler extends BaseThingHandler implements MqttMessageSubs private final static Logger logger = LoggerFactory.getLogger(FerroampHandler.class); private @Nullable static MqttBrokerConnection ferroampConnection; FerroampMqttCommunication ferroampMqttCommunication = new FerroampMqttCommunication(thing); - private @Nullable FerroampConfiguration ferroampConfig; + FerroampConfiguration ferroampConfig = new FerroampConfiguration(); private static List channelConfigEhub = new ArrayList<>(); private static List channelConfigSsoS1 = new ArrayList<>(); @@ -94,18 +94,12 @@ public void initialize() { channelConfigEso = FerroampChannelConfiguration.getChannelConfigurationEso(); channelConfigEsm = FerroampChannelConfiguration.getChannelConfigurationEsm(); - if (ferroampConfig != null) { - - FerroampConfiguration ferroampConfig = getConfigAs(FerroampConfiguration.class); - final MqttBrokerConnection ferroampConnection = new MqttBrokerConnection(ferroampConfig.hostName, - FerroampBindingConstants.BROKER_PORT, false, false, ferroampConfig.userName); - scheduler.scheduleWithFixedDelay(this::pollTask, 60, refreshInterval, TimeUnit.SECONDS); - this.setFerroampConnection(ferroampConnection); - updateStatus(ThingStatus.UNKNOWN); - } else { - updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR); - logger.debug("Configuration problems"); - } + FerroampConfiguration ferroampConfig = getConfigAs(FerroampConfiguration.class); + final MqttBrokerConnection ferroampConnection = new MqttBrokerConnection(ferroampConfig.hostName, + FerroampBindingConstants.BROKER_PORT, false, false, ferroampConfig.userName); + scheduler.scheduleWithFixedDelay(this::pollTask, 60, refreshInterval, TimeUnit.SECONDS); + this.setFerroampConnection(ferroampConnection); + updateStatus(ThingStatus.UNKNOWN); } private void pollTask() { @@ -244,7 +238,6 @@ public void processMessage(String topic, byte[] payload) { public @Nullable static MqttBrokerConnection getFerroampConnection() { try { - return ferroampConnection; } catch (Exception e) { logger.debug("Connection to MqttBroker disturbed during startup of MqttConnection"); diff --git a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampMqttCommunication.java b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampMqttCommunication.java index 8b580dd6ec6ab..664d82decbcc6 100644 --- a/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampMqttCommunication.java +++ b/bundles/org.openhab.binding.ferroamp/src/main/java/org/openhab/binding/ferroamp/internal/FerroampMqttCommunication.java @@ -15,6 +15,7 @@ import java.nio.charset.StandardCharsets; import java.util.Objects; +import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.binding.ferroamp.dto.GetGeneralLx; import org.openhab.binding.ferroamp.dto.GetGeneralValues; @@ -34,7 +35,7 @@ * @author Örjan Backsell - Initial contribution * */ - +@NonNullByDefault public class FerroampMqttCommunication implements MqttMessageSubscriber { static String[] ehubChannelsUpdateValues = new String[0]; @@ -123,230 +124,293 @@ void processIncomingJsonMessageEhub(String topic, String messageJsonEhub) { // gridfreq jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(0)).toString(); - GetGeneralValues gridfreq = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - - ehubChannelPostsValue[0] = gridfreq.getVal(); + GetGeneralValues gridfreq = new GetGeneralValues(); + gridfreq = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + if (gridfreq != null) { + ehubChannelPostsValue[0] = gridfreq.getVal(); + } // iace jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(1)).toString(); - GetGeneralLx iace = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); - ehubChannelPostsValue[1] = iace.getL1(); - ehubChannelPostsValue[2] = iace.getL2(); - ehubChannelPostsValue[3] = iace.getL3(); + GetGeneralLx iace = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + if (iace != null) { + ehubChannelPostsValue[1] = iace.getL1(); + ehubChannelPostsValue[2] = iace.getL2(); + ehubChannelPostsValue[3] = iace.getL3(); + } // ul jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(2)).toString(); - GetGeneralLx ul = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); - ehubChannelPostsValue[4] = ul.getL1(); - ehubChannelPostsValue[5] = ul.getL2(); - ehubChannelPostsValue[6] = ul.getL3(); + GetGeneralLx ul = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + if (ul != null) { + ehubChannelPostsValue[4] = ul.getL1(); + ehubChannelPostsValue[5] = ul.getL2(); + ehubChannelPostsValue[6] = ul.getL3(); + } // il jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(3)).toString(); - GetGeneralLx il = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); - ehubChannelPostsValue[7] = il.getL1(); - ehubChannelPostsValue[8] = il.getL2(); - ehubChannelPostsValue[9] = il.getL3(); + GetGeneralLx il = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + if (il != null) { + ehubChannelPostsValue[7] = il.getL1(); + ehubChannelPostsValue[8] = il.getL2(); + ehubChannelPostsValue[9] = il.getL3(); + } // ild jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(4)).toString(); - GetGeneralLx ild = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); - ehubChannelPostsValue[10] = ild.getL1(); - ehubChannelPostsValue[11] = ild.getL2(); - ehubChannelPostsValue[12] = ild.getL3(); + GetGeneralLx ild = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + if (ild != null) { + ehubChannelPostsValue[10] = ild.getL1(); + ehubChannelPostsValue[11] = ild.getL2(); + ehubChannelPostsValue[12] = ild.getL3(); + } // ilq jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(5)).toString(); - GetGeneralLx ilq = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); - ehubChannelPostsValue[13] = ilq.getL1(); - ehubChannelPostsValue[14] = ilq.getL2(); - ehubChannelPostsValue[15] = ilq.getL3(); + GetGeneralLx ilq = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + if (ilq != null) { + + ehubChannelPostsValue[13] = ilq.getL1(); + ehubChannelPostsValue[14] = ilq.getL2(); + ehubChannelPostsValue[15] = ilq.getL3(); + } // iext jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(6)).toString(); - GetGeneralLx iext = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); - ehubChannelPostsValue[16] = iext.getL1(); - ehubChannelPostsValue[17] = iext.getL2(); - ehubChannelPostsValue[18] = iext.getL3(); + GetGeneralLx iext = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + if (iext != null) { + ehubChannelPostsValue[16] = iext.getL1(); + ehubChannelPostsValue[17] = iext.getL2(); + ehubChannelPostsValue[18] = iext.getL3(); + } // iextd jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(7)).toString(); - GetGeneralLx iextd = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); - ehubChannelPostsValue[19] = iextd.getL1(); - ehubChannelPostsValue[20] = iextd.getL2(); - ehubChannelPostsValue[21] = iextd.getL3(); + GetGeneralLx iextd = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + if (iextd != null) { + ehubChannelPostsValue[19] = iextd.getL1(); + ehubChannelPostsValue[20] = iextd.getL2(); + ehubChannelPostsValue[21] = iextd.getL3(); + } // iextq jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(8)).toString(); - GetGeneralLx iextq = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); - ehubChannelPostsValue[22] = iextq.getL1(); - ehubChannelPostsValue[23] = iextq.getL2(); - ehubChannelPostsValue[24] = iextq.getL3(); + GetGeneralLx iextq = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + if (iextq != null) { + ehubChannelPostsValue[22] = iextq.getL1(); + ehubChannelPostsValue[23] = iextq.getL2(); + ehubChannelPostsValue[24] = iextq.getL3(); + } // iloadd jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(9)).toString(); - GetGeneralLx iloadd = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); - ehubChannelPostsValue[25] = iloadd.getL1(); - ehubChannelPostsValue[26] = iloadd.getL2(); - ehubChannelPostsValue[27] = iloadd.getL3(); + GetGeneralLx iloadd = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + if (iloadd != null) { + ehubChannelPostsValue[25] = iloadd.getL1(); + ehubChannelPostsValue[26] = iloadd.getL2(); + ehubChannelPostsValue[27] = iloadd.getL3(); + } // iloadq jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(10)).toString(); - GetGeneralLx iloadq = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); - ehubChannelPostsValue[28] = iloadq.getL1(); - ehubChannelPostsValue[29] = iloadq.getL2(); - ehubChannelPostsValue[30] = iloadq.getL3(); + GetGeneralLx iloadq = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + if (iloadq != null) { + ehubChannelPostsValue[28] = iloadq.getL1(); + ehubChannelPostsValue[29] = iloadq.getL2(); + ehubChannelPostsValue[30] = iloadq.getL3(); + } // sext jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(11)).toString(); - GetGeneralValues sext = checkNullGeneralValues(gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - ehubChannelPostsValue[31] = sext.getVal(); + GetGeneralValues sext = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + if (sext != null) { + ehubChannelPostsValue[31] = sext.getVal(); + } // pext jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(12)).toString(); - GetGeneralLx pext = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); - ehubChannelPostsValue[32] = pext.getL1(); - ehubChannelPostsValue[33] = pext.getL2(); - ehubChannelPostsValue[34] = pext.getL3(); + GetGeneralLx pext = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + if (pext != null) { + ehubChannelPostsValue[32] = pext.getL1(); + ehubChannelPostsValue[33] = pext.getL2(); + ehubChannelPostsValue[34] = pext.getL3(); + } // pextreactive jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(13)).toString(); - GetGeneralLx pextreactive = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); - ehubChannelPostsValue[35] = pextreactive.getL1(); - ehubChannelPostsValue[36] = pextreactive.getL2(); - ehubChannelPostsValue[37] = pextreactive.getL3(); + GetGeneralLx pextreactive = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + if (pextreactive != null) { + ehubChannelPostsValue[35] = pextreactive.getL1(); + ehubChannelPostsValue[36] = pextreactive.getL2(); + ehubChannelPostsValue[37] = pextreactive.getL3(); + } // pinv jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(14)).toString(); - GetGeneralLx pinv = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); - ehubChannelPostsValue[38] = pinv.getL1(); - ehubChannelPostsValue[39] = pinv.getL2(); - ehubChannelPostsValue[40] = pinv.getL3(); + GetGeneralLx pinv = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + if (pinv != null) { + ehubChannelPostsValue[38] = pinv.getL1(); + ehubChannelPostsValue[39] = pinv.getL2(); + ehubChannelPostsValue[40] = pinv.getL3(); + } // pinvreactive jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(15)).toString(); - GetGeneralLx pinvreactive = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); - ehubChannelPostsValue[41] = pinvreactive.getL1(); - ehubChannelPostsValue[42] = pinvreactive.getL2(); - ehubChannelPostsValue[43] = pinvreactive.getL3(); + GetGeneralLx pinvreactive = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + if (pinvreactive != null) { + ehubChannelPostsValue[41] = pinvreactive.getL1(); + ehubChannelPostsValue[42] = pinvreactive.getL2(); + ehubChannelPostsValue[43] = pinvreactive.getL3(); + } // pload jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(16)).toString(); - GetGeneralLx pload = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); - ehubChannelPostsValue[44] = pload.getL1(); - ehubChannelPostsValue[45] = pload.getL2(); - ehubChannelPostsValue[46] = pload.getL3(); + GetGeneralLx pload = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + if (pload != null) { + ehubChannelPostsValue[44] = pload.getL1(); + ehubChannelPostsValue[45] = pload.getL2(); + ehubChannelPostsValue[46] = pload.getL3(); + } // ploadreactive jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(17)).toString(); - GetGeneralLx ploadreactive = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); - ehubChannelPostsValue[47] = ploadreactive.getL1(); - ehubChannelPostsValue[48] = ploadreactive.getL2(); - ehubChannelPostsValue[49] = ploadreactive.getL3(); + GetGeneralLx ploadreactive = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + if (ploadreactive != null) { + ehubChannelPostsValue[47] = ploadreactive.getL1(); + ehubChannelPostsValue[48] = ploadreactive.getL2(); + ehubChannelPostsValue[49] = ploadreactive.getL3(); + } // ppv jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(18)).toString(); - GetGeneralValues ppv = checkNullGeneralValues(gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); + GetGeneralValues ppv = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(19)).toString(); - GetUdc udc = checkNullUdc(gson.fromJson(jsonElementsStringTemp, GetUdc.class)); - ehubChannelPostsValue[50] = ppv.getVal(); - ehubChannelPostsValue[51] = udc.getPos(); - ehubChannelPostsValue[52] = udc.getNeg(); + GetUdc udc = gson.fromJson(jsonElementsStringTemp, GetUdc.class); + if (ppv != null) { + ehubChannelPostsValue[50] = ppv.getVal(); + } + if (udc != null) { + ehubChannelPostsValue[51] = udc.getPos(); + ehubChannelPostsValue[52] = udc.getNeg(); + } // wextprodq jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(20)).toString(); - GetGeneralLx wextprodq = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); - ehubChannelPostsValue[53] = mJTokWh(jsonStripEhub(wextprodq.getL1())); - ehubChannelPostsValue[54] = mJTokWh(jsonStripEhub(wextprodq.getL2())); - ehubChannelPostsValue[55] = mJTokWh(jsonStripEhub(wextprodq.getL3())); + GetGeneralLx wextprodq = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + if (wextprodq != null) { + ehubChannelPostsValue[53] = mJTokWh(jsonStripEhub(wextprodq.getL1())); + ehubChannelPostsValue[54] = mJTokWh(jsonStripEhub(wextprodq.getL2())); + ehubChannelPostsValue[55] = mJTokWh(jsonStripEhub(wextprodq.getL3())); + } // wextconsq jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(21)).toString(); - GetGeneralLx wextconsq = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); - ehubChannelPostsValue[56] = mJTokWh(jsonStripEhub(wextconsq.getL1())); - ehubChannelPostsValue[57] = mJTokWh(jsonStripEhub(wextconsq.getL2())); - ehubChannelPostsValue[58] = mJTokWh(jsonStripEhub(wextconsq.getL3())); + GetGeneralLx wextconsq = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + if (wextconsq != null) { + ehubChannelPostsValue[56] = mJTokWh(jsonStripEhub(wextconsq.getL1())); + ehubChannelPostsValue[57] = mJTokWh(jsonStripEhub(wextconsq.getL2())); + ehubChannelPostsValue[58] = mJTokWh(jsonStripEhub(wextconsq.getL3())); + } // winvprodq jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(22)).toString(); - GetGeneralLx winvprodq = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); - ehubChannelPostsValue[59] = mJTokWh(jsonStripEhub(winvprodq.getL1())); - ehubChannelPostsValue[60] = mJTokWh(jsonStripEhub(winvprodq.getL2())); - ehubChannelPostsValue[61] = mJTokWh(jsonStripEhub(winvprodq.getL3())); + GetGeneralLx winvprodq = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + if (winvprodq != null) { + ehubChannelPostsValue[59] = mJTokWh(jsonStripEhub(winvprodq.getL1())); + ehubChannelPostsValue[60] = mJTokWh(jsonStripEhub(winvprodq.getL2())); + ehubChannelPostsValue[61] = mJTokWh(jsonStripEhub(winvprodq.getL3())); + } // winvconsq jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(23)).toString(); - GetGeneralLx winvconsq = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); - ehubChannelPostsValue[62] = mJTokWh(jsonStripEhub(winvconsq.getL1())); - ehubChannelPostsValue[63] = mJTokWh(jsonStripEhub(winvconsq.getL2())); - ehubChannelPostsValue[64] = mJTokWh(jsonStripEhub(winvconsq.getL3())); + GetGeneralLx winvconsq = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + if (winvconsq != null) { + ehubChannelPostsValue[62] = mJTokWh(jsonStripEhub(winvconsq.getL1())); + ehubChannelPostsValue[63] = mJTokWh(jsonStripEhub(winvconsq.getL2())); + ehubChannelPostsValue[64] = mJTokWh(jsonStripEhub(winvconsq.getL3())); + } // wloadprodq jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(24)).toString(); - GetGeneralLx wloadprodq = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); - ehubChannelPostsValue[65] = mJTokWh(jsonStripEhub(wloadprodq.getL1())); - ehubChannelPostsValue[66] = mJTokWh(jsonStripEhub(wloadprodq.getL2())); - ehubChannelPostsValue[67] = mJTokWh(jsonStripEhub(wloadprodq.getL3())); + GetGeneralLx wloadprodq = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + if (wloadprodq != null) { + ehubChannelPostsValue[65] = mJTokWh(jsonStripEhub(wloadprodq.getL1())); + ehubChannelPostsValue[66] = mJTokWh(jsonStripEhub(wloadprodq.getL2())); + ehubChannelPostsValue[67] = mJTokWh(jsonStripEhub(wloadprodq.getL3())); + } // wloadconsq jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(25)).toString(); - GetGeneralLx wloadconsq = checkNullGeneralLx(gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class)); - ehubChannelPostsValue[68] = mJTokWh(jsonStripEhub(wloadconsq.getL1())); - ehubChannelPostsValue[69] = mJTokWh(jsonStripEhub(wloadconsq.getL2())); - ehubChannelPostsValue[70] = mJTokWh(jsonStripEhub(wloadconsq.getL3())); + GetGeneralLx wloadconsq = gson.fromJson(jsonElementsStringTemp, GetGeneralLx.class); + if (wloadconsq != null) { + ehubChannelPostsValue[68] = mJTokWh(jsonStripEhub(wloadconsq.getL1())); + ehubChannelPostsValue[69] = mJTokWh(jsonStripEhub(wloadconsq.getL2())); + ehubChannelPostsValue[70] = mJTokWh(jsonStripEhub(wloadconsq.getL3())); + } // wextprodq_3p jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(26)).toString(); - GetGeneralValues wextprodq_3p = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - ehubChannelPostsValue[71] = mJTokWh(jsonStripOneLiners(wextprodq_3p.getVal())); + GetGeneralValues wextprodq3p = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + if (wextprodq3p != null) { + ehubChannelPostsValue[71] = mJTokWh(jsonStripOneLiners(wextprodq3p.getVal())); + } // wextconsq_3p jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(27)).toString(); - GetGeneralValues wextconsq3p = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - ehubChannelPostsValue[72] = mJTokWh(jsonStripOneLiners(wextconsq3p.getVal())); + GetGeneralValues wextconsq3p = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + if (wextconsq3p != null) { + ehubChannelPostsValue[72] = mJTokWh(jsonStripOneLiners(wextconsq3p.getVal())); + } // winvprodq_3p jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(28)).toString(); - GetGeneralValues winvprodq3p = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - ehubChannelPostsValue[73] = mJTokWh(jsonStripOneLiners(winvprodq3p.getVal())); + GetGeneralValues winvprodq3p = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + if (winvprodq3p != null) { + ehubChannelPostsValue[73] = mJTokWh(jsonStripOneLiners(winvprodq3p.getVal())); + } // winvconsq_3p jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(29)).toString(); - GetGeneralValues winvconsq3p = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - ehubChannelPostsValue[74] = mJTokWh(jsonStripOneLiners(winvconsq3p.getVal())); + GetGeneralValues winvconsq3p = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + if (winvconsq3p != null) { + ehubChannelPostsValue[74] = mJTokWh(jsonStripOneLiners(winvconsq3p.getVal())); + } // wloadprodq_3p jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(30)).toString(); - GetGeneralValues wloadprodq3p = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - ehubChannelPostsValue[75] = mJTokWh(jsonStripOneLiners(wloadprodq3p.getVal())); + GetGeneralValues wloadprodq3p = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + if (wloadprodq3p != null) { + ehubChannelPostsValue[75] = mJTokWh(jsonStripOneLiners(wloadprodq3p.getVal())); + } // wloadconsq_3p jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(31)).toString(); - GetGeneralValues wloadconsq3p = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - ehubChannelPostsValue[76] = mJTokWh(jsonStripOneLiners(wloadconsq3p.getVal())); + GetGeneralValues wloadconsq3p = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + if (wloadconsq3p != null) { + ehubChannelPostsValue[76] = mJTokWh(jsonStripOneLiners(wloadconsq3p.getVal())); + } // wpv jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(32)).toString(); - GetGeneralValues wpv = checkNullGeneralValues(gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - ehubChannelPostsValue[77] = mJTokWh(jsonStripOneLiners(wpv.getVal())); + GetGeneralValues wpv = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + if (wpv != null) { + ehubChannelPostsValue[77] = mJTokWh(jsonStripOneLiners(wpv.getVal())); + } // state jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(33)).toString(); - GetGeneralValues state = checkNullGeneralValues(gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - ehubChannelPostsValue[78] = jsonStripOneLiners(state.getVal()); + GetGeneralValues state = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + if (state != null) { + ehubChannelPostsValue[78] = jsonStripOneLiners(state.getVal()); + } // ts jsonElementsStringTemp = jsonElementsObject.get(EhubJsonElements.getJsonElementsEhub().get(34)).toString(); - GetGeneralValues ts = checkNullGeneralValues(gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - ehubChannelPostsValue[79] = ts.getVal(); - + GetGeneralValues ts = gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class); + if (ts != null) { + ehubChannelPostsValue[79] = ts.getVal(); + } ehubChannelsUpdateValues = ehubChannelPostsValue; } @@ -369,97 +433,110 @@ void processIncomingJsonMessageSso(String topic, String messageJsonSso) { Objects.requireNonNull(jsonElementsObjectSsoS1, "JsonObject jsonElementsObjectSsoS1 cannot be null"); jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(0)).toString(); - GetGeneralValues idS1 = checkNullGeneralValues(gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class)); - GetGeneralValues idSso = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class)); - - if (isSsoChecked == false) { - if (ssoS1IdCheck.isEmpty() && ssoS2IdCheck.isEmpty() && ssoS3IdCheck.isEmpty() && ssoS4IdCheck.isEmpty()) { - ssoS1IdCheck = idSso.getVal(); - } else { - if (!ssoS1IdCheck.isEmpty() && ssoS2IdCheck.isEmpty() && ssoS3IdCheck.isEmpty() + + GetGeneralValues idS1 = gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class); + GetGeneralValues idSso = gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class); + + if (idSso != null) { + if (isSsoChecked == false) { + if (ssoS1IdCheck.isEmpty() && ssoS2IdCheck.isEmpty() && ssoS3IdCheck.isEmpty() && ssoS4IdCheck.isEmpty()) { - ssoS2IdCheck = idSso.getVal(); - // isSsoChecked = true; + ssoS1IdCheck = idSso.getVal(); } else { - if (!ssoS1IdCheck.isEmpty() && !ssoS2IdCheck.isEmpty() && ssoS3IdCheck.isEmpty() + if (!ssoS1IdCheck.isEmpty() && ssoS2IdCheck.isEmpty() && ssoS3IdCheck.isEmpty() && ssoS4IdCheck.isEmpty()) { - ssoS3IdCheck = idSso.getVal(); + ssoS2IdCheck = idSso.getVal(); } else { - if (!ssoS1IdCheck.isEmpty() && !ssoS2IdCheck.isEmpty() && !ssoS3IdCheck.isEmpty() + if (!ssoS1IdCheck.isEmpty() && !ssoS2IdCheck.isEmpty() && ssoS3IdCheck.isEmpty() && ssoS4IdCheck.isEmpty()) { - ssoS4IdCheck = idSso.getVal(); - isSsoChecked = true; + ssoS3IdCheck = idSso.getVal(); + } else { + if (!ssoS1IdCheck.isEmpty() && !ssoS2IdCheck.isEmpty() && !ssoS3IdCheck.isEmpty() + && ssoS4IdCheck.isEmpty()) { + ssoS4IdCheck = idSso.getVal(); + isSsoChecked = true; + } } } } } } - if (idS1.getVal().equals(ssoS1IdCheck)) { - // id - jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(0)) - .toString(); - idS1 = checkNullGeneralValues(gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class)); - ssoS1ChannelPostsValue[0] = idS1.getVal(); - - // upv - jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(1)) - .toString(); - GetGeneralValues upvS1 = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class)); - ssoS1ChannelPostsValue[1] = upvS1.getVal(); + if (idS1 != null) { + if (idS1.getVal().equals(ssoS1IdCheck)) { + // id + jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(0)) + .toString(); + idS1 = gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class); + if (idS1 != null) { + ssoS1ChannelPostsValue[0] = idS1.getVal(); + } - // ipv - jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(2)) - .toString(); - GetGeneralValues ipvS1 = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class)); - ssoS1ChannelPostsValue[2] = ipvS1.getVal(); + // upv + jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(1)) + .toString(); + GetGeneralValues upvS1 = gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class); + if (upvS1 != null) { + ssoS1ChannelPostsValue[1] = upvS1.getVal(); + } - // wpv - jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(3)) - .toString(); - GetGeneralValues wpvS1 = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class)); - ssoS1ChannelPostsValue[3] = mJTokWh(jsonStripOneLiners(wpvS1.getVal())); + // ipv + jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(2)) + .toString(); + GetGeneralValues ipvS1 = gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class); + if (ipvS1 != null) { + ssoS1ChannelPostsValue[2] = ipvS1.getVal(); + } - // relaystatus - jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(4)) - .toString(); - GetGeneralValues relaystatusS1 = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class)); - ssoS1ChannelPostsValue[4] = relaystatusS1.getVal(); + // wpv + jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(3)) + .toString(); + GetGeneralValues wpvS1 = gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class); + if (wpvS1 != null) { + ssoS1ChannelPostsValue[3] = mJTokWh(jsonStripOneLiners(wpvS1.getVal())); + } - // temp - jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(5)) - .toString(); - GetGeneralValues tempS1 = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class)); - ssoS1ChannelPostsValue[5] = tempS1.getVal(); + // relaystatus + jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(4)) + .toString(); + GetGeneralValues relaystatusS1 = gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class); + if (relaystatusS1 != null) { + ssoS1ChannelPostsValue[4] = relaystatusS1.getVal(); + } - // faultcode - jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(6)) - .toString(); - GetGeneralValues faultcodeS1 = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class)); - ssoS1ChannelPostsValue[6] = faultcodeS1.getVal(); + // temp + jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(5)) + .toString(); + GetGeneralValues tempS1 = gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class); + if (tempS1 != null) { + ssoS1ChannelPostsValue[5] = tempS1.getVal(); + } - // udc - jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(7)) - .toString(); - GetGeneralValues udcS1 = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class)); - ssoS1ChannelPostsValue[7] = udcS1.getVal(); + // faultcode + jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(6)) + .toString(); + GetGeneralValues faultcodeS1 = gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class); + if (faultcodeS1 != null) { + ssoS1ChannelPostsValue[6] = faultcodeS1.getVal(); + } - // ts - jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(8)) - .toString(); - GetGeneralValues tsS1 = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class)); - ssoS1ChannelPostsValue[8] = tsS1.getVal(); + // udc + jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(7)) + .toString(); + GetGeneralValues udcS1 = gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class); + if (udcS1 != null) { + ssoS1ChannelPostsValue[7] = udcS1.getVal(); + } - ssoS1ChannelsUpdateValues = ssoS1ChannelPostsValue; + // ts + jsonElementsStringTempS1 = jsonElementsObjectSsoS1.get(SsoJsonElements.getJsonElementsSso().get(8)) + .toString(); + GetGeneralValues tsS1 = gson.fromJson(jsonElementsStringTempS1, GetGeneralValues.class); + if (tsS1 != null) { + ssoS1ChannelPostsValue[8] = tsS1.getVal(); + } + ssoS1ChannelsUpdateValues = ssoS1ChannelPostsValue; + } } JsonObject jsonElementsObjectSsoS2 = new Gson().fromJson(new Gson().fromJson(messageJsonSso, JsonObject.class), @@ -468,72 +545,83 @@ void processIncomingJsonMessageSso(String topic, String messageJsonSso) { Objects.requireNonNull(jsonElementsObjectSsoS2, "JsonObject jsonElementsObjectSsoS2 cannot be null"); jsonElementsStringTempS2 = jsonElementsObjectSsoS2.get(SsoJsonElements.getJsonElementsSso().get(0)).toString(); - GetGeneralValues idS2 = checkNullGeneralValues(gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class)); - - if (idS2.getVal().equals(ssoS2IdCheck)) { - // id - jsonElementsStringTempS2 = jsonElementsObjectSsoS2.get(SsoJsonElements.getJsonElementsSso().get(0)) - .toString(); - idS2 = checkNullGeneralValues(gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class)); - ssoS2ChannelPostsValue[0] = idS2.getVal(); - - // upv - jsonElementsStringTempS2 = jsonElementsObjectSsoS2.get(SsoJsonElements.getJsonElementsSso().get(1)) - .toString(); - GetGeneralValues upvS2 = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class)); - ssoS2ChannelPostsValue[1] = upvS2.getVal(); + GetGeneralValues idS2 = gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class); + + if (idS2 != null) { + if (idS2.getVal().equals(ssoS2IdCheck)) { + // id + jsonElementsStringTempS2 = jsonElementsObjectSsoS2.get(SsoJsonElements.getJsonElementsSso().get(0)) + .toString(); + idS2 = gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class); + if (idS2 != null) { + ssoS2ChannelPostsValue[0] = idS2.getVal(); + } - // ipv - jsonElementsStringTempS2 = jsonElementsObjectSsoS2.get(SsoJsonElements.getJsonElementsSso().get(2)) - .toString(); - GetGeneralValues ipvS2 = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class)); - ssoS2ChannelPostsValue[2] = ipvS2.getVal(); + // upv + jsonElementsStringTempS2 = jsonElementsObjectSsoS2.get(SsoJsonElements.getJsonElementsSso().get(1)) + .toString(); + GetGeneralValues upvS2 = gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class); + if (upvS2 != null) { + ssoS2ChannelPostsValue[1] = upvS2.getVal(); + } - // wpv - jsonElementsStringTempS2 = jsonElementsObjectSsoS2.get(SsoJsonElements.getJsonElementsSso().get(3)) - .toString(); - GetGeneralValues wpvS2 = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class)); - ssoS2ChannelPostsValue[3] = mJTokWh(jsonStripOneLiners(wpvS2.getVal())); + // ipv + jsonElementsStringTempS2 = jsonElementsObjectSsoS2.get(SsoJsonElements.getJsonElementsSso().get(2)) + .toString(); + GetGeneralValues ipvS2 = gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class); + if (ipvS2 != null) { + ssoS2ChannelPostsValue[2] = ipvS2.getVal(); + } - // relaystatus - jsonElementsStringTempS2 = jsonElementsObjectSsoS2.get(SsoJsonElements.getJsonElementsSso().get(4)) - .toString(); - GetGeneralValues relaystatusS2 = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class)); - ssoS2ChannelPostsValue[4] = relaystatusS2.getVal(); + // wpv + jsonElementsStringTempS2 = jsonElementsObjectSsoS2.get(SsoJsonElements.getJsonElementsSso().get(3)) + .toString(); + GetGeneralValues wpvS2 = gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class); + if (wpvS2 != null) { + ssoS2ChannelPostsValue[3] = mJTokWh(jsonStripOneLiners(wpvS2.getVal())); + } - // temp - jsonElementsStringTempS2 = jsonElementsObjectSsoS2.get(SsoJsonElements.getJsonElementsSso().get(5)) - .toString(); - GetGeneralValues tempS2 = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class)); - ssoS2ChannelPostsValue[5] = tempS2.getVal(); + // relaystatus + jsonElementsStringTempS2 = jsonElementsObjectSsoS2.get(SsoJsonElements.getJsonElementsSso().get(4)) + .toString(); + GetGeneralValues relaystatusS2 = gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class); + if (relaystatusS2 != null) { + ssoS2ChannelPostsValue[4] = relaystatusS2.getVal(); + } - // faultcode - jsonElementsStringTempS2 = jsonElementsObjectSsoS2.get(SsoJsonElements.getJsonElementsSso().get(6)) - .toString(); - GetGeneralValues faultcodeS2 = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class)); - ssoS2ChannelPostsValue[6] = faultcodeS2.getVal(); + // temp + jsonElementsStringTempS2 = jsonElementsObjectSsoS2.get(SsoJsonElements.getJsonElementsSso().get(5)) + .toString(); + GetGeneralValues tempS2 = gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class); + if (tempS2 != null) { + ssoS2ChannelPostsValue[5] = tempS2.getVal(); + } - // udc - jsonElementsStringTempS2 = jsonElementsObjectSsoS2.get(SsoJsonElements.getJsonElementsSso().get(7)) - .toString(); - GetGeneralValues udc = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class)); - ssoS2ChannelPostsValue[7] = udc.getVal(); + // faultcode + jsonElementsStringTempS2 = jsonElementsObjectSsoS2.get(SsoJsonElements.getJsonElementsSso().get(6)) + .toString(); + GetGeneralValues faultcodeS2 = gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class); + if (faultcodeS2 != null) { + ssoS2ChannelPostsValue[6] = faultcodeS2.getVal(); + } - // ts - jsonElementsStringTempS2 = jsonElementsObjectSsoS2.get(SsoJsonElements.getJsonElementsSso().get(8)) - .toString(); - GetGeneralValues tsS2 = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class)); - ssoS2ChannelPostsValue[8] = tsS2.getVal(); + // udc + jsonElementsStringTempS2 = jsonElementsObjectSsoS2.get(SsoJsonElements.getJsonElementsSso().get(7)) + .toString(); + GetGeneralValues udcS2 = gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class); + if (udcS2 != null) { + ssoS2ChannelPostsValue[7] = udcS2.getVal(); + } - ssoS2ChannelsUpdateValues = ssoS2ChannelPostsValue; + // ts + jsonElementsStringTempS2 = jsonElementsObjectSsoS2.get(SsoJsonElements.getJsonElementsSso().get(8)) + .toString(); + GetGeneralValues tsS2 = gson.fromJson(jsonElementsStringTempS2, GetGeneralValues.class); + if (tsS2 != null) { + ssoS2ChannelPostsValue[8] = tsS2.getVal(); + } + ssoS2ChannelsUpdateValues = ssoS2ChannelPostsValue; + } } JsonObject jsonElementsObjectSsoS3 = new Gson().fromJson(new Gson().fromJson(messageJsonSso, JsonObject.class), @@ -542,72 +630,83 @@ void processIncomingJsonMessageSso(String topic, String messageJsonSso) { Objects.requireNonNull(jsonElementsObjectSsoS3, "JsonObject jsonElementsObjectSsoS3 cannot be null"); jsonElementsStringTempS3 = jsonElementsObjectSsoS3.get(SsoJsonElements.getJsonElementsSso().get(0)).toString(); - GetGeneralValues idS3 = checkNullGeneralValues(gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class)); - - if (idS3.getVal().equals(ssoS3IdCheck)) { - // id - jsonElementsStringTempS3 = jsonElementsObjectSsoS3.get(SsoJsonElements.getJsonElementsSso().get(0)) - .toString(); - idS3 = checkNullGeneralValues(gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class)); - ssoS3ChannelPostsValue[0] = idS3.getVal(); - - // upv - jsonElementsStringTempS3 = jsonElementsObjectSsoS3.get(SsoJsonElements.getJsonElementsSso().get(1)) - .toString(); - GetGeneralValues upvS3 = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class)); - ssoS3ChannelPostsValue[1] = upvS3.getVal(); + GetGeneralValues idS3 = gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class); + + if (idS3 != null) { + if (idS3.getVal().equals(ssoS3IdCheck)) { + // id + jsonElementsStringTempS3 = jsonElementsObjectSsoS3.get(SsoJsonElements.getJsonElementsSso().get(0)) + .toString(); + idS3 = gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class); + if (idS3 != null) { + ssoS3ChannelPostsValue[0] = idS3.getVal(); + } - // ipv - jsonElementsStringTempS3 = jsonElementsObjectSsoS3.get(SsoJsonElements.getJsonElementsSso().get(2)) - .toString(); - GetGeneralValues ipvS3 = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class)); - ssoS3ChannelPostsValue[2] = ipvS3.getVal(); + // upv + jsonElementsStringTempS3 = jsonElementsObjectSsoS3.get(SsoJsonElements.getJsonElementsSso().get(1)) + .toString(); + GetGeneralValues upvS3 = gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class); + if (upvS3 != null) { + ssoS3ChannelPostsValue[1] = upvS3.getVal(); + } - // wpv - jsonElementsStringTempS3 = jsonElementsObjectSsoS3.get(SsoJsonElements.getJsonElementsSso().get(3)) - .toString(); - GetGeneralValues wpvS3 = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class)); - ssoS3ChannelPostsValue[3] = mJTokWh(jsonStripOneLiners(wpvS3.getVal())); + // ipv + jsonElementsStringTempS3 = jsonElementsObjectSsoS3.get(SsoJsonElements.getJsonElementsSso().get(2)) + .toString(); + GetGeneralValues ipvS3 = gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class); + if (ipvS3 != null) { + ssoS3ChannelPostsValue[2] = ipvS3.getVal(); + } - // relaystatus - jsonElementsStringTempS3 = jsonElementsObjectSsoS3.get(SsoJsonElements.getJsonElementsSso().get(4)) - .toString(); - GetGeneralValues relaystatusS3 = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class)); - ssoS3ChannelPostsValue[4] = relaystatusS3.getVal(); + // wpv + jsonElementsStringTempS3 = jsonElementsObjectSsoS3.get(SsoJsonElements.getJsonElementsSso().get(3)) + .toString(); + GetGeneralValues wpvS3 = gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class); + if (wpvS3 != null) { + ssoS3ChannelPostsValue[3] = mJTokWh(jsonStripOneLiners(wpvS3.getVal())); + } - // temp - jsonElementsStringTempS3 = jsonElementsObjectSsoS3.get(SsoJsonElements.getJsonElementsSso().get(5)) - .toString(); - GetGeneralValues tempS3 = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class)); - ssoS3ChannelPostsValue[5] = tempS3.getVal(); + // relaystatus + jsonElementsStringTempS3 = jsonElementsObjectSsoS3.get(SsoJsonElements.getJsonElementsSso().get(4)) + .toString(); + GetGeneralValues relaystatusS3 = gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class); + if (relaystatusS3 != null) { + ssoS3ChannelPostsValue[4] = relaystatusS3.getVal(); + } - // faultcode - jsonElementsStringTempS3 = jsonElementsObjectSsoS3.get(SsoJsonElements.getJsonElementsSso().get(6)) - .toString(); - GetGeneralValues faultcodeS3 = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class)); - ssoS3ChannelPostsValue[6] = faultcodeS3.getVal(); + // temp + jsonElementsStringTempS3 = jsonElementsObjectSsoS3.get(SsoJsonElements.getJsonElementsSso().get(5)) + .toString(); + GetGeneralValues tempS3 = gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class); + if (tempS3 != null) { + ssoS3ChannelPostsValue[5] = tempS3.getVal(); + } - // udc - jsonElementsStringTempS3 = jsonElementsObjectSsoS3.get(SsoJsonElements.getJsonElementsSso().get(7)) - .toString(); - GetGeneralValues udcS3 = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class)); - ssoS3ChannelPostsValue[7] = udcS3.getVal(); + // faultcode + jsonElementsStringTempS3 = jsonElementsObjectSsoS3.get(SsoJsonElements.getJsonElementsSso().get(6)) + .toString(); + GetGeneralValues faultcodeS3 = gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class); + if (faultcodeS3 != null) { + ssoS3ChannelPostsValue[6] = faultcodeS3.getVal(); + } - // ts - jsonElementsStringTempS3 = jsonElementsObjectSsoS3.get(SsoJsonElements.getJsonElementsSso().get(8)) - .toString(); - GetGeneralValues tsS3 = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class)); - ssoS3ChannelPostsValue[8] = tsS3.getVal(); + // udc + jsonElementsStringTempS3 = jsonElementsObjectSsoS3.get(SsoJsonElements.getJsonElementsSso().get(7)) + .toString(); + GetGeneralValues udcS3 = gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class); + if (udcS3 != null) { + ssoS3ChannelPostsValue[7] = udcS3.getVal(); + } - ssoS3ChannelsUpdateValues = ssoS3ChannelPostsValue; + // ts + jsonElementsStringTempS3 = jsonElementsObjectSsoS3.get(SsoJsonElements.getJsonElementsSso().get(8)) + .toString(); + GetGeneralValues tsS3 = gson.fromJson(jsonElementsStringTempS3, GetGeneralValues.class); + if (tsS3 != null) { + ssoS3ChannelPostsValue[8] = tsS3.getVal(); + } + ssoS3ChannelsUpdateValues = ssoS3ChannelPostsValue; + } } JsonObject jsonElementsObjectSsoS4 = new Gson().fromJson(new Gson().fromJson(messageJsonSso, JsonObject.class), @@ -616,72 +715,83 @@ void processIncomingJsonMessageSso(String topic, String messageJsonSso) { Objects.requireNonNull(jsonElementsObjectSsoS4, "JsonObject jsonElementsObjectSsoS4 cannot be null"); jsonElementsStringTempS4 = jsonElementsObjectSsoS4.get(SsoJsonElements.getJsonElementsSso().get(0)).toString(); - GetGeneralValues idS4 = checkNullGeneralValues(gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class)); - - if (idS4.getVal().equals(ssoS4IdCheck)) { - // id - jsonElementsStringTempS4 = jsonElementsObjectSsoS4.get(SsoJsonElements.getJsonElementsSso().get(0)) - .toString(); - idS4 = checkNullGeneralValues(gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class)); - ssoS4ChannelPostsValue[0] = idS4.getVal(); - - // upv - jsonElementsStringTempS4 = jsonElementsObjectSsoS4.get(SsoJsonElements.getJsonElementsSso().get(1)) - .toString(); - GetGeneralValues upvS4 = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class)); - ssoS4ChannelPostsValue[1] = upvS4.getVal(); + GetGeneralValues idS4 = gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class); + + if (idS4 != null) { + if (idS4.getVal().equals(ssoS4IdCheck)) { + // id + jsonElementsStringTempS4 = jsonElementsObjectSsoS4.get(SsoJsonElements.getJsonElementsSso().get(0)) + .toString(); + idS4 = gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class); + if (idS4 != null) { + ssoS4ChannelPostsValue[0] = idS4.getVal(); + } - // ipv - jsonElementsStringTempS4 = jsonElementsObjectSsoS4.get(SsoJsonElements.getJsonElementsSso().get(2)) - .toString(); - GetGeneralValues ipvS4 = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class)); - ssoS4ChannelPostsValue[2] = ipvS4.getVal(); + // upv + jsonElementsStringTempS4 = jsonElementsObjectSsoS4.get(SsoJsonElements.getJsonElementsSso().get(1)) + .toString(); + GetGeneralValues upvS4 = gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class); + if (upvS4 != null) { + ssoS4ChannelPostsValue[1] = upvS4.getVal(); + } - // wpv - jsonElementsStringTempS4 = jsonElementsObjectSsoS4.get(SsoJsonElements.getJsonElementsSso().get(3)) - .toString(); - GetGeneralValues wpvS4 = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class)); - ssoS4ChannelPostsValue[3] = mJTokWh(jsonStripOneLiners(wpvS4.getVal())); + // ipv + jsonElementsStringTempS4 = jsonElementsObjectSsoS4.get(SsoJsonElements.getJsonElementsSso().get(2)) + .toString(); + GetGeneralValues ipvS4 = gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class); + if (ipvS4 != null) { + ssoS4ChannelPostsValue[2] = ipvS4.getVal(); + } - // relaystatus - jsonElementsStringTempS4 = jsonElementsObjectSsoS4.get(SsoJsonElements.getJsonElementsSso().get(4)) - .toString(); - GetGeneralValues relaystatusS4 = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class)); - ssoS4ChannelPostsValue[4] = relaystatusS4.getVal(); + // wpv + jsonElementsStringTempS4 = jsonElementsObjectSsoS4.get(SsoJsonElements.getJsonElementsSso().get(3)) + .toString(); + GetGeneralValues wpvS4 = gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class); + if (wpvS4 != null) { + ssoS4ChannelPostsValue[3] = mJTokWh(jsonStripOneLiners(wpvS4.getVal())); + } - // temp - jsonElementsStringTempS4 = jsonElementsObjectSsoS4.get(SsoJsonElements.getJsonElementsSso().get(5)) - .toString(); - GetGeneralValues tempS4 = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class)); - ssoS4ChannelPostsValue[5] = tempS4.getVal(); + // relaystatus + jsonElementsStringTempS4 = jsonElementsObjectSsoS4.get(SsoJsonElements.getJsonElementsSso().get(4)) + .toString(); + GetGeneralValues relaystatusS4 = gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class); + if (relaystatusS4 != null) { + ssoS4ChannelPostsValue[4] = relaystatusS4.getVal(); + } - // faultcode - jsonElementsStringTempS4 = jsonElementsObjectSsoS4.get(SsoJsonElements.getJsonElementsSso().get(6)) - .toString(); - GetGeneralValues faultcode = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class)); - ssoS4ChannelPostsValue[6] = faultcode.getVal(); + // temp + jsonElementsStringTempS4 = jsonElementsObjectSsoS4.get(SsoJsonElements.getJsonElementsSso().get(5)) + .toString(); + GetGeneralValues tempS4 = gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class); + if (tempS4 != null) { + ssoS4ChannelPostsValue[5] = tempS4.getVal(); + } - // udc - jsonElementsStringTempS4 = jsonElementsObjectSsoS4.get(SsoJsonElements.getJsonElementsSso().get(7)) - .toString(); - GetGeneralValues udcS4 = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class)); - ssoS4ChannelPostsValue[7] = udcS4.getVal(); + // faultcode + jsonElementsStringTempS4 = jsonElementsObjectSsoS4.get(SsoJsonElements.getJsonElementsSso().get(6)) + .toString(); + GetGeneralValues faultcodeS4 = gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class); + if (faultcodeS4 != null) { + ssoS4ChannelPostsValue[6] = faultcodeS4.getVal(); + } - // ts - jsonElementsStringTempS4 = jsonElementsObjectSsoS4.get(SsoJsonElements.getJsonElementsSso().get(8)) - .toString(); - GetGeneralValues tsS4 = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class)); - ssoS4ChannelPostsValue[8] = tsS4.getVal(); + // udc + jsonElementsStringTempS4 = jsonElementsObjectSsoS4.get(SsoJsonElements.getJsonElementsSso().get(7)) + .toString(); + GetGeneralValues udcS4 = gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class); + if (udcS4 != null) { + ssoS4ChannelPostsValue[7] = udcS4.getVal(); + } - ssoS4ChannelsUpdateValues = ssoS4ChannelPostsValue; + // ts + jsonElementsStringTempS4 = jsonElementsObjectSsoS4.get(SsoJsonElements.getJsonElementsSso().get(8)) + .toString(); + GetGeneralValues tsS4 = gson.fromJson(jsonElementsStringTempS4, GetGeneralValues.class); + if (tsS4 != null) { + ssoS4ChannelPostsValue[8] = tsS4.getVal(); + } + ssoS4ChannelsUpdateValues = ssoS4ChannelPostsValue; + } } } @@ -693,73 +803,97 @@ void processIncomingJsonMessageEso(String topic, String messageJsonEso) { Objects.requireNonNull(jsonElementsObjectEso, "JsonObject jsonElementsObjectEso cannot be null"); - String jsonElementsStringTemp = ""; + String jsonElementsStringTempEso = ""; Gson gson = new Gson(); if (!jsonElementsObjectEso.isEmpty()) { // id - jsonElementsStringTemp = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(0)).toString(); - GetGeneralValues id = checkNullGeneralValues(gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - esoChannelPostsValue[0] = id.getVal(); + jsonElementsStringTempEso = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(0)) + .toString(); + GetGeneralValues idEso = gson.fromJson(jsonElementsStringTempEso, GetGeneralValues.class); + if (idEso != null) { + esoChannelPostsValue[0] = idEso.getVal(); + } // ubat - jsonElementsStringTemp = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(1)).toString(); - GetGeneralValues ubat = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - esoChannelPostsValue[1] = ubat.getVal(); + jsonElementsStringTempEso = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(1)) + .toString(); + GetGeneralValues ubatEso = gson.fromJson(jsonElementsStringTempEso, GetGeneralValues.class); + if (ubatEso != null) { + esoChannelPostsValue[1] = ubatEso.getVal(); + } // ibat - jsonElementsStringTemp = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(2)).toString(); - GetGeneralValues ibat = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - esoChannelPostsValue[2] = ibat.getVal(); + jsonElementsStringTempEso = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(2)) + .toString(); + GetGeneralValues ibatEso = gson.fromJson(jsonElementsStringTempEso, GetGeneralValues.class); + if (ibatEso != null) { + esoChannelPostsValue[2] = ibatEso.getVal(); + } // wbatprod - jsonElementsStringTemp = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(3)).toString(); - GetGeneralValues wbatprod = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - esoChannelPostsValue[3] = mJTokWh(jsonStripOneLiners(wbatprod.getVal())); + jsonElementsStringTempEso = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(3)) + .toString(); + GetGeneralValues wbatprodEso = gson.fromJson(jsonElementsStringTempEso, GetGeneralValues.class); + if (wbatprodEso != null) { + esoChannelPostsValue[3] = mJTokWh(jsonStripOneLiners(wbatprodEso.getVal())); + } // wbatcons - jsonElementsStringTemp = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(4)).toString(); - GetGeneralValues wbatcons = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - esoChannelPostsValue[4] = mJTokWh(jsonStripOneLiners(wbatcons.getVal())); + jsonElementsStringTempEso = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(4)) + .toString(); + GetGeneralValues wbatconsEso = gson.fromJson(jsonElementsStringTempEso, GetGeneralValues.class); + if (wbatconsEso != null) { + esoChannelPostsValue[4] = mJTokWh(jsonStripOneLiners(wbatconsEso.getVal())); + } // soc - jsonElementsStringTemp = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(5)).toString(); - GetGeneralValues soc = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - esoChannelPostsValue[5] = soc.getVal(); + jsonElementsStringTempEso = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(5)) + .toString(); + GetGeneralValues socEso = gson.fromJson(jsonElementsStringTempEso, GetGeneralValues.class); + if (socEso != null) { + esoChannelPostsValue[5] = socEso.getVal(); + } // relaystatus - jsonElementsStringTemp = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(6)).toString(); - GetGeneralValues relaystatus = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - esoChannelPostsValue[6] = relaystatus.getVal(); + jsonElementsStringTempEso = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(6)) + .toString(); + GetGeneralValues relaystatusEso = gson.fromJson(jsonElementsStringTempEso, GetGeneralValues.class); + if (relaystatusEso != null) { + esoChannelPostsValue[6] = relaystatusEso.getVal(); + } // temp - jsonElementsStringTemp = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(7)).toString(); - GetGeneralValues temp = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - esoChannelPostsValue[7] = temp.getVal(); + jsonElementsStringTempEso = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(7)) + .toString(); + GetGeneralValues tempEso = gson.fromJson(jsonElementsStringTempEso, GetGeneralValues.class); + if (tempEso != null) { + esoChannelPostsValue[7] = tempEso.getVal(); + } // faultcode - jsonElementsStringTemp = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(8)).toString(); - GetGeneralValues faultcode = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - esoChannelPostsValue[8] = faultcode.getVal(); + jsonElementsStringTempEso = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(8)) + .toString(); + GetGeneralValues faultcodeEso = gson.fromJson(jsonElementsStringTempEso, GetGeneralValues.class); + if (faultcodeEso != null) { + esoChannelPostsValue[8] = faultcodeEso.getVal(); + } // udc - jsonElementsStringTemp = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(9)).toString(); - GetGeneralValues udc = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - esoChannelPostsValue[9] = udc.getVal(); + jsonElementsStringTempEso = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(9)) + .toString(); + GetGeneralValues udcEso = gson.fromJson(jsonElementsStringTempEso, GetGeneralValues.class); + if (udcEso != null) { + esoChannelPostsValue[9] = udcEso.getVal(); + } // ts - jsonElementsStringTemp = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(10)).toString(); - GetGeneralValues ts = checkNullGeneralValues(gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - esoChannelPostsValue[10] = ts.getVal(); + jsonElementsStringTempEso = jsonElementsObjectEso.get(EsoJsonElements.getJsonElementsEso().get(10)) + .toString(); + GetGeneralValues tsEso = gson.fromJson(jsonElementsStringTempEso, GetGeneralValues.class); + if (tsEso != null) { + esoChannelPostsValue[10] = tsEso.getVal(); + } esoChannelsUpdateValues = esoChannelPostsValue; } else { @@ -775,49 +909,65 @@ void processIncomingJsonMessageEsm(String topic, String messageJsonEsm) { Objects.requireNonNull(jsonElementsObjectEsm, "JsonObject jsonElementsObjectEsm cannot be null"); - String jsonElementsStringTemp = ""; + String jsonElementsStringTempEsm = ""; Gson gson = new Gson(); if (!jsonElementsObjectEsm.isEmpty()) { // id - jsonElementsStringTemp = jsonElementsObjectEsm.get(EsmJsonElements.getJsonElementsEsm().get(0)).toString(); - GetGeneralValues id = checkNullGeneralValues(gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - esmChannelPostsValue[0] = id.getVal(); + jsonElementsStringTempEsm = jsonElementsObjectEsm.get(EsmJsonElements.getJsonElementsEsm().get(0)) + .toString(); + GetGeneralValues idEsm = gson.fromJson(jsonElementsStringTempEsm, GetGeneralValues.class); + if (idEsm != null) { + esmChannelPostsValue[0] = idEsm.getVal(); + } // soh - jsonElementsStringTemp = jsonElementsObjectEsm.get(EsmJsonElements.getJsonElementsEsm().get(1)).toString(); - GetGeneralValues soh = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - esmChannelPostsValue[1] = soh.getVal(); + jsonElementsStringTempEsm = jsonElementsObjectEsm.get(EsmJsonElements.getJsonElementsEsm().get(1)) + .toString(); + GetGeneralValues sohEsm = gson.fromJson(jsonElementsStringTempEsm, GetGeneralValues.class); + if (sohEsm != null) { + esmChannelPostsValue[1] = sohEsm.getVal(); + } // soc - jsonElementsStringTemp = jsonElementsObjectEsm.get(EsmJsonElements.getJsonElementsEsm().get(2)).toString(); - GetGeneralValues soc = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - esmChannelPostsValue[2] = soc.getVal(); + jsonElementsStringTempEsm = jsonElementsObjectEsm.get(EsmJsonElements.getJsonElementsEsm().get(2)) + .toString(); + GetGeneralValues socEsm = gson.fromJson(jsonElementsStringTempEsm, GetGeneralValues.class); + if (socEsm != null) { + esmChannelPostsValue[2] = socEsm.getVal(); + } // ratedcapacity - jsonElementsStringTemp = jsonElementsObjectEsm.get(EsmJsonElements.getJsonElementsEsm().get(3)).toString(); - GetGeneralValues ratedcapacity = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - esmChannelPostsValue[3] = ratedcapacity.getVal(); + jsonElementsStringTempEsm = jsonElementsObjectEsm.get(EsmJsonElements.getJsonElementsEsm().get(3)) + .toString(); + GetGeneralValues ratedcapacityEsm = gson.fromJson(jsonElementsStringTempEsm, GetGeneralValues.class); + if (ratedcapacityEsm != null) { + esmChannelPostsValue[3] = ratedcapacityEsm.getVal(); + } // ratedpower - jsonElementsStringTemp = jsonElementsObjectEsm.get(EsmJsonElements.getJsonElementsEsm().get(4)).toString(); - GetGeneralValues ratedpower = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - esmChannelPostsValue[4] = ratedpower.getVal(); + jsonElementsStringTempEsm = jsonElementsObjectEsm.get(EsmJsonElements.getJsonElementsEsm().get(4)) + .toString(); + GetGeneralValues ratedpowerEsm = gson.fromJson(jsonElementsStringTempEsm, GetGeneralValues.class); + if (ratedpowerEsm != null) { + esmChannelPostsValue[4] = ratedpowerEsm.getVal(); + } // status - jsonElementsStringTemp = jsonElementsObjectEsm.get(EsmJsonElements.getJsonElementsEsm().get(5)).toString(); - GetGeneralValues status = checkNullGeneralValues( - gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - esmChannelPostsValue[5] = status.getVal(); + jsonElementsStringTempEsm = jsonElementsObjectEsm.get(EsmJsonElements.getJsonElementsEsm().get(5)) + .toString(); + GetGeneralValues statusEsm = gson.fromJson(jsonElementsStringTempEsm, GetGeneralValues.class); + if (statusEsm != null) { + esmChannelPostsValue[5] = statusEsm.getVal(); + } // ts - jsonElementsStringTemp = jsonElementsObjectEsm.get(EsmJsonElements.getJsonElementsEsm().get(6)).toString(); - GetGeneralValues ts = checkNullGeneralValues(gson.fromJson(jsonElementsStringTemp, GetGeneralValues.class)); - esmChannelPostsValue[6] = ts.getVal(); + jsonElementsStringTempEsm = jsonElementsObjectEsm.get(EsmJsonElements.getJsonElementsEsm().get(6)) + .toString(); + GetGeneralValues tsEsm = gson.fromJson(jsonElementsStringTempEsm, GetGeneralValues.class); + if (tsEsm != null) { + esmChannelPostsValue[6] = tsEsm.getVal(); + } esmChannelsUpdateValues = esmChannelPostsValue; } else { @@ -901,20 +1051,4 @@ public String mJTokWh(String actualmJ) { Double actualkWhD = (Double.parseDouble(actualmJ) / 3600000000.0); return actualkWhD.toString(); } - - public GetGeneralValues checkNullGeneralValues(GetGeneralValues checkGeneralValues) { - Objects.requireNonNull(checkGeneralValues, "GeneralValues cannot be null, " + checkGeneralValues.getName()); - return checkGeneralValues; - } - - public GetGeneralLx checkNullGeneralLx(GetGeneralLx checkGeneralLx) { - Objects.requireNonNull(checkGeneralLx, "GeneralLx cannot be null, " + checkGeneralLx.getL1() + ", " - + checkGeneralLx.getL2() + ", " + checkGeneralLx.getL3()); - return checkGeneralLx; - } - - public GetUdc checkNullUdc(GetUdc checkUdc) { - Objects.requireNonNull(checkUdc, "Udc cannot be null, " + checkUdc.getNeg() + ", " + checkUdc.getPos()); - return checkUdc; - } }