childOfEndpoint = true;
functionCode = null;
readRequest = null;
- } else {
- ModbusPollerThingHandler localPollerHandler = (ModbusPollerThingHandler) bridgeHandler;
+ } else if (bridgeHandler instanceof ModbusPollerThingHandler localPollerHandler) {
pollerHandler = localPollerHandler;
ModbusReadRequestBlueprint localReadRequest = localPollerHandler.getRequest();
if (localReadRequest == null) {
comms = localPollerHandler.getCommunicationInterface();
pollStart = localReadRequest.getReference();
childOfEndpoint = false;
+ } else {
+ String errmsg = String.format("Thing %s is connected to an unsupported type of bridge.",
+ getThing().getUID());
+ throw new ModbusConfigurationException(errmsg);
}
+
validateAndParseReadParameters(localConfig);
validateAndParseWriteParameters(localConfig);
validateMustReadOrWrite();
if (childOfEndpoint && readRequest == null) {
if (!readStartMissing || !readValueTypeMissing) {
String errmsg = String.format(
- "Thing %s readStart=%s, and readValueType=%s were specified even though the data thing is child of endpoint (that is, write-only)!",
- getThing().getUID(), config.getReadStart(), config.getReadValueType());
+ "Thing %s was configured for reading (readStart and/or readValueType specified) but the parent is not a polling bridge. Consider using a bridge of type 'Regular Poll'.",
+ getThing().getUID());
throw new ModbusConfigurationException(errmsg);
}
}