From 532476a9c6faf2046d720523ae85bbc0e7519d27 Mon Sep 17 00:00:00 2001 From: lsiepel Date: Fri, 3 Nov 2023 18:47:40 +0100 Subject: [PATCH] [networkupstools] Add battery.temperature channel (#15812) * Add channel battery-temperature --------- Signed-off-by: Leo Siepel --- .../README.md | 1 + .../networkupstools/internal/NutName.java | 3 ++- .../OH-INF/i18n/networkupstools.properties | 2 ++ .../src/main/resources/OH-INF/thing/channels.xml | 7 ++++++- .../main/resources/OH-INF/thing/thing-types.xml | 5 +++++ .../resources/OH-INF/update/instructions.xml | 16 ++++++++++++++++ .../internal/NutNameChannelsTest.java | 2 +- 7 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 bundles/org.openhab.binding.networkupstools/src/main/resources/OH-INF/update/instructions.xml diff --git a/bundles/org.openhab.binding.networkupstools/README.md b/bundles/org.openhab.binding.networkupstools/README.md index 861abcf07..6f7d30aae 100644 --- a/bundles/org.openhab.binding.networkupstools/README.md +++ b/bundles/org.openhab.binding.networkupstools/README.md @@ -76,6 +76,7 @@ The following channels are available: | batteryCharge | Number:Dimensionless | % | Battery charge (percent) | no | | batteryRuntime | Number:Time | s | Battery runtime (seconds) | no | | batteryVoltage | Number:ElectricPotential | V | Battery voltage (V) | yes | +| batteryTemperature | Number:Temperature | °C | Battery temperature (degrees C) | yes | ### Dynamic Channels diff --git a/bundles/org.openhab.binding.networkupstools/src/main/java/org/openhab/binding/networkupstools/internal/NutName.java b/bundles/org.openhab.binding.networkupstools/src/main/java/org/openhab/binding/networkupstools/internal/NutName.java index f0453f8f9..dc7039c87 100644 --- a/bundles/org.openhab.binding.networkupstools/src/main/java/org/openhab/binding/networkupstools/internal/NutName.java +++ b/bundles/org.openhab.binding.networkupstools/src/main/java/org/openhab/binding/networkupstools/internal/NutName.java @@ -64,7 +64,8 @@ enum NutName { // Battery BATTERY_CHARGE("batteryCharge", "battery.charge", Units.PERCENT), BATTERY_RUNTIME("batteryRuntime", "battery.runtime", Units.SECOND), - BATTERY_VOLTAGE("batteryVoltage", "battery.voltage", Units.VOLT); + BATTERY_VOLTAGE("batteryVoltage", "battery.voltage", Units.VOLT), + BATTERY_TEMPERATURE("batteryTemperature", "battery.temperature", SIUnits.CELSIUS); static final Map NUT_NAME_MAP = Stream.of(NutName.values()) .collect(Collectors.toMap(NutName::getChannelId, Function.identity())); diff --git a/bundles/org.openhab.binding.networkupstools/src/main/resources/OH-INF/i18n/networkupstools.properties b/bundles/org.openhab.binding.networkupstools/src/main/resources/OH-INF/i18n/networkupstools.properties index 4c6f6330f..ee23de1d9 100644 --- a/bundles/org.openhab.binding.networkupstools/src/main/resources/OH-INF/i18n/networkupstools.properties +++ b/bundles/org.openhab.binding.networkupstools/src/main/resources/OH-INF/i18n/networkupstools.properties @@ -29,6 +29,8 @@ channel-type.networkupstools.battery-charge.label = Battery Charge channel-type.networkupstools.battery-charge.description = Battery charge (percent) channel-type.networkupstools.battery-runtime.label = Battery Runtime channel-type.networkupstools.battery-runtime.description = Battery runtime (seconds) +channel-type.networkupstools.battery-temperature.label = Battery Temperature +channel-type.networkupstools.battery-temperature.description = Battery temperature (degrees C) channel-type.networkupstools.battery-voltage.label = Battery Voltage channel-type.networkupstools.battery-voltage.description = Battery voltage (V) channel-type.networkupstools.input-current-status.label = Input Current Status diff --git a/bundles/org.openhab.binding.networkupstools/src/main/resources/OH-INF/thing/channels.xml b/bundles/org.openhab.binding.networkupstools/src/main/resources/OH-INF/thing/channels.xml index 703fa0b6c..f88dd7e07 100644 --- a/bundles/org.openhab.binding.networkupstools/src/main/resources/OH-INF/thing/channels.xml +++ b/bundles/org.openhab.binding.networkupstools/src/main/resources/OH-INF/thing/channels.xml @@ -143,5 +143,10 @@ Battery voltage (V) - + + Number:Temperature + + Battery temperature (degrees C) + + diff --git a/bundles/org.openhab.binding.networkupstools/src/main/resources/OH-INF/thing/thing-types.xml b/bundles/org.openhab.binding.networkupstools/src/main/resources/OH-INF/thing/thing-types.xml index 3720317e0..af18867b8 100644 --- a/bundles/org.openhab.binding.networkupstools/src/main/resources/OH-INF/thing/thing-types.xml +++ b/bundles/org.openhab.binding.networkupstools/src/main/resources/OH-INF/thing/thing-types.xml @@ -13,6 +13,7 @@ + @@ -32,6 +33,10 @@ + + 1 + + diff --git a/bundles/org.openhab.binding.networkupstools/src/main/resources/OH-INF/update/instructions.xml b/bundles/org.openhab.binding.networkupstools/src/main/resources/OH-INF/update/instructions.xml new file mode 100644 index 000000000..8f0234d47 --- /dev/null +++ b/bundles/org.openhab.binding.networkupstools/src/main/resources/OH-INF/update/instructions.xml @@ -0,0 +1,16 @@ + + + + + + + + networkupstools:battery-temperature + + + + + + diff --git a/bundles/org.openhab.binding.networkupstools/src/test/java/org/openhab/binding/networkupstools/internal/NutNameChannelsTest.java b/bundles/org.openhab.binding.networkupstools/src/test/java/org/openhab/binding/networkupstools/internal/NutNameChannelsTest.java index f591b2940..f7a888240 100644 --- a/bundles/org.openhab.binding.networkupstools/src/test/java/org/openhab/binding/networkupstools/internal/NutNameChannelsTest.java +++ b/bundles/org.openhab.binding.networkupstools/src/test/java/org/openhab/binding/networkupstools/internal/NutNameChannelsTest.java @@ -43,7 +43,7 @@ public class NutNameChannelsTest { private static final String THING_TYPES_XML = "thing-types.xml"; private static final String CHANNELS_XML = "channels.xml"; - private static final int EXPECTED_NUMBER_OF_CHANNELS = 20; + private static final int EXPECTED_NUMBER_OF_CHANNELS = 21; private static final int EXPECTED_NUMMBER_OF_CHANNEL_XML_LINES = EXPECTED_NUMBER_OF_CHANNELS * 6; // README table is: | Channel Name | Item Type | Unit | Description | Advanced