From 2c6c8f1f9d8baa54494de37b0a5e95be4b0070ac Mon Sep 17 00:00:00 2001 From: AndrewFG Date: Tue, 26 Nov 2024 11:41:47 +0000 Subject: [PATCH] apply i18n, comments, and tweaks Signed-off-by: AndrewFG --- .../growatt/internal/GrowattChannels.java | 2 +- .../growatt/internal/dto/GrottValues.java | 6 +-- .../resources/OH-INF/i18n/growatt.properties | 38 +++++++++++++++++++ .../resources/OH-INF/thing/thing-types.xml | 2 +- .../resources/OH-INF/update/instructions.xml | 2 +- .../binding/growatt/test/GrowattTest.java | 4 +- 6 files changed, 46 insertions(+), 8 deletions(-) diff --git a/bundles/org.openhab.binding.growatt/src/main/java/org/openhab/binding/growatt/internal/GrowattChannels.java b/bundles/org.openhab.binding.growatt/src/main/java/org/openhab/binding/growatt/internal/GrowattChannels.java index 3da0930434d44..ec20af235c3de 100644 --- a/bundles/org.openhab.binding.growatt/src/main/java/org/openhab/binding/growatt/internal/GrowattChannels.java +++ b/bundles/org.openhab.binding.growatt/src/main/java/org/openhab/binding/growatt/internal/GrowattChannels.java @@ -212,7 +212,7 @@ public UoM(Unit units, float divisor) { new AbstractMap.SimpleEntry("inverter-fan-speed", new UoM(Units.PERCENT, 1)), /* - * ============== CHANNELS ADDED IN ISSUE #99999 ============== + * ============== CHANNELS ADDED IN PR #17810 ============== */ // DC electric data for strings #3 and #4 diff --git a/bundles/org.openhab.binding.growatt/src/main/java/org/openhab/binding/growatt/internal/dto/GrottValues.java b/bundles/org.openhab.binding.growatt/src/main/java/org/openhab/binding/growatt/internal/dto/GrottValues.java index b3ecfd75b4efd..ef1f17be19521 100644 --- a/bundles/org.openhab.binding.growatt/src/main/java/org/openhab/binding/growatt/internal/dto/GrottValues.java +++ b/bundles/org.openhab.binding.growatt/src/main/java/org/openhab/binding/growatt/internal/dto/GrottValues.java @@ -110,10 +110,10 @@ public static String getFieldName(String channelId) { // solar DC pv energy public @Nullable @SerializedName(value = "epvtoday") Integer pv_energy_today; - public @Nullable @SerializedName(value = "epv1today", alternate = { "epv1tod", "epv1today " }) Integer pv1_energy_today; + public @Nullable @SerializedName(value = "epv1today", alternate = { "epv1tod", "epv1today " }) Integer pv1_energy_today; // alternate intentionally has trailing space public @Nullable @SerializedName(value = "epv2today", alternate = { "epv2tod" }) Integer pv2_energy_today; - public @Nullable @SerializedName(value = "epvtotal", alternate = { "epvtotal " }) Integer pv_energy_total; + public @Nullable @SerializedName(value = "epvtotal", alternate = { "epvtotal " }) Integer pv_energy_total; // alternate intentionally has trailing space public @Nullable @SerializedName(value = "epv1total", alternate = { "epv1tot" }) Integer pv1_energy_total; public @Nullable @SerializedName(value = "epv2total", alternate = { "epv2tot" }) Integer pv2_energy_total; @@ -203,7 +203,7 @@ public static String getFieldName(String channelId) { public @Nullable @SerializedName(value = "invfanspeed") Integer inverter_fan_speed; /* - * ============== CHANNELS ADDED IN PR #99999 ============== + * ============== CHANNELS ADDED IN PR #17810 ============== */ // DC electric data for strings #3 and #4 diff --git a/bundles/org.openhab.binding.growatt/src/main/resources/OH-INF/i18n/growatt.properties b/bundles/org.openhab.binding.growatt/src/main/resources/OH-INF/i18n/growatt.properties index 055bf3b1cccb6..585ab4e7c7a8d 100644 --- a/bundles/org.openhab.binding.growatt/src/main/resources/OH-INF/i18n/growatt.properties +++ b/bundles/org.openhab.binding.growatt/src/main/resources/OH-INF/i18n/growatt.properties @@ -45,6 +45,26 @@ thing-type.growatt.inverter.channel.discharge-power.label = Discharge Power thing-type.growatt.inverter.channel.discharge-power.description = Discharge power from battery. thing-type.growatt.inverter.channel.discharge-va.label = Discharge VA thing-type.growatt.inverter.channel.discharge-va.description = Discharge VA from battery. +thing-type.growatt.inverter.channel.eps-current-r.label = EPS Current #R +thing-type.growatt.inverter.channel.eps-current-r.description = Emergency Power Supply current (phase #R). +thing-type.growatt.inverter.channel.eps-current-s.label = EPS Current #S +thing-type.growatt.inverter.channel.eps-current-s.description = Emergency Power Supply current (phase #S). +thing-type.growatt.inverter.channel.eps-current-t.label = EPS Current #T +thing-type.growatt.inverter.channel.eps-current-t.description = Emergency Power Supply current (phase #T). +thing-type.growatt.inverter.channel.eps-power.label = EPS Power +thing-type.growatt.inverter.channel.eps-power.description = Total Emergency Power Supply power. +thing-type.growatt.inverter.channel.eps-power-r.label = EPS Power #R +thing-type.growatt.inverter.channel.eps-power-r.description = Emergency Power Supply power (phase #R). +thing-type.growatt.inverter.channel.eps-power-s.label = EPS Power #S +thing-type.growatt.inverter.channel.eps-power-s.description = Emergency Power Supply power (phase #S). +thing-type.growatt.inverter.channel.eps-power-t.label = EPS Power #T +thing-type.growatt.inverter.channel.eps-power-t.description = Emergency Power Supply power (phase #T). +thing-type.growatt.inverter.channel.eps-voltage-r.label = EPS Voltage #R +thing-type.growatt.inverter.channel.eps-voltage-r.description = Emergency Power Supply voltage (phase #R). +thing-type.growatt.inverter.channel.eps-voltage-s.label = EPS Voltage #S +thing-type.growatt.inverter.channel.eps-voltage-s.description = Emergency Power Supply voltage (phase #S). +thing-type.growatt.inverter.channel.eps-voltage-t.label = EPS Voltage #T +thing-type.growatt.inverter.channel.eps-voltage-t.description = Emergency Power Supply voltage (phase #T). thing-type.growatt.inverter.channel.erac-today.label = Reactive Energy Today thing-type.growatt.inverter.channel.erac-today.description = Reactive energy supplied today. thing-type.growatt.inverter.channel.erac-total.label = Total Reactive Energy @@ -137,6 +157,8 @@ thing-type.growatt.inverter.channel.n-bus-voltage.label = N Bus Voltage thing-type.growatt.inverter.channel.n-bus-voltage.description = N Bus voltage. thing-type.growatt.inverter.channel.p-bus-voltage.label = P Bus Voltage thing-type.growatt.inverter.channel.p-bus-voltage.description = P Bus voltage. +thing-type.growatt.inverter.channel.power-factor.label = Power Factor +thing-type.growatt.inverter.channel.power-factor.description = Electrical power factor thing-type.growatt.inverter.channel.pv-boost-temperature.label = Boost Temperature thing-type.growatt.inverter.channel.pv-boost-temperature.description = Boost temperature. thing-type.growatt.inverter.channel.pv-energy-today.label = DC Energy Today @@ -171,6 +193,22 @@ thing-type.growatt.inverter.channel.pv2-temperature.label = Solar Panel Temperat thing-type.growatt.inverter.channel.pv2-temperature.description = Temperature of the solar panels (string #2). thing-type.growatt.inverter.channel.pv2-voltage.label = String #2 Voltage thing-type.growatt.inverter.channel.pv2-voltage.description = Voltage from solar panel string #2. +thing-type.growatt.inverter.channel.pv3-current.label = String #3 Current +thing-type.growatt.inverter.channel.pv3-current.description = Current from solar panel string #3. +thing-type.growatt.inverter.channel.pv3-energy-today.label = DC Energy #3 Today +thing-type.growatt.inverter.channel.pv3-energy-today.description = Solar DC energy collected by string #3. +thing-type.growatt.inverter.channel.pv3-energy-total.label = DC Energy #3 Total +thing-type.growatt.inverter.channel.pv3-energy-total.description = Total solar DC energy collected by string #3. +thing-type.growatt.inverter.channel.pv3-power.label = String #3 Power +thing-type.growatt.inverter.channel.pv3-power.description = Power from solar panel string #3. +thing-type.growatt.inverter.channel.pv3-voltage.label = String #3 Voltage +thing-type.growatt.inverter.channel.pv3-voltage.description = Voltage from solar panel string #3. +thing-type.growatt.inverter.channel.pv4-current.label = String #4 Current +thing-type.growatt.inverter.channel.pv4-current.description = Current from solar panel string #4. +thing-type.growatt.inverter.channel.pv4-power.label = String #4 Power +thing-type.growatt.inverter.channel.pv4-power.description = Power from solar panel string #4. +thing-type.growatt.inverter.channel.pv4-voltage.label = String #4 Voltage +thing-type.growatt.inverter.channel.pv4-voltage.description = Voltage from solar panel string #4. thing-type.growatt.inverter.channel.rac.label = Reactive Power thing-type.growatt.inverter.channel.rac.description = Reactive power output. thing-type.growatt.inverter.channel.sp-bus-voltage.label = SP Bus Voltage diff --git a/bundles/org.openhab.binding.growatt/src/main/resources/OH-INF/thing/thing-types.xml b/bundles/org.openhab.binding.growatt/src/main/resources/OH-INF/thing/thing-types.xml index 643c4f76c141d..6c947acb3030c 100644 --- a/bundles/org.openhab.binding.growatt/src/main/resources/OH-INF/thing/thing-types.xml +++ b/bundles/org.openhab.binding.growatt/src/main/resources/OH-INF/thing/thing-types.xml @@ -480,7 +480,7 @@ Inverter fan speed. - + diff --git a/bundles/org.openhab.binding.growatt/src/main/resources/OH-INF/update/instructions.xml b/bundles/org.openhab.binding.growatt/src/main/resources/OH-INF/update/instructions.xml index a139a94acc3a7..cea61abf486cc 100644 --- a/bundles/org.openhab.binding.growatt/src/main/resources/OH-INF/update/instructions.xml +++ b/bundles/org.openhab.binding.growatt/src/main/resources/OH-INF/update/instructions.xml @@ -50,7 +50,7 @@ - + diff --git a/bundles/org.openhab.binding.growatt/src/test/java/org/openhab/binding/growatt/test/GrowattTest.java b/bundles/org.openhab.binding.growatt/src/test/java/org/openhab/binding/growatt/test/GrowattTest.java index 6af7dc2ba1aae..528c9ce2c59ca 100644 --- a/bundles/org.openhab.binding.growatt/src/test/java/org/openhab/binding/growatt/test/GrowattTest.java +++ b/bundles/org.openhab.binding.growatt/src/test/java/org/openhab/binding/growatt/test/GrowattTest.java @@ -258,8 +258,8 @@ private void testJsonFieldsMappedToDto(String fileName) throws FileNotFoundExcep String json = load(fileName); JsonParser.parseString(json).getAsJsonObject().get("values").getAsJsonObject().entrySet().forEach(e -> { String key = e.getKey(); - if (GrowattChannels.UNUSED_FIELDS.containsKey(fileName) - && !Objects.requireNonNull(GrowattChannels.UNUSED_FIELDS.get(fileName)).contains(key)) { + assertTrue(GrowattChannels.UNUSED_FIELDS.containsKey(fileName)); + if (!Objects.requireNonNull(GrowattChannels.UNUSED_FIELDS.get(fileName)).contains(key)) { JsonObject testJsonObject = new JsonObject(); testJsonObject.add(key, e.getValue()); GrottValues testDto = gson.fromJson(testJsonObject, GrottValues.class);