Compare commits

..

1 Commits

Author SHA1 Message Date
Patrik Gfeller
82e0765ad8
Merge dbc545396a into f6efa87fb2 2025-01-09 08:32:32 +01:00
5 changed files with 14 additions and 17 deletions

View File

@ -185,7 +185,6 @@ public class ApiPageParser extends AbstractSimpleMarkupHandler {
} else if ("durchsichtig".equals(classFlag)) { // link } else if ("durchsichtig".equals(classFlag)) { // link
this.fieldType = FieldType.IGNORE; this.fieldType = FieldType.IGNORE;
} else if ("bord".equals(classFlag)) { // special button style - not of our interest... } else if ("bord".equals(classFlag)) { // special button style - not of our interest...
continue;
} else { } else {
logger.debug("Unhanndled class in {}:{}:{}: '{}' ", id, line, col, classFlag); logger.debug("Unhanndled class in {}:{}:{}: '{}' ", id, line, col, classFlag);
} }
@ -193,7 +192,7 @@ public class ApiPageParser extends AbstractSimpleMarkupHandler {
} }
} else if (this.parserState == ParserState.DATA_ENTRY && this.fieldType == FieldType.BUTTON } else if (this.parserState == ParserState.DATA_ENTRY && this.fieldType == FieldType.BUTTON
&& "span".equals(elementName)) { && "span".equals(elementName)) {
return; // ignored... // ignored...
} else { } else {
logger.debug("Unexpected OpenElement in {}:{}: {} [{}]", line, col, elementName, attributes); logger.debug("Unexpected OpenElement in {}:{}: {} [{}]", line, col, elementName, attributes);
} }
@ -246,14 +245,14 @@ public class ApiPageParser extends AbstractSimpleMarkupHandler {
getApiPageEntry(id, line, col, shortName, description, this.buttonValue); getApiPageEntry(id, line, col, shortName, description, this.buttonValue);
} }
} else if (this.fieldType == FieldType.IGNORE) { } else if (this.fieldType == FieldType.IGNORE) {
return; // ignore // ignore
} else { } else {
logger.debug("Unhandled setting {}:{}:{} [{}] : {}", id, line, col, this.fieldType, sb); logger.debug("Unhandled setting {}:{}:{} [{}] : {}", id, line, col, this.fieldType, sb);
} }
} }
} else if (this.parserState == ParserState.DATA_ENTRY && this.fieldType == FieldType.BUTTON } else if (this.parserState == ParserState.DATA_ENTRY && this.fieldType == FieldType.BUTTON
&& "span".equals(elementName)) { && "span".equals(elementName)) {
return;// ignored... // ignored...
} else { } else {
logger.debug("Unexpected CloseElement in {}:{}: {}", line, col, elementName); logger.debug("Unexpected CloseElement in {}:{}: {}", line, col, elementName);
} }
@ -308,7 +307,7 @@ public class ApiPageParser extends AbstractSimpleMarkupHandler {
} }
} else if (this.parserState == ParserState.INIT && ((len == 1 && buffer[offset] == '\n') } else if (this.parserState == ParserState.INIT && ((len == 1 && buffer[offset] == '\n')
|| (len == 2 && buffer[offset] == '\r' && buffer[offset + 1] == '\n'))) { || (len == 2 && buffer[offset] == '\r' && buffer[offset + 1] == '\n'))) {
return; // single newline - ignore/drop it... // single newline - ignore/drop it...
} else { } else {
String msg = new String(buffer, offset, len).replace("\n", "\\n").replace("\r", "\\r"); String msg = new String(buffer, offset, len).replace("\n", "\\n").replace("\r", "\\r");
logger.debug("Unexpected Text {}:{}: ParserState: {} ({}) `{}`", line, col, parserState, len, msg); logger.debug("Unexpected Text {}:{}: ParserState: {} ({}) `{}`", line, col, parserState, len, msg);
@ -401,9 +400,9 @@ public class ApiPageParser extends AbstractSimpleMarkupHandler {
// failed to get unit... // failed to get unit...
if ("Imp".equals(unitStr) || "€$".contains(unitStr)) { if ("Imp".equals(unitStr) || "€$".contains(unitStr)) {
// special case // special case
unitData = TACmiSchemaHandler.SPECIAL_MARKER; unitData = taCmiSchemaHandler.SPECIAL_MARKER;
} else { } else {
unitData = TACmiSchemaHandler.NULL_MARKER; unitData = taCmiSchemaHandler.NULL_MARKER;
logger.warn( logger.warn(
"Unhandled UoM '{}' - seen on channel {} '{}'; Message from QuantityType: {}", "Unhandled UoM '{}' - seen on channel {} '{}'; Message from QuantityType: {}",
valParts[1], shortName, description, iae.getMessage()); valParts[1], shortName, description, iae.getMessage());
@ -411,12 +410,12 @@ public class ApiPageParser extends AbstractSimpleMarkupHandler {
} }
taCmiSchemaHandler.unitsCache.put(unitStr, unitData); taCmiSchemaHandler.unitsCache.put(unitStr, unitData);
} }
if (unitData == TACmiSchemaHandler.NULL_MARKER) { if (unitData == taCmiSchemaHandler.NULL_MARKER) {
// no UoM mappable - just send value // no UoM mappable - just send value
channelType = "Number"; channelType = "Number";
unit = null; unit = null;
state = new DecimalType(bd); state = new DecimalType(bd);
} else if (unitData == TACmiSchemaHandler.SPECIAL_MARKER) { } else if (unitData == taCmiSchemaHandler.SPECIAL_MARKER) {
// special handling for unknown UoM // special handling for unknown UoM
if ("Imp".equals(unitStr)) { // Number of Pulses if ("Imp".equals(unitStr)) { // Number of Pulses
// impulses - no idea how to map this to something useful here? // impulses - no idea how to map this to something useful here?

View File

@ -102,7 +102,7 @@ public class ChangerX2Parser extends AbstractSimpleMarkupHandler {
this.optionFieldName = attributes == null ? null : attributes.get("name"); this.optionFieldName = attributes == null ? null : attributes.get("name");
} else if ((this.parserState == ParserState.INIT || this.parserState == ParserState.INPUT) } else if ((this.parserState == ParserState.INIT || this.parserState == ParserState.INPUT)
&& "br".equals(elementName)) { && "br".equals(elementName)) {
return; // ignored // ignored
} else if ((this.parserState == ParserState.INIT || this.parserState == ParserState.INPUT) } else if ((this.parserState == ParserState.INIT || this.parserState == ParserState.INPUT)
&& "input".equals(elementName) && "changeto".equals(id)) { && "input".equals(elementName) && "changeto".equals(id)) {
this.parserState = ParserState.INPUT_DATA; this.parserState = ParserState.INPUT_DATA;
@ -171,6 +171,7 @@ public class ChangerX2Parser extends AbstractSimpleMarkupHandler {
} }
this.options.put(ChangerX2Entry.TIME_PERIOD_PARTS, timeParts); this.options.put(ChangerX2Entry.TIME_PERIOD_PARTS, timeParts);
} else { } else {
logger.warn("Error parsing options for {}: Unhandled input field in {}:{}: {}", channelName, line, logger.warn("Error parsing options for {}: Unhandled input field in {}:{}: {}", channelName, line,
col, attributes); col, attributes);
} }
@ -217,7 +218,7 @@ public class ChangerX2Parser extends AbstractSimpleMarkupHandler {
} }
} }
} else if (this.parserState == ParserState.INPUT && "span".equals(elementName)) { } else if (this.parserState == ParserState.INPUT && "span".equals(elementName)) {
return; // span's are ignored... // span's are ignored...
} else { } else {
logger.debug("Error parsing options for {}: Unexpected CloseElement in {}:{}: {}", channelName, line, col, logger.debug("Error parsing options for {}: Unexpected CloseElement in {}:{}: {}", channelName, line, col,
elementName); elementName);
@ -274,11 +275,10 @@ public class ChangerX2Parser extends AbstractSimpleMarkupHandler {
sb.append(buffer, offset, len); sb.append(buffer, offset, len);
} }
} else if (this.parserState == ParserState.INIT && len == 1 && buffer[offset] == '\n') { } else if (this.parserState == ParserState.INIT && len == 1 && buffer[offset] == '\n') {
return; // single newline - ignore/drop it... // single newline - ignore/drop it...
} else if (this.parserState == ParserState.INPUT) { } else if (this.parserState == ParserState.INPUT) {
// this is a label next to the value input field - we currently have no use for it so // this is a label next to the value input field - we currently have no use for it so
// it's dropped... // it's dropped...
return;
} else { } else {
logger.debug("Error parsing options for {}: Unexpected Text {}:{}: (ctx: {} len: {}) '{}' ", logger.debug("Error parsing options for {}: Unexpected Text {}:{}: (ctx: {} len: {}) '{}' ",
this.channelName, line, col, this.parserState, len, new String(buffer, offset, len)); this.channelName, line, col, this.parserState, len, new String(buffer, offset, len));

View File

@ -90,9 +90,9 @@ public class TACmiSchemaHandler extends BaseThingHandler {
// this is the units lookup cache. // this is the units lookup cache.
protected final Map<String, UnitAndType> unitsCache = new ConcurrentHashMap<>(); protected final Map<String, UnitAndType> unitsCache = new ConcurrentHashMap<>();
// marks an entry with known un-resolveable unit // marks an entry with known un-resolveable unit
protected static final UnitAndType NULL_MARKER = new UnitAndType(Units.ONE, ""); protected final UnitAndType NULL_MARKER = new UnitAndType(Units.ONE, "");
// marks an entry with special handling - i.e. 'Imp' // marks an entry with special handling - i.e. 'Imp'
protected static final UnitAndType SPECIAL_MARKER = new UnitAndType(Units.ONE, "s"); protected final UnitAndType SPECIAL_MARKER = new UnitAndType(Units.ONE, "s");
public TACmiSchemaHandler(final Thing thing, final HttpClient httpClient, public TACmiSchemaHandler(final Thing thing, final HttpClient httpClient,
final TACmiChannelTypeProvider channelTypeProvider) { final TACmiChannelTypeProvider channelTypeProvider) {

View File

@ -165,7 +165,6 @@ public class HomieImplementationTest extends MqttOSGiTest {
"Connection " + homieConnection.getClientId() + " not retrieving all topics "); "Connection " + homieConnection.getClientId() + " not retrieving all topics ");
} }
@Disabled("https://github.com/openhab/openhab-addons/issues/12667")
@Test @Test
public void retrieveOneAttribute() throws Exception { public void retrieveOneAttribute() throws Exception {
WaitForTopicValue watcher = new WaitForTopicValue(homieConnection, DEVICE_TOPIC + "/$homie"); WaitForTopicValue watcher = new WaitForTopicValue(homieConnection, DEVICE_TOPIC + "/$homie");

View File

@ -107,7 +107,6 @@ public class WemoMakerHandlerOSGiTest extends GenericWemoOSGiTest {
} }
@Test @Test
@Disabled("https://github.com/openhab/openhab-addons/issues/12474")
public void assertThatThingHandlesREFRESHCommand() public void assertThatThingHandlesREFRESHCommand()
throws MalformedURLException, URISyntaxException, ValidationException, IOException { throws MalformedURLException, URISyntaxException, ValidationException, IOException {
Command command = RefreshType.REFRESH; Command command = RefreshType.REFRESH;