Fix issue openhab/openhab-addons#17959 where new channels could not be added in the Web UI (#18016)

Signed-off-by: Catalin Sanda <catalin.sanda@gmail.com>
This commit is contained in:
Catalin Sanda 2025-01-04 22:05:43 +02:00 committed by GitHub
parent 8a3baf8003
commit 36cff511b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 65 additions and 182 deletions

View File

@ -12,9 +12,12 @@
*/
package org.openhab.binding.solarman.internal;
import org.eclipse.jdt.annotation.NonNullByDefault;
/**
* @author Peter Kretz - Initial contribution
*/
@NonNullByDefault
public enum SolarmanLoggerMode {
V5MODBUS,
RAWMODBUS

View File

@ -16,7 +16,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.binding.solarman.internal.SolarmanLoggerConfiguration;
/**
* @author Peter Kretz - Added RAW Modbus for LAN Stick
* @author Peter Kretz - Initial contribution
*/
@NonNullByDefault
public class SolarmanProtocolFactory {

View File

@ -1,46 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<config-description:config-descriptions
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:config-description="https://openhab.org/schemas/config-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/config-description/v1.0.0 https://openhab.org/schemas/config-description-1.0.0.xsd">
<config-description uri="channel-type-config:solarman:datetime-channel">
<parameter name="uom" type="text">
<label>Unit of Measurement</label>
<description>The unit of measurement used for this channel</description>
<advanced>true</advanced>
</parameter>
<parameter name="scale" type="decimal">
<label>Scale</label>
<description>The scaling factor, the final value will be scaled by this</description>
<advanced>true</advanced>
</parameter>
<parameter name="rule" type="integer">
<label>Rule</label>
<description>The type of measurement. See explanation for possible values</description>
<advanced>true</advanced>
<options>
<option value="1">Unsigned Short</option>
<option value="2">Signed Short</option>
<option value="3">Unsigned Integer</option>
<option value="4">Signed Integer</option>
<option value="5">Text</option>
<option value="6">Bytes</option>
<option value="7">Version</option>
<option value="8">Date Time</option>
<option value="9">Time</option>
</options>
</parameter>
<parameter name="offset" type="decimal">
<label>Offset</label>
<description>The offset subtracted from the measurement</description>
<advanced>true</advanced>
</parameter>
<parameter name="registers" type="text">
<label>Registers</label>
<description>Comma separated list of registers to read for the measurement</description>
<advanced>true</advanced>
</parameter>
</config-description>
</config-description:config-descriptions>

View File

@ -8,38 +8,38 @@
<parameter name="uom" type="text">
<label>Unit of Measurement</label>
<description>The unit of measurement used for this channel</description>
<advanced>true</advanced>
<advanced>false</advanced>
</parameter>
<parameter name="scale" type="decimal">
<label>Scale</label>
<description>The scaling factor, the final value will be scaled by this</description>
<advanced>true</advanced>
<advanced>false</advanced>
</parameter>
<parameter name="rule" type="integer">
<parameter name="rule" type="integer" required="true">
<label>Rule</label>
<description>The type of measurement. See explanation for possible values</description>
<advanced>true</advanced>
<advanced>false</advanced>
<options>
<option value="1">Unsigned Short</option>
<option value="2">Signed Short</option>
<option value="3">Unsigned Integer</option>
<option value="4">Signed Integer</option>
<option value="5">Text</option>
<option value="6">Bytes</option>
<option value="7">Version</option>
<option value="8">Date Time</option>
<option value="9">Time</option>
<option value="1">Unsigned Short (Rule 1)</option>
<option value="2">Signed Short (Rule 2)</option>
<option value="3">Unsigned Integer (Rule 3)</option>
<option value="4">Signed Integer (Rule 4)</option>
<option value="5">Text (Rule 5)</option>
<option value="6">Bytes (Rule 6)</option>
<option value="7">Version (Rule 7)</option>
<option value="8">Date Time (Rule 8)</option>
<option value="9">Time (Rule 9)</option>
</options>
</parameter>
<parameter name="offset" type="decimal">
<label>Offset</label>
<description>The offset subtracted from the measurement</description>
<advanced>true</advanced>
<advanced>false</advanced>
</parameter>
<parameter name="registers" type="text">
<parameter name="registers" type="text" required="true">
<label>Registers</label>
<description>Comma separated list of registers to read for the measurement</description>
<advanced>true</advanced>
<advanced>false</advanced>
</parameter>
</config-description>

View File

@ -1,46 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<config-description:config-descriptions
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:config-description="https://openhab.org/schemas/config-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/config-description/v1.0.0 https://openhab.org/schemas/config-description-1.0.0.xsd">
<config-description uri="channel-type-config:solarman:number-channel">
<parameter name="uom" type="text">
<label>Unit of Measurement</label>
<description>The unit of measurement used for this channel</description>
<advanced>true</advanced>
</parameter>
<parameter name="scale" type="decimal">
<label>Scale</label>
<description>The scaling factor, the final value will be scaled by this</description>
<advanced>true</advanced>
</parameter>
<parameter name="rule" type="integer">
<label>Rule</label>
<description>The type of measurement. See explanation for possible values</description>
<advanced>true</advanced>
<options>
<option value="1">Unsigned Short</option>
<option value="2">Signed Short</option>
<option value="3">Unsigned Integer</option>
<option value="4">Signed Integer</option>
<option value="5">Text</option>
<option value="6">Bytes</option>
<option value="7">Version</option>
<option value="8">Date Time</option>
<option value="9">Time</option>
</options>
</parameter>
<parameter name="offset" type="decimal">
<label>Offset</label>
<description>The offset subtracted from the measurement</description>
<advanced>true</advanced>
</parameter>
<parameter name="registers" type="text">
<label>Registers</label>
<description>Comma separated list of registers to read for the measurement</description>
<advanced>true</advanced>
</parameter>
</config-description>
</config-description:config-descriptions>

View File

@ -1,46 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<config-description:config-descriptions
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:config-description="https://openhab.org/schemas/config-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/config-description/v1.0.0 https://openhab.org/schemas/config-description-1.0.0.xsd">
<config-description uri="channel-type-config:solarman:string-channel">
<parameter name="uom" type="text">
<label>Unit of Measurement</label>
<description>The unit of measurement used for this channel</description>
<advanced>true</advanced>
</parameter>
<parameter name="scale" type="decimal">
<label>Scale</label>
<description>The scaling factor, the final value will be scaled by this</description>
<advanced>true</advanced>
</parameter>
<parameter name="rule" type="integer">
<label>Rule</label>
<description>The type of measurement. See explanation for possible values</description>
<advanced>true</advanced>
<options>
<option value="1">Unsigned Short</option>
<option value="2">Signed Short</option>
<option value="3">Unsigned Integer</option>
<option value="4">Signed Integer</option>
<option value="5">Text</option>
<option value="6">Bytes</option>
<option value="7">Version</option>
<option value="8">Date Time</option>
<option value="9">Time</option>
</options>
</parameter>
<parameter name="offset" type="decimal">
<label>Offset</label>
<description>The offset subtracted from the measurement</description>
<advanced>true</advanced>
</parameter>
<parameter name="registers" type="text">
<label>Registers</label>
<description>Comma separated list of registers to read for the measurement</description>
<advanced>true</advanced>
</parameter>
</config-description>
</config-description:config-descriptions>

View File

@ -27,7 +27,10 @@ thing-type.config.solarman.logger.inverterType.option.sofar_hyd3k-6k-es = SOFAR
thing-type.config.solarman.logger.inverterType.option.sofar_lsw3 = SOFAR Inverters (sofar_lsw3)
thing-type.config.solarman.logger.inverterType.option.sofar_wifikit = SOFAR WifiKit (sofar_wifikit)
thing-type.config.solarman.logger.inverterType.option.solis_1p8k-5g = SOLIS 1P8K-5G (solis_1p8k-5g)
thing-type.config.solarman.logger.inverterType.option.solis_3p-4g = SOLIS Three-Phase Inverter 4G Series (solis_3p-4g)
thing-type.config.solarman.logger.inverterType.option.solis_s6-gr1p = SOLIS Single-Phase Inverter S6-GR1P (solis_s6-gr1p)
thing-type.config.solarman.logger.inverterType.option.solis_hybrid = SOLIS Hybrid Inverter (solis_hybrid)
thing-type.config.solarman.logger.inverterType.option.hyd-zss-hp-3k-6k = ZCS Azzurro Hybrid HP 3K-6K Inverters (hyd-zss-hp-3k-6k)
thing-type.config.solarman.logger.inverterType.option.zcs_azzurro-ktl-v3 = ZCS Azzurro KTL-V3 Inverters (zcs_azzurro-ktl-v3)
thing-type.config.solarman.logger.port.label = Port
thing-type.config.solarman.logger.port.description = Port of the Solarman logger (default 8899).
@ -35,13 +38,43 @@ thing-type.config.solarman.logger.refreshInterval.label = Refresh Interval
thing-type.config.solarman.logger.refreshInterval.description = Interval to query the logger (default 60).
thing-type.config.solarman.logger.serialNumber.label = Serial Number
thing-type.config.solarman.logger.serialNumber.description = Serial number of the Solarman logger.
thing-type.config.solarman.logger.solarmanLoggerMode.label = Logger Mode
thing-type.config.solarman.logger.solarmanLoggerMode.description = Use RAW Modbus for LAN Stick LSE-3 and V5 NODBUS for most Wifi Sticks. If your Wifi stick uses Raw Modbus choose RAW. If you do not use this advanced option, V5 MODBUS will be the default.
thing-type.config.solarman.logger.solarmanLoggerMode.option.V5MODBUS = V5 Modbus
thing-type.config.solarman.logger.solarmanLoggerMode.option.RAWMODBUS = RAW Modbus
# channel types
channel-type.solarman.datetime.label = Datetime Value
channel-type.solarman.datetime.description = Channel used to represent a datetime value
channel-type.solarman.dynamic.label = Dynamic Channel
channel-type.solarman.dynamic.description = Channel used to represent a dynamic value
channel-type.solarman.number.label = Number Value
channel-type.solarman.number.description = Channel used to represent a numeric value
channel-type.solarman.string.label = Text Value
channel-type.solarman.string.description = Channel used to represent a string value
# channel types config
channel-type-config.config.solarman.dynamic-channel.offset.label = Offset
channel-type-config.config.solarman.dynamic-channel.offset.description = The offset subtracted from the measurement
channel-type-config.config.solarman.dynamic-channel.registers.label = Registers
channel-type-config.config.solarman.dynamic-channel.registers.description = Comma separated list of registers to read for the measurement
channel-type-config.config.solarman.dynamic-channel.rule.label = Rule
channel-type-config.config.solarman.dynamic-channel.rule.description = The type of measurement. See explanation for possible values
channel-type-config.config.solarman.dynamic-channel.rule.option.1 = Unsigned Short (Rule 1)
channel-type-config.config.solarman.dynamic-channel.rule.option.2 = Signed Short (Rule 2)
channel-type-config.config.solarman.dynamic-channel.rule.option.3 = Unsigned Integer (Rule 3)
channel-type-config.config.solarman.dynamic-channel.rule.option.4 = Signed Integer (Rule 4)
channel-type-config.config.solarman.dynamic-channel.rule.option.5 = Text (Rule 5)
channel-type-config.config.solarman.dynamic-channel.rule.option.6 = Bytes (Rule 6)
channel-type-config.config.solarman.dynamic-channel.rule.option.7 = Version (Rule 7)
channel-type-config.config.solarman.dynamic-channel.rule.option.8 = Date Time (Rule 8)
channel-type-config.config.solarman.dynamic-channel.rule.option.9 = Time (Rule 9)
channel-type-config.config.solarman.dynamic-channel.scale.label = Scale
channel-type-config.config.solarman.dynamic-channel.scale.description = The scaling factor, the final value will be scaled by this
channel-type-config.config.solarman.dynamic-channel.uom.label = Unit of Measurement
channel-type-config.config.solarman.dynamic-channel.uom.description = The unit of measurement used for this channel
# channel types config
@ -64,25 +97,6 @@ channel-type-config.config.solarman.datetime-channel.scale.label = Scale
channel-type-config.config.solarman.datetime-channel.scale.description = The scaling factor, the final value will be scaled by this
channel-type-config.config.solarman.datetime-channel.uom.label = Unit of Measurement
channel-type-config.config.solarman.datetime-channel.uom.description = The unit of measurement used for this channel
channel-type-config.config.solarman.dynamic-channel.offset.label = Offset
channel-type-config.config.solarman.dynamic-channel.offset.description = The offset subtracted from the measurement
channel-type-config.config.solarman.dynamic-channel.registers.label = Registers
channel-type-config.config.solarman.dynamic-channel.registers.description = Comma separated list of registers to read for the measurement
channel-type-config.config.solarman.dynamic-channel.rule.label = Rule
channel-type-config.config.solarman.dynamic-channel.rule.description = The type of measurement. See explanation for possible values
channel-type-config.config.solarman.dynamic-channel.rule.option.1 = Unsigned Short
channel-type-config.config.solarman.dynamic-channel.rule.option.2 = Signed Short
channel-type-config.config.solarman.dynamic-channel.rule.option.3 = Unsigned Integer
channel-type-config.config.solarman.dynamic-channel.rule.option.4 = Signed Integer
channel-type-config.config.solarman.dynamic-channel.rule.option.5 = Text
channel-type-config.config.solarman.dynamic-channel.rule.option.6 = Bytes
channel-type-config.config.solarman.dynamic-channel.rule.option.7 = Version
channel-type-config.config.solarman.dynamic-channel.rule.option.8 = Date Time
channel-type-config.config.solarman.dynamic-channel.rule.option.9 = Time
channel-type-config.config.solarman.dynamic-channel.scale.label = Scale
channel-type-config.config.solarman.dynamic-channel.scale.description = The scaling factor, the final value will be scaled by this
channel-type-config.config.solarman.dynamic-channel.uom.label = Unit of Measurement
channel-type-config.config.solarman.dynamic-channel.uom.description = The unit of measurement used for this channel
channel-type-config.config.solarman.number-channel.offset.label = Offset
channel-type-config.config.solarman.number-channel.offset.description = The offset subtracted from the measurement
channel-type-config.config.solarman.number-channel.registers.label = Registers

View File

@ -7,24 +7,28 @@
<channel-type id="string">
<item-type>String</item-type>
<label>Text Value</label>
<config-description-ref uri="channel-type-config:solarman:string-channel"/>
<description>Channel used to represent a string value</description>
<config-description-ref uri="channel-type-config:solarman:dynamic-channel"/>
</channel-type>
<channel-type id="number">
<item-type>Number</item-type>
<label>Number Value</label>
<config-description-ref uri="channel-type-config:solarman:number-channel"/>
<description>Channel used to represent a numeric value</description>
<config-description-ref uri="channel-type-config:solarman:dynamic-channel"/>
</channel-type>
<channel-type id="datetime">
<item-type>DateTime</item-type>
<label>Datetime Value</label>
<config-description-ref uri="channel-type-config:solarman:datetime-channel"/>
<description>Channel used to represent a datetime value</description>
<config-description-ref uri="channel-type-config:solarman:dynamic-channel"/>
</channel-type>
<channel-type id="dynamic">
<item-type>String</item-type>
<label>Dynamic Channel</label>
<description>Channel used to represent a dynamic value</description>
<config-description-ref uri="channel-type-config:solarman:dynamic-channel"/>
</channel-type>

View File

@ -5,7 +5,7 @@
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Sample Thing Type -->
<thing-type id="logger" extensible="true">
<thing-type id="logger" extensible="string,number,datetime">
<label>Solarman Logger</label>
<description>This thing allows communication with Solarman (IGEN-Tech) v5 based solar inverter data loggers over the
local network. Compatible with inverters from manufacturers such as Deye, Sofar, Solis, ZCS Azzurro, and KStar.</description>

View File

@ -98,7 +98,8 @@ public class DefinitionParserTest {
}
private static List<String> scanDirectory(String directoryPath) throws IOException, URISyntaxException {
URL url = Objects.requireNonNull(DefinitionParserTest.class.getClassLoader()).getResource(directoryPath);
URL url = Objects.requireNonNull(
Objects.requireNonNull(DefinitionParserTest.class.getClassLoader()).getResource(directoryPath));
Path directory = Paths.get(url.toURI());
if (!Files.isDirectory(directory)) {
@ -106,9 +107,8 @@ public class DefinitionParserTest {
}
try (Stream<Path> stream = Files.list(directory)) {
List<String> files = stream.filter(file -> file.getFileName().toString().endsWith(YAML_EXTENSION))
.map(file -> directoryPath + "/" + file.getFileName().toString()).toList();
return files;
return stream.filter(file -> file.getFileName().toString().endsWith(YAML_EXTENSION))
.map(file -> directoryPath + "/" + file.getFileName()).toList();
}
}
}