[networkupstools] Add battery.temperature channel (#15812)

* Add channel battery-temperature

---------

Signed-off-by: Leo Siepel <leosiepel@gmail.com>
This commit is contained in:
lsiepel 2023-11-03 18:47:40 +01:00 committed by GitHub
parent 15a673a027
commit 532476a9c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 33 additions and 3 deletions

View File

@ -76,6 +76,7 @@ The following channels are available:
| batteryCharge | Number:Dimensionless | % | Battery charge (percent) | no | | batteryCharge | Number:Dimensionless | % | Battery charge (percent) | no |
| batteryRuntime | Number:Time | s | Battery runtime (seconds) | no | | batteryRuntime | Number:Time | s | Battery runtime (seconds) | no |
| batteryVoltage | Number:ElectricPotential | V | Battery voltage (V) | yes | | batteryVoltage | Number:ElectricPotential | V | Battery voltage (V) | yes |
| batteryTemperature | Number:Temperature | °C | Battery temperature (degrees C) | yes |
### Dynamic Channels ### Dynamic Channels

View File

@ -64,7 +64,8 @@ enum NutName {
// Battery // Battery
BATTERY_CHARGE("batteryCharge", "battery.charge", Units.PERCENT), BATTERY_CHARGE("batteryCharge", "battery.charge", Units.PERCENT),
BATTERY_RUNTIME("batteryRuntime", "battery.runtime", Units.SECOND), 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<String, NutName> NUT_NAME_MAP = Stream.of(NutName.values()) static final Map<String, NutName> NUT_NAME_MAP = Stream.of(NutName.values())
.collect(Collectors.toMap(NutName::getChannelId, Function.identity())); .collect(Collectors.toMap(NutName::getChannelId, Function.identity()));

View File

@ -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-charge.description = Battery charge (percent)
channel-type.networkupstools.battery-runtime.label = Battery Runtime channel-type.networkupstools.battery-runtime.label = Battery Runtime
channel-type.networkupstools.battery-runtime.description = Battery runtime (seconds) 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.label = Battery Voltage
channel-type.networkupstools.battery-voltage.description = Battery voltage (V) channel-type.networkupstools.battery-voltage.description = Battery voltage (V)
channel-type.networkupstools.input-current-status.label = Input Current Status channel-type.networkupstools.input-current-status.label = Input Current Status

View File

@ -143,5 +143,10 @@
<description>Battery voltage (V)</description> <description>Battery voltage (V)</description>
<state pattern="%.0f %unit%" readOnly="true"/> <state pattern="%.0f %unit%" readOnly="true"/>
</channel-type> </channel-type>
<channel-type id="battery-temperature" advanced="true">
<item-type>Number:Temperature</item-type>
<label>Battery Temperature</label>
<description>Battery temperature (degrees C)</description>
<state pattern="%.1f %unit%" readOnly="true"/>
</channel-type>
</thing:thing-descriptions> </thing:thing-descriptions>

View File

@ -13,6 +13,7 @@
<channel id="batteryCharge" typeId="battery-charge"/> <channel id="batteryCharge" typeId="battery-charge"/>
<channel id="batteryRuntime" typeId="battery-runtime"/> <channel id="batteryRuntime" typeId="battery-runtime"/>
<channel id="batteryVoltage" typeId="battery-voltage"/> <channel id="batteryVoltage" typeId="battery-voltage"/>
<channel id="batteryTemperature" typeId="battery-temperature"/>
<channel id="inputRealpower" typeId="input-realpower"/> <channel id="inputRealpower" typeId="input-realpower"/>
<channel id="inputVoltageStatus" typeId="input-voltage-status"/> <channel id="inputVoltageStatus" typeId="input-voltage-status"/>
<channel id="inputQuality" typeId="input-quality"/> <channel id="inputQuality" typeId="input-quality"/>
@ -32,6 +33,10 @@
<channel id="upsTestResult" typeId="ups-test-result"/> <channel id="upsTestResult" typeId="ups-test-result"/>
</channels> </channels>
<properties>
<property name="thingTypeVersion">1</property>
</properties>
<config-description-ref uri="thing-type:ups:config"/> <config-description-ref uri="thing-type:ups:config"/>
</thing-type> </thing-type>

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<update:update-descriptions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:update="https://openhab.org/schemas/update-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/update-description/v1.0.0 https://openhab.org/schemas/update-description-1.0.0.xsd">
<thing-type uid="networkupstools:ups">
<instruction-set targetVersion="1">
<add-channel id="batteryTemperature">
<type>networkupstools:battery-temperature</type>
</add-channel>
</instruction-set>
</thing-type>
</update:update-descriptions>

View File

@ -43,7 +43,7 @@ public class NutNameChannelsTest {
private static final String THING_TYPES_XML = "thing-types.xml"; private static final String THING_TYPES_XML = "thing-types.xml";
private static final String CHANNELS_XML = "channels.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; 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 // README table is: | Channel Name | Item Type | Unit | Description | Advanced