Skip to content

Commit

Permalink
Fix issue #17959 where new channels could not be added in the Web UI (#…
Browse files Browse the repository at this point in the history
…18016)

Signed-off-by: Catalin Sanda <catalin.sanda@gmail.com>
  • Loading branch information
catalinsanda authored Jan 4, 2025
1 parent 8a3baf8 commit 36cff51
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 182 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
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 {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,54 @@ 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).
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

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,17 @@ public List<String> scanForYamlFiles(String directoryPath) throws IOException {
}

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)) {
throw new IllegalArgumentException("Invalid directory path: " + directoryPath);
}

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();
}
}
}

0 comments on commit 36cff51

Please sign in to comment.