mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
[tacmi] Fix SAT errors (#18046)
Signed-off-by: Leo Siepel <leosiepel@gmail.com>
This commit is contained in:
parent
e69c44b85e
commit
4e88f48a71
@ -185,6 +185,7 @@ 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);
|
||||||
}
|
}
|
||||||
@ -192,7 +193,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)) {
|
||||||
// ignored...
|
return; // ignored...
|
||||||
} else {
|
} else {
|
||||||
logger.debug("Unexpected OpenElement in {}:{}: {} [{}]", line, col, elementName, attributes);
|
logger.debug("Unexpected OpenElement in {}:{}: {} [{}]", line, col, elementName, attributes);
|
||||||
}
|
}
|
||||||
@ -245,14 +246,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) {
|
||||||
// ignore
|
return; // 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)) {
|
||||||
// ignored...
|
return;// ignored...
|
||||||
} else {
|
} else {
|
||||||
logger.debug("Unexpected CloseElement in {}:{}: {}", line, col, elementName);
|
logger.debug("Unexpected CloseElement in {}:{}: {}", line, col, elementName);
|
||||||
}
|
}
|
||||||
@ -307,7 +308,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'))) {
|
||||||
// single newline - ignore/drop it...
|
return; // 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);
|
||||||
@ -400,9 +401,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());
|
||||||
@ -410,12 +411,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?
|
||||||
|
@ -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)) {
|
||||||
// ignored
|
return; // 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,7 +171,6 @@ 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);
|
||||||
}
|
}
|
||||||
@ -218,7 +217,7 @@ public class ChangerX2Parser extends AbstractSimpleMarkupHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (this.parserState == ParserState.INPUT && "span".equals(elementName)) {
|
} else if (this.parserState == ParserState.INPUT && "span".equals(elementName)) {
|
||||||
// span's are ignored...
|
return; // 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);
|
||||||
@ -275,10 +274,11 @@ 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') {
|
||||||
// single newline - ignore/drop it...
|
return; // 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));
|
||||||
|
@ -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 final UnitAndType NULL_MARKER = new UnitAndType(Units.ONE, "");
|
protected static 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 final UnitAndType SPECIAL_MARKER = new UnitAndType(Units.ONE, "s");
|
protected static 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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user