100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Added dynamic time injection support for protocols and cleanup of dynamic value processing (#1374)
Panos Kalogeropoulos830f0ba3f9de
diff --git a/agent/src/main/java/org/openremote/agent/protocol/AbstractProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/AbstractProtocol.javaindex bb9d0c0e9..25360a891 100644--- a/agent/src/main/java/org/openremote/agent/protocol/AbstractProtocol.java+++ b/agent/src/main/java/org/openremote/agent/protocol/AbstractProtocol.java@@ -41,7 +41,7 @@ import java.util.concurrent.ConcurrentHashMap;import java.util.concurrent.ScheduledExecutorService;import java.util.concurrent.TimeUnit;-import static org.openremote.model.protocol.ProtocolUtil.hasDynamicWriteValue;+import static org.openremote.model.protocol.ProtocolUtil.hasDynamicPlaceholders;import static org.openremote.model.syslog.SyslogCategory.PROTOCOL;public abstract class AbstractProtocol<T extends Agent<T, ?, U>, U extends AgentLink<?>> implements Protocol<T> {@@ -105,9 +105,9 @@ public abstract class AbstractProtocol<T extends Agent<T, ?, U>, U extends Agent// linking process and without entry in the map any update would be blockedlinkedAttributes.put(attributeRef, attribute);- // Check for dynamic value placeholder+ // Check for dynamic placeholders- if (hasDynamicWriteValue(agent.getAgentLink(attribute))) {+ if (hasDynamicPlaceholders(agent.getAgentLink(attribute))) {dynamicAttributes.add(attributeRef);}@@ -145,11 +145,11 @@ public abstract class AbstractProtocol<T extends Agent<T, ?, U>, U extends AgentAgentLink<?> agentLink = agent.getAgentLink(event);Pair<Boolean, Object> ignoreAndConverted = ProtocolUtil.doOutboundValueProcessing(- event.getId(),- event,+ event.getRef(),agentLink,event.getValue().orElse(null),- dynamicAttributes.contains(event.getRef()));+ dynamicAttributes.contains(event.getRef()),+ timerService.getNow());if (ignoreAndConverted.key) {LOG.log(System.Logger.Level.DEBUG, "Value conversion returned ignore so attribute will not write to protocol: " + event.getRef());diff --git a/agent/src/main/java/org/openremote/agent/protocol/http/HTTPProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/http/HTTPProtocol.javaindex d101a5c1c..44a602cb7 100644--- a/agent/src/main/java/org/openremote/agent/protocol/http/HTTPProtocol.java+++ b/agent/src/main/java/org/openremote/agent/protocol/http/HTTPProtocol.java@@ -34,7 +34,9 @@ import org.jboss.resteasy.core.Headers;import org.jboss.resteasy.specimpl.BuiltResponse;import org.jboss.resteasy.specimpl.ResponseBuilderImpl;import org.openremote.agent.protocol.AbstractProtocol;-import org.openremote.container.web.QueryParameterInjectorFilter;+import org.openremote.container.timer.TimerService;+import org.openremote.container.web.DynamicTimeInjectorFilter;+import org.openremote.container.web.DynamicValueInjectorFilter;import org.openremote.container.web.WebTargetBuilder;import org.openremote.model.Constants;import org.openremote.model.Container;@@ -45,24 +47,28 @@ import org.openremote.model.attribute.AttributeEvent;import org.openremote.model.attribute.AttributeRef;import org.openremote.model.auth.OAuthGrant;import org.openremote.model.auth.UsernamePassword;+import org.openremote.model.protocol.ProtocolUtil;import org.openremote.model.syslog.SyslogCategory;+import org.openremote.model.util.Pair;import org.openremote.model.util.TextUtil;import org.openremote.model.util.ValueUtil;-import org.openremote.model.value.ValueType;import java.lang.annotation.Annotation;import java.lang.reflect.Type;import java.net.URI;import java.net.URISyntaxException;+import java.time.Instant;import java.util.*;import java.util.concurrent.ScheduledFuture;import java.util.concurrent.TimeUnit;import java.util.concurrent.atomic.AtomicReference;import java.util.function.Consumer;+import java.util.function.Predicate;+import java.util.function.Supplier;import java.util.logging.Level;import java.util.logging.Logger;-import static org.openremote.container.web.QueryParameterInjectorFilter.QUERY_PARAMETERS_PROPERTY;+import static org.openremote.container.web.WebTargetBuilder.addHeaders;import static org.openremote.container.web.WebTargetBuilder.createClient;import static org.openremote.model.syslog.SyslogCategory.PROTOCOL;@@ -78,12 +84,11 @@ import static org.openremote.model.syslog.SyslogCategory.PROTOCOL;* <p>* <b>NOTE: if an exception is thrown during the request that means no response is returned then this is treated as if* a 500 response has been received</b>- * <h1>Dynamic value injection</h1>- * This allows the {@link HTTPAgentLink#getPath()}} and/or {@link AgentLink#getWriteValue()} to contain the linked- * {@link Attribute} value when sending requests. To dynamically inject the attribute value use {@value- * Constants#DYNAMIC_VALUE_PLACEHOLDER} as a placeholder and this will be dynamically replaced at request time.+ * <h1>Dynamic placeholder injection</h1>+ * This allows the path, query params, headers and/or {@link AgentLink#getWriteValue()} to contain the linked+ * {@link Attribute} value when sending requests.* <h2>Path example</h2>- * {@link HTTPAgentLink#getPath()} = "volume/set/{$value}" and request received to set attribute value to 100. Actual+ * {@link HTTPAgentLink#getPath()} = "volume/set/%VALUE%" and request received to set attribute value to 100. Actual* path used for the request = "volume/set/100"* <h2>Query parameter example</h2>* {@link HTTPAgentLink#getQueryParameters()} =@@ -92,17 +97,17 @@ import static org.openremote.model.syslog.SyslogCategory.PROTOCOL;* {* param1: ["val1", "val2"],* param2: 12232,- * param3: "{$value}"+ * param3: "%TIME%"* }* }* </pre></blockquote>* Request received to set attribute value to true. Actual query parameters injected into the request =* "param1=val1¶m1=val2¶m2=12232¶m3=true"* <h2>Body examples</h2>- * {@link AgentLink#getWriteValue()} = '<?xml version="1.0" encoding="UTF-8"?>{$value}</xml>' and request received to+ * {@link AgentLink#getWriteValue()} = '<?xml version="1.0" encoding="UTF-8"?>%VALUE%</xml>' and request received to* set attribute value to 100. Actual body used for the request = "{volume: 100}"* <p>- * {@link AgentLink#getWriteValue()} = '{myObject: "{$value}"}' and request received to set attribute value to:+ * {@link AgentLink#getWriteValue()} = '{myObject: "%VALUE%"}' and request received to set attribute value to:* <blockquote><pre>* {@code* {@@ -121,22 +126,25 @@ public class HTTPProtocol extends AbstractProtocol<HTTPAgent, HTTPAgentLink> {public static class HttpClientRequest {public String method;- public MultivaluedMap<String, Object> headers;- public MultivaluedMap<String, String> queryParameters;+ public MultivaluedMap<String, ?> headers;+ public MultivaluedMap<String, ?> queryParameters;public String path;protected String contentType;protected WebTarget client;protected WebTarget requestTarget;- protected boolean dynamicQueryParameters;+ protected boolean containsDynamicValue;protected boolean pagingEnabled;+ protected boolean containsDynamicTime;+ private final Supplier<Instant> instantSupplier;public HttpClientRequest(WebTarget client,String path,String method,- MultivaluedMap<String, Object> headers,- MultivaluedMap<String, String> queryParameters,+ MultivaluedMap<String, ?> headers,+ MultivaluedMap<String, ?> queryParameters,boolean pagingEnabled,- String contentType) {+ String contentType,+ Supplier<Instant> instantSupplier) {if (!TextUtil.isNullOrEmpty(path)) {if (path.startsWith("/")) {@@ -151,53 +159,43 @@ public class HTTPProtocol extends AbstractProtocol<HTTPAgent, HTTPAgentLink> {this.queryParameters = queryParameters;this.pagingEnabled = pagingEnabled;this.contentType = contentType != null ? contentType : DEFAULT_CONTENT_TYPE;- dynamicQueryParameters = queryParameters != null- && queryParameters- .entrySet()- .stream()- .anyMatch(paramNameAndValues ->- paramNameAndValues.getValue() != null- && paramNameAndValues.getValue()- .stream()- .anyMatch(val -> val.contains(Constants.DYNAMIC_VALUE_PLACEHOLDER)));-- boolean dynamicPath = !TextUtil.isNullOrEmpty(path) && path.contains(Constants.DYNAMIC_VALUE_PLACEHOLDER);- if (!dynamicPath) {- requestTarget = createRequestTarget(path);- }+ this.instantSupplier = instantSupplier;++ // Check if this request contains any dynamic value references in headers, query params or path+ Predicate<Object> containsValue = e -> e instanceof String str && Constants.containsDynamicValuePlaceholder(str);+ containsDynamicValue = (queryParameters != null && queryParameters.values().stream()+ .anyMatch(values -> values.stream().anyMatch(containsValue)))+ || (headers != null && headers.values().stream()+ .anyMatch(values -> values.stream().anyMatch(containsValue)))+ || (path != null && containsValue.test(path));++ // Check if this HTTP request contains any references of dynamic time. We do so by checking query parameters+ // and headers, using the predicate below.+ Predicate<Object> containsTime = e -> e instanceof String str && Constants.containsDynamicTimePlaceholder(str);+ containsDynamicTime = (queryParameters != null && queryParameters.values().stream()+ .anyMatch(values -> values.stream().anyMatch(containsTime)))+ || (headers != null && headers.values().stream()+ .anyMatch(values -> values.stream().anyMatch(containsTime)))+ || (path != null && containsTime.test(path));++ requestTarget = createRequestTarget(path);}protected WebTarget createRequestTarget(String path) {WebTarget requestTarget = client.path(path == null ? "" : path);if (queryParameters != null) {- @SuppressWarnings("unchecked")- MultivaluedMap<String, String> existingParams = (MultivaluedMap<String, String>) requestTarget.getConfiguration().getProperty(QUERY_PARAMETERS_PROPERTY);- existingParams = existingParams != null ? new MultivaluedHashMap<String, String>(existingParams) : new MultivaluedHashMap<String, String>();- queryParameters.forEach(existingParams::addAll);- requestTarget.property(QUERY_PARAMETERS_PROPERTY, existingParams);+ requestTarget = WebTargetBuilder.addQueryParams(requestTarget, queryParameters);}return requestTarget;}- protected Invocation.Builder getRequestBuilder(String value) {- Invocation.Builder requestBuilder;-- if (requestTarget != null) {- requestBuilder = requestTarget.request();- } else {- // This means that the path is dynamic- String path = this.path.replaceAll(Constants.DYNAMIC_VALUE_PLACEHOLDER_REGEXP, value);- requestBuilder = createRequestTarget(path).request();- }+ protected Invocation.Builder getRequestBuilder() {+ Invocation.Builder requestBuilder = requestTarget.request();if (headers != null) {- requestBuilder.headers(headers);- }-- if (dynamicQueryParameters) {- requestBuilder.property(QueryParameterInjectorFilter.DYNAMIC_VALUE_PROPERTY, value);+ requestBuilder = addHeaders(requestBuilder, headers);}return requestBuilder;@@ -206,8 +204,12 @@ public class HTTPProtocol extends AbstractProtocol<HTTPAgent, HTTPAgentLink> {protected Invocation buildInvocation(Invocation.Builder requestBuilder, String value) {Invocation invocation;- if (dynamicQueryParameters) {- requestBuilder.property(QueryParameterInjectorFilter.DYNAMIC_VALUE_PROPERTY, value);+ if (containsDynamicTime) {+ requestBuilder.property(DynamicTimeInjectorFilter.INSTANT_SUPPLIER_PROPERTY, instantSupplier);+ }++ if (containsDynamicValue) {+ requestBuilder.property(DynamicValueInjectorFilter.DYNAMIC_VALUE_PROPERTY, value);}if (method != null && !HttpMethod.GET.equals(method) && value != null) {@@ -220,7 +222,7 @@ public class HTTPProtocol extends AbstractProtocol<HTTPAgent, HTTPAgentLink> {}public Response invoke(String value) {- Invocation.Builder requestBuilder = getRequestBuilder(value);+ Invocation.Builder requestBuilder = getRequestBuilder();Invocation invocation = buildInvocation(requestBuilder, value);return invocation.invoke();}@@ -320,9 +322,6 @@ public class HTTPProtocol extends AbstractProtocol<HTTPAgent, HTTPAgentLink> {Optional<OAuthGrant> oAuthGrant = agent.getOAuthGrant();Optional<UsernamePassword> usernameAndPassword = agent.getUsernamePassword();boolean followRedirects = agent.getFollowRedirects().orElse(false);- Optional<ValueType.MultivaluedStringMap> headers = agent.getRequestHeaders();- Optional<ValueType.MultivaluedStringMap> queryParams = agent.getRequestQueryParameters();-Integer readTimeout = agent.getRequestTimeoutMillis().orElse(null);WebTargetBuilder webTargetBuilder;@@ -343,11 +342,9 @@ public class HTTPProtocol extends AbstractProtocol<HTTPAgent, HTTPAgentLink> {});}- headers.ifPresent(webTargetBuilder::setInjectHeaders);- queryParams.ifPresent(webTargetBuilder::setInjectQueryParameters);webTargetBuilder.followRedirects(followRedirects);- LOG.fine("Creating web target client '" + baseUri + "'");+ LOG.fine("Creating web target client for agent '" + getAgent().getId() + "': " + baseUri);webTarget = webTargetBuilder.build();setConnectionStatus(ConnectionStatus.CONNECTED);@@ -381,31 +378,46 @@ public class HTTPProtocol extends AbstractProtocol<HTTPAgent, HTTPAgentLink> {}}- String body = agentLink.getWriteValue().orElse(null);-if (client == null) {LOG.warning("Client is undefined: " + this);return;}+ // We pass in the combined headers as they can only be set on the invocation builder+ MultivaluedMap<String, String> combinedHeaders;+ Optional<MultivaluedMap<String, String>> agentHeaders = agent.getRequestHeaders().map(WebTargetBuilder::mapToMultivaluedMap);+ if (headers != null) {+ combinedHeaders = agentHeaders.map(MultivaluedHashMap::new).orElse(new MultivaluedHashMap<>());+ headers.forEach(combinedHeaders::addAll);+ } else combinedHeaders = agentHeaders.orElse(null);++ // We pass in the combined query params so we can determine if the request contains dynamic placeholders+ MultivaluedMap<String, String> combinedQueryParams;+ Optional<MultivaluedMap<String, String>> agentParams = agent.getRequestQueryParameters().map(WebTargetBuilder::mapToMultivaluedMap);+ if (queryParams != null) {+ combinedQueryParams = agentParams.map(MultivaluedHashMap::new).orElse(new MultivaluedHashMap<>());+ queryParams.forEach(combinedQueryParams::addAll);+ } else combinedQueryParams = agentParams.orElse(null);+HttpClientRequest clientRequest = buildClientRequest(path,method,- headers != null ? WebTargetBuilder.mapToMultivaluedMap(headers, new MultivaluedHashMap<>()) : null,- queryParams != null ? WebTargetBuilder.mapToMultivaluedMap(queryParams, new MultivaluedHashMap<>()) : null,+ combinedHeaders,+ combinedQueryParams,pagingEnabled,- contentType);+ contentType,+ timerService);- LOG.fine("Creating HTTP request for attributeRef '" + clientRequest + "': " + attributeRef);+ LOG.finer("Creating HTTP client request '" + clientRequest + "': " + attributeRef);requestMap.put(attributeRef, clientRequest);Optional.ofNullable(pollingMillis).ifPresent(seconds ->pollingMap.put(attributeRef, schedulePollingRequest(attributeRef,+ attribute,agentLink,clientRequest,- body,seconds)));}@@ -457,7 +469,7 @@ public class HTTPProtocol extends AbstractProtocol<HTTPAgent, HTTPAgentLink> {}}- protected HttpClientRequest buildClientRequest(String path, String method, MultivaluedMap<String, Object> headers, MultivaluedMap<String, String> queryParams, boolean pagingEnabled, String contentType) {+ protected HttpClientRequest buildClientRequest(String path, String method, MultivaluedMap<String, ?> headers, MultivaluedMap<String, ?> queryParams, boolean pagingEnabled, String contentType, TimerService timerService) {return new HttpClientRequest(webTarget,path,@@ -465,29 +477,50 @@ public class HTTPProtocol extends AbstractProtocol<HTTPAgent, HTTPAgentLink> {headers,queryParams,pagingEnabled,- contentType);+ contentType,+ timerService::getNow);}protected ScheduledFuture<?> schedulePollingRequest(AttributeRef attributeRef,+ Attribute<?> attribute,HTTPAgentLink agentLink,HttpClientRequest clientRequest,- String body,int pollingMillis) {- LOG.fine("Scheduling polling request '" + clientRequest + "' to execute every " + pollingMillis + " ms for attribute: " + attributeRef);-- return executorService.scheduleWithFixedDelay(() ->- executePollingRequest(clientRequest, body, response -> {- try {- onPollingResponse(- clientRequest,- response,- attributeRef,- agentLink);- } catch (Exception e) {- LOG.log(Level.WARNING, prefixLogMessage("Exception thrown whilst processing polling response [" + (e.getCause() != null ? e.getCause().getMessage() : e.getMessage()) + "]: " + clientRequest.requestTarget.getUriBuilder().build().toString()));+ LOG.fine("Scheduling polling request '" + clientRequest + "' to execute every " + pollingMillis + " ms for attribute: " + attribute);++ return executorService.scheduleWithFixedDelay(() -> {++ try {+ Pair<Boolean, Object> ignoreAndConverted = ProtocolUtil.doOutboundValueProcessing(+ attributeRef,+ agentLink,+ agentLink.getWriteValue().orElse(null),+ dynamicAttributes.contains(attributeRef),+ timerService.getNow());++ if (ignoreAndConverted.key) {+ LOG.log(Level.FINER, "Value conversion returned ignore so attribute will not write to protocol: " + attributeRef);+ return;}- }), 0, pollingMillis, TimeUnit.MILLISECONDS);++ String valueStr = ignoreAndConverted.value == null ? null : ValueUtil.convert(ignoreAndConverted.value, String.class);++ executePollingRequest(clientRequest, valueStr, response -> {+ try {+ onPollingResponse(+ clientRequest,+ response,+ attributeRef,+ agentLink);+ } catch (Exception e) {+ LOG.log(Level.WARNING, prefixLogMessage("Exception thrown whilst processing polling response [" + (e.getCause() != null ? e.getCause().getMessage() : e.getMessage()) + "]: " + clientRequest.requestTarget.getUriBuilder().build().toString()));+ }+ });+ } catch (Exception e) {+ LOG.log(Level.WARNING, prefixLogMessage("Exception thrown whilst processing polling response [" + (e.getCause() != null ? e.getCause().getMessage() : e.getMessage()) + "]: " + clientRequest.requestTarget.getUriBuilder().build().toString()));+ }+ }, 0, pollingMillis, TimeUnit.MILLISECONDS);}protected void executePollingRequest(HttpClientRequest clientRequest, String body, Consumer<Response> responseConsumer) {diff --git a/agent/src/main/java/org/openremote/agent/protocol/websocket/WebsocketAgentProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/websocket/WebsocketAgentProtocol.javaindex 97bf418c6..73fc1c524 100644--- a/agent/src/main/java/org/openremote/agent/protocol/websocket/WebsocketAgentProtocol.java+++ b/agent/src/main/java/org/openremote/agent/protocol/websocket/WebsocketAgentProtocol.java@@ -26,7 +26,6 @@ import jakarta.ws.rs.core.MultivaluedHashMap;import jakarta.ws.rs.core.Response;import org.apache.http.HttpHeaders;import org.jboss.resteasy.client.jaxrs.ResteasyClient;-import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget;import org.jboss.resteasy.util.BasicAuthHelper;import org.openremote.agent.protocol.io.AbstractNettyIOClientProtocol;import org.openremote.container.web.WebTargetBuilder;@@ -293,19 +292,18 @@ public class WebsocketAgentProtocol extends AbstractNettyIOClientProtocol<WebsocWebTargetBuilder webTargetBuilder = new WebTargetBuilder(resteasyClient.get(), uri);- if (headers != null) {- webTargetBuilder.setInjectHeaders(headers);- }-LOG.fine("Creating web target client for subscription '" + uri + "'");- ResteasyWebTarget target = webTargetBuilder.build();-+ Invocation.Builder request = webTargetBuilder.build().request();Invocation invocation;+ if (headers != null) {+ request = WebTargetBuilder.addHeaders(request, headers);+ }+if (httpSubscription.body == null) {- invocation = target.request().build(httpSubscription.method.toString());+ invocation = request.build(httpSubscription.method.toString());} else {- invocation = target.request().build(httpSubscription.method.toString(), Entity.entity(httpSubscription.body, httpSubscription.contentType));+ invocation = request.build(httpSubscription.method.toString(), Entity.entity(httpSubscription.body, httpSubscription.contentType));}Response response = invocation.invoke();response.close();diff --git a/container/src/main/java/org/openremote/container/web/DynamicTimeInjectorFilter.java b/container/src/main/java/org/openremote/container/web/DynamicTimeInjectorFilter.javanew file mode 100644index 000000000..3eb8baed7--- /dev/null+++ b/container/src/main/java/org/openremote/container/web/DynamicTimeInjectorFilter.java@@ -0,0 +1,90 @@+/*+ * Copyright 2024, OpenRemote Inc.+ *+ * See the CONTRIBUTORS.txt file in the distribution for a+ * full listing of individual contributors.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <http://www.gnu.org/licenses/>.+ */+package org.openremote.container.web;++import jakarta.ws.rs.client.ClientRequestContext;+import jakarta.ws.rs.client.ClientRequestFilter;+import jakarta.ws.rs.ext.Provider;++import java.io.IOException;+import java.net.URI;+import java.net.URISyntaxException;+import java.time.Instant;+import java.util.List;+import java.util.function.Supplier;++import static org.openremote.model.util.ValueUtil.doDynamicTimeReplace;++/**+ * A filter for replacing {@link org.openremote.model.Constants#DYNAMIC_TIME_PLACEHOLDER_REGEXP} in the request URI and+ * headers with the {@link #INSTANT_SUPPLIER_PROPERTY} from the request properties, this allows insertion of+ * dynamic timestamps into HTTP requests.+ */+@Provider+public class DynamicTimeInjectorFilter implements ClientRequestFilter {++ public static final String INSTANT_SUPPLIER_PROPERTY = DynamicTimeInjectorFilter.class.getName()+".instantSupplier";++ @SuppressWarnings("unchecked")+ @Override+ public void filter(ClientRequestContext requestContext) throws IOException {++ Supplier<Instant> instantSupplier = (Supplier<Instant>) requestContext.getProperty(DynamicTimeInjectorFilter.INSTANT_SUPPLIER_PROPERTY);++ if (instantSupplier == null) {+ return;+ }++ Instant instant = instantSupplier.get();++ try {++ // Query Parameters & Path++ URI oldURI = requestContext.getUri();+ String path = doDynamicTimeReplace(oldURI.getPath(), instant);+ String query = doDynamicTimeReplace(oldURI.getQuery(), instant);+ requestContext.setUri(new URI(+ oldURI.getScheme(),+ oldURI.getUserInfo(),+ oldURI.getHost(),+ oldURI.getPort(),+ path,+ query,+ oldURI.getFragment()+ ));++ // Headers++ if (requestContext.getHeaders() != null) {+ requestContext.getHeaders().forEach((key, values) -> {+ List<Object> replacedValues = values.stream().map(val -> {+ if (val instanceof String str) {+ return doDynamicTimeReplace(str, instant);+ } else {+ return val;+ }+ }).toList();+ requestContext.getHeaders().replace(key, replacedValues);+ });+ }+ } catch (URISyntaxException ignored) {}+ }+}diff --git a/container/src/main/java/org/openremote/container/web/DynamicValueInjectorFilter.java b/container/src/main/java/org/openremote/container/web/DynamicValueInjectorFilter.javanew file mode 100644index 000000000..b6172d52b--- /dev/null+++ b/container/src/main/java/org/openremote/container/web/DynamicValueInjectorFilter.java@@ -0,0 +1,87 @@+/*+ * Copyright 2017, OpenRemote Inc.+ *+ * See the CONTRIBUTORS.txt file in the distribution for a+ * full listing of individual contributors.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <http://www.gnu.org/licenses/>.+ */+package org.openremote.container.web;++import jakarta.ws.rs.client.ClientRequestContext;+import jakarta.ws.rs.client.ClientRequestFilter;+import jakarta.ws.rs.ext.Provider;++import java.io.IOException;+import java.net.URI;+import java.net.URISyntaxException;+import java.util.List;++import static org.openremote.model.util.ValueUtil.doDynamicValueReplace;++/**+ * A filter for replacing {@link org.openremote.model.Constants#DYNAMIC_VALUE_PLACEHOLDER_REGEXP} in the request URI and+ * headers with the {@link #DYNAMIC_VALUE_PROPERTY} from the request properties, this allows insertion of+ * dynamic values into HTTP requests.+ * <p>Dynamic time replacement has been moved to {@link DynamicTimeInjectorFilter#filter(ClientRequestContext)}.+ */+@Provider+public class DynamicValueInjectorFilter implements ClientRequestFilter {++ /**+ * Set a property on the request using this name to inject a dynamic value+ */+ public static final String DYNAMIC_VALUE_PROPERTY = DynamicValueInjectorFilter.class.getName() + ".dynamicValue";++ @Override+ public void filter(ClientRequestContext requestContext) throws IOException {++ if(!requestContext.getPropertyNames().contains(DYNAMIC_VALUE_PROPERTY)) return;++ String dynamicValue = requestContext.getProperty(DYNAMIC_VALUE_PROPERTY) != null ? (String) requestContext.getProperty(DYNAMIC_VALUE_PROPERTY) : "";++ try {++ // Query Parameters & Path++ URI oldURI = requestContext.getUri();+ String path = doDynamicValueReplace(oldURI.getPath(), dynamicValue);+ String query = doDynamicValueReplace(oldURI.getQuery(), dynamicValue);+ requestContext.setUri(new URI(+ oldURI.getScheme(),+ oldURI.getUserInfo(),+ oldURI.getHost(),+ oldURI.getPort(),+ path,+ query,+ oldURI.getFragment()+ ));++ // Headers++ if (requestContext.getHeaders() != null) {+ requestContext.getHeaders().forEach((key, values) -> {+ List<Object> replacedValues = values.stream().map(val -> {+ if (val instanceof String str) {+ return doDynamicValueReplace(str, dynamicValue);+ } else {+ return val;+ }+ }).toList();+ requestContext.getHeaders().replace(key, replacedValues);+ });+ }+ } catch (URISyntaxException ignored) {}+ }+}diff --git a/container/src/main/java/org/openremote/container/web/HeaderInjectorFilter.java b/container/src/main/java/org/openremote/container/web/HeaderInjectorFilter.javadeleted file mode 100644index 9ca9ccd7f..000000000--- a/container/src/main/java/org/openremote/container/web/HeaderInjectorFilter.java+++ /dev/null@@ -1,53 +0,0 @@-/*- * Copyright 2017, OpenRemote Inc.- *- * See the CONTRIBUTORS.txt file in the distribution for a- * full listing of individual contributors.- *- * This program is free software: you can redistribute it and/or modify- * it under the terms of the GNU Affero General Public License as- * published by the Free Software Foundation, either version 3 of the- * License, or (at your option) any later version.- *- * This program is distributed in the hope that it will be useful,- * but WITHOUT ANY WARRANTY; without even the implied warranty of- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- * GNU Affero General Public License for more details.- *- * You should have received a copy of the GNU Affero General Public License- * along with this program. If not, see <http://www.gnu.org/licenses/>.- */-package org.openremote.container.web;--import jakarta.ws.rs.client.ClientRequestContext;-import jakarta.ws.rs.client.ClientRequestFilter;-import java.io.IOException;-import java.util.List;-import java.util.Map;-import java.util.Set;--/**- * A filter for injecting headers into the request.- */-public class HeaderInjectorFilter implements ClientRequestFilter {-- protected Set<Map.Entry<String, List<String>>> headers;-- public HeaderInjectorFilter(Map<String, List<String>> headers) {- this.headers = headers.entrySet();- }-- @Override- public void filter(ClientRequestContext requestContext) throws IOException {- headers.forEach(headerAndValues -> {- if (headerAndValues.getValue().isEmpty()) {- requestContext.getHeaders().remove(headerAndValues.getKey());- } else {- requestContext- .getHeaders()- .addAll(headerAndValues.getKey(), headerAndValues.getValue().toArray());- }- }- );- }-}diff --git a/container/src/main/java/org/openremote/container/web/QueryParameterInjectorFilter.java b/container/src/main/java/org/openremote/container/web/QueryParameterInjectorFilter.javadeleted file mode 100644index 206292776..000000000--- a/container/src/main/java/org/openremote/container/web/QueryParameterInjectorFilter.java+++ /dev/null@@ -1,101 +0,0 @@-/*- * Copyright 2017, OpenRemote Inc.- *- * See the CONTRIBUTORS.txt file in the distribution for a- * full listing of individual contributors.- *- * This program is free software: you can redistribute it and/or modify- * it under the terms of the GNU Affero General Public License as- * published by the Free Software Foundation, either version 3 of the- * License, or (at your option) any later version.- *- * This program is distributed in the hope that it will be useful,- * but WITHOUT ANY WARRANTY; without even the implied warranty of- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- * GNU Affero General Public License for more details.- *- * You should have received a copy of the GNU Affero General Public License- * along with this program. If not, see <http://www.gnu.org/licenses/>.- */-package org.openremote.container.web;--import org.openremote.model.Constants;--import jakarta.ws.rs.client.ClientRequestContext;-import jakarta.ws.rs.client.ClientRequestFilter;-import jakarta.ws.rs.core.MultivaluedMap;-import jakarta.ws.rs.core.UriBuilder;-import jakarta.ws.rs.ext.Provider;-import java.io.IOException;-import java.time.Instant;-import java.time.ZoneId;-import java.time.format.DateTimeFormatter;-import java.util.regex.Matcher;-import java.util.regex.Pattern;--/**- * A filter for injecting query parameters into the request URI. The query parameters are extracted from the request- * property {@link #QUERY_PARAMETERS_PROPERTY}. Any {@link Constants#DYNAMIC_VALUE_PLACEHOLDER} in the query parameters- * will be replaced with the {@link #DYNAMIC_VALUE_PROPERTY} from the request. Any- * {@link Constants#DYNAMIC_TIME_PLACEHOLDER_REGEXP} in the query parameters will be replaced with the current system- * time in the specified format with optional offset.- */-@Provider-public class QueryParameterInjectorFilter implements ClientRequestFilter {-- /**- * Set a property on the request using this name to inject dynamic string values into- */- public static final String DYNAMIC_VALUE_PROPERTY = QueryParameterInjectorFilter.class.getName() + ".dynamicValue";-- /**- * Set a property on the request using this name to inject query parameters; the value should be a {@link- * MultivaluedMap}.- */- public static final String QUERY_PARAMETERS_PROPERTY = QueryParameterInjectorFilter.class.getName() + ".params";-- public static final Pattern DYNAMIC_TIME_PATTERN = Pattern.compile(Constants.DYNAMIC_TIME_PLACEHOLDER_REGEXP);-- @SuppressWarnings("unchecked")- @Override- public void filter(ClientRequestContext requestContext) throws IOException {-- MultivaluedMap<String, String> queryParameters = (MultivaluedMap<String, String>) requestContext.getProperty(QUERY_PARAMETERS_PROPERTY);- String dynamicValue = requestContext.getProperty(DYNAMIC_VALUE_PROPERTY) != null ? (String) requestContext.getProperty(DYNAMIC_VALUE_PROPERTY) : "";-- if (queryParameters == null) {- return;- }-- UriBuilder uriBuilder = UriBuilder.fromUri(requestContext.getUri());-- queryParameters.forEach((name, values) -> {-- Object[] formattedValues = values.stream().map(v -> {- v = v.replaceAll(Constants.DYNAMIC_VALUE_PLACEHOLDER_REGEXP, dynamicValue);-- Matcher matcher = DYNAMIC_TIME_PATTERN.matcher(v);-- if (matcher.find()) {- long millisToAdd = 0L;- DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME;-- if (matcher.groupCount() > 0) {- dateTimeFormatter = DateTimeFormatter.ofPattern(matcher.group(1));- }- if (matcher.groupCount() == 2) {- millisToAdd = Long.parseLong(matcher.group(2));- }-- v = v.replaceAll(Constants.DYNAMIC_TIME_PLACEHOLDER_REGEXP, dateTimeFormatter.format(Instant.now().plusMillis(millisToAdd).atZone(ZoneId.systemDefault())));- }-- return v;- }).toArray();-- uriBuilder.queryParam(name, formattedValues);- });-- requestContext.setUri(uriBuilder.build());- }-}diff --git a/container/src/main/java/org/openremote/container/web/WebTargetBuilder.java b/container/src/main/java/org/openremote/container/web/WebTargetBuilder.javaindex 8147cec3e..4d2317456 100644--- a/container/src/main/java/org/openremote/container/web/WebTargetBuilder.java+++ b/container/src/main/java/org/openremote/container/web/WebTargetBuilder.java@@ -19,7 +19,9 @@*/package org.openremote.container.web;+import jakarta.validation.constraints.NotNull;import jakarta.ws.rs.Priorities;+import jakarta.ws.rs.client.Invocation;import jakarta.ws.rs.client.WebTarget;import jakarta.ws.rs.core.MultivaluedHashMap;import jakarta.ws.rs.core.MultivaluedMap;@@ -40,6 +42,7 @@ import java.net.URI;import java.util.*;import java.util.concurrent.ExecutorService;import java.util.concurrent.TimeUnit;+import java.util.concurrent.atomic.AtomicReference;import java.util.function.UnaryOperator;import java.util.stream.Collectors;@@ -65,8 +68,6 @@ public class WebTargetBuilder {protected OAuthGrant oAuthGrant;protected URI baseUri;protected List<Integer> failureResponses = new ArrayList<>();- protected Map<String, List<String>> injectHeaders;- protected Map<String, List<String>> injectQueryParameters;protected boolean followRedirects = false;private Map<String, List<String>> overrideResponseHeaders;@@ -94,16 +95,6 @@ public class WebTargetBuilder {return this;}- public WebTargetBuilder setInjectHeaders(Map<String, List<String>> injectHeaders) {- this.injectHeaders = injectHeaders;- return this;- }-- public WebTargetBuilder setInjectQueryParameters(Map<String, List<String>> injectQueryParameters) {- this.injectQueryParameters = injectQueryParameters;- return this;- }-public WebTargetBuilder setOverrideResponseHeaders(Map<String, List<String>> overrideResponseHeaders) {this.overrideResponseHeaders = overrideResponseHeaders;return this;@@ -152,7 +143,8 @@ public class WebTargetBuilder {public ResteasyWebTarget build() {ResteasyWebTarget target = client.target(baseUri);- target.register(QueryParameterInjectorFilter.class);+ target.register(DynamicTimeInjectorFilter.class);+ target.register(DynamicValueInjectorFilter.class);if (!failureResponses.isEmpty()) {// Put a filter with max priority in the filter chain@@ -166,14 +158,6 @@ public class WebTargetBuilder {target.register(basicAuthentication, Priorities.AUTHENTICATION);}- if (injectHeaders != null) {- target.register(new HeaderInjectorFilter(injectHeaders));- }-- if (injectQueryParameters != null) {- target.property(QueryParameterInjectorFilter.QUERY_PARAMETERS_PROPERTY, mapToMultivaluedMap(injectQueryParameters, new MultivaluedHashMap<>()));- }-if (followRedirects) {target.register(new FollowRedirectFilter());}@@ -222,11 +206,28 @@ public class WebTargetBuilder {return clientBuilder.build();}- public static <K, V, W extends V> MultivaluedMap<K, V> mapToMultivaluedMap(Map<K, List<W>> map, MultivaluedMap<K, V> multivaluedMap) {+ public static <K, V, W extends V> MultivaluedMap<K, V> mapToMultivaluedMap(Map<K, List<W>> map) {+ MultivaluedMap<K, V> multivaluedMap = new MultivaluedHashMap<>();for (Map.Entry<K, List<W>> e : map.entrySet()) {multivaluedMap.put(e.getKey(), e.getValue() == null ? null : new ArrayList<>(e.getValue()));}-return multivaluedMap;}++ @SuppressWarnings("unchecked")+ public static <T extends WebTarget, V> T addQueryParams(@NotNull T webTarget, @NotNull Map<String, List<V>> multivaluedMap) {+ AtomicReference<T> result = new AtomicReference<>(webTarget);+ multivaluedMap.forEach((name, values) -> {+ result.set((T) result.get().queryParam(name, values.toArray()));+ });+ return result.get();+ }++ public static <V> Invocation.Builder addHeaders(@NotNull Invocation.Builder requestBuilder, @NotNull Map<String, List<V>> multiivaluedMap) {+ AtomicReference<Invocation.Builder> result = new AtomicReference<>(requestBuilder);+ multiivaluedMap.forEach((name, values) -> values.forEach(v -> {+ result.set(result.get().header(name, v));+ }));+ return result.get();+ }}diff --git a/manager/src/main/java/org/openremote/manager/webhook/WebhookService.java b/manager/src/main/java/org/openremote/manager/webhook/WebhookService.javaindex 47ee1dfab..ae97dd12f 100644--- a/manager/src/main/java/org/openremote/manager/webhook/WebhookService.java+++ b/manager/src/main/java/org/openremote/manager/webhook/WebhookService.java@@ -21,6 +21,7 @@ package org.openremote.manager.webhook;import jakarta.ws.rs.ProcessingException;import jakarta.ws.rs.client.Entity;+import jakarta.ws.rs.client.Invocation;import jakarta.ws.rs.client.WebTarget;import jakarta.ws.rs.core.MediaType;import jakarta.ws.rs.core.Response;@@ -31,7 +32,6 @@ import org.jboss.resteasy.client.jaxrs.internal.ResteasyClientBuilderImpl;import org.openremote.container.web.WebTargetBuilder;import org.openremote.model.Container;import org.openremote.model.ContainerService;-import org.openremote.model.http.HTTPMethod;import org.openremote.model.webhook.Webhook;import java.net.URI;@@ -81,7 +81,7 @@ public class WebhookService extends RouteBuilder implements ContainerService {public boolean sendHttpRequest(Webhook webhook, MediaType mediaType, WebTarget target) {- try (Response response = this.buildRequest(target, webhook.getHttpMethod(), mediaType, webhook.getPayload())) {+ try (Response response = this.buildRequest(webhook, target, mediaType)) {if (response.getStatusInfo().getFamily() != Response.Status.Family.SUCCESSFUL) {LOG.warning("Webhook request responded with error " + response.getStatus() + ": " + response.getStatusInfo().getReasonPhrase());} else {@@ -105,13 +105,16 @@ public class WebhookService extends RouteBuilder implements ContainerService {} else if (webhook.getOAuthGrant() != null) {builder.setOAuthAuthentication(webhook.getOAuthGrant());}- if (webhook.getHeaders() != null && !webhook.getHeaders().isEmpty()) {- builder.setInjectHeaders(webhook.getHeaders());- }return builder.build();}- private Response buildRequest(WebTarget target, HTTPMethod method, MediaType mediaType, String payload) throws ProcessingException {- return target.request().method(method.name(), (payload != null ? Entity.entity(payload, mediaType) : null));+ private Response buildRequest(Webhook webhook, WebTarget target, MediaType mediaType) throws ProcessingException {+ Invocation.Builder request = target.request();+ if (webhook.getHeaders() != null) {+ request = WebTargetBuilder.addHeaders(request, webhook.getHeaders());+ }+ Object payload = webhook.getPayload();++ return request.method(webhook.getHttpMethod().name(), (payload != null ? Entity.entity(payload, mediaType) : null));}}diff --git a/model/src/main/java/org/openremote/model/Constants.java b/model/src/main/java/org/openremote/model/Constants.javaindex 72b1ad3af..5c0904602 100644--- a/model/src/main/java/org/openremote/model/Constants.java+++ b/model/src/main/java/org/openremote/model/Constants.java@@ -84,12 +84,8 @@ public interface Constants {String IP_REGEXP = "((^\\s*((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)))|(^\\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))(%.+)?))$";String HTTP_URL_REGEXP = "^(http:\\/\\/www\\.|https:\\/\\/www\\.|http:\\/\\/|https:\\/\\/)?((((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)))|(((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))(%.+)?)|(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9]))+(\\.([A-Za-z]|[A-Za-z][A-Za-z0-9\\-]*[A-Za-z0-9]))*)(:[0-9]{1,5})?(\\/.*)?$";String WS_URL_REGEXP = "^(ws:\\/\\/www\\.|wss:\\/\\/www\\.|ws:\\/\\/|wss:\\/\\/)?((((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)))|(((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))(%.+)?)|(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9]))+(\\.([A-Za-z]|[A-Za-z][A-Za-z0-9\\-]*[A-Za-z0-9]))*)(:[0-9]{1,5})?(\\/.*)?$";- String DYNAMIC_VALUE_PLACEHOLDER = "{$value}";- String DYNAMIC_VALUE_PLACEHOLDER_REGEXP = "\"?\\{\\$value}\"?";- /**- * Specify to use time. First # delimiter used to specify format. Second # delimiter used to add or subtract millis- */- String DYNAMIC_TIME_PLACEHOLDER_REGEXP = "\"?\\{\\$time#?([a-z,A-Z,\\-,\\s,:]*)#?(-?\\d*)?}\"?";+ String DYNAMIC_VALUE_PLACEHOLDER_REGEXP = "\\%VALUE(?::([^:]+))?\\%";+ String DYNAMIC_TIME_PLACEHOLDER_REGEXP = "\\%TIME([+-]P\\w*)?(?::(.+))?\\%";static String[] units(String...units) {return units;@@ -152,4 +148,12 @@ public interface Constants {String UNITS_PART_PER_MILLION = "ppm";String UNITS_CARBON = "carbon";String UNITS_VAR = "var";++ static boolean containsDynamicValuePlaceholder(String str) {+ return str.contains("%VALUE");+ }++ static boolean containsDynamicTimePlaceholder(String str) {+ return str.contains("%TIME");+ }}diff --git a/model/src/main/java/org/openremote/model/asset/agent/AgentLink.java b/model/src/main/java/org/openremote/model/asset/agent/AgentLink.javaindex 726ae77fe..c40e96db5 100644--- a/model/src/main/java/org/openremote/model/asset/agent/AgentLink.java+++ b/model/src/main/java/org/openremote/model/asset/agent/AgentLink.java@@ -60,8 +60,8 @@ public abstract class AgentLink<T extends AgentLink<?>> implements Serializable@JsonSchemaInject(merge = false, jsonSupplierViaLookup = JSONSchemaUtil.SCHEMA_SUPPLIER_NAME_PATTERN_PROPERTIES_ANY_KEY_ANY_TYPE)@JsonPropertyDescription("Similar to valueConverter but will be applied to outgoing values allowing for the opposite conversion")protected Map<String, Object> writeValueConverter;- @JsonPropertyDescription("String to be used for attribute writes and can contain '" + Constants.DYNAMIC_VALUE_PLACEHOLDER +- "' placeholders to allow the written value to be injected into the string or to even hardcode the value written to the" ++ @JsonPropertyDescription("String to be used for attribute writes and can contain dynamic" ++ " placeholders to allow dynamic data to be injected into the string or to even hardcode the value written to the" +" protocol (particularly useful for executable attributes)")@JsonSchemaFormat("or-multiline")protected String writeValue;diff --git a/model/src/main/java/org/openremote/model/asset/agent/Protocol.java b/model/src/main/java/org/openremote/model/asset/agent/Protocol.javaindex 1292c9525..640c98471 100644--- a/model/src/main/java/org/openremote/model/asset/agent/Protocol.java+++ b/model/src/main/java/org/openremote/model/asset/agent/Protocol.java@@ -99,10 +99,8 @@ import static org.openremote.model.syslog.SyslogCategory.PROTOCOL;* <ol>* <li>Configurable value conversion which allows the value sent from the linked attribute to be converted in a* configurable way before being sent to the protocol for processing (see {@link AgentLink#getWriteValueConverter})- * <li>Configurable dynamic value insertion (replacement of {@link org.openremote.model.Constants#DYNAMIC_VALUE_PLACEHOLDER} strings within a- * pre-defined JSON string with the value sent from the linked attribute (this allows for attribute values to be inserted- * into a larger payload before processing by the protocol; it also allows the written value to be fixed or statically- * converted (see {@link AgentLink#getWriteValue}).+ * <li>Configurable dynamic data insertion into attribute write value before processing by the protocol; it also allows+ * the written value to be fixed or statically converted (see {@link AgentLink#getWriteValue}).* </ol>* When sending the converted value onto the actual protocol implementation for processing the original* {@link AttributeEvent} as well as the converted value should be made available.diff --git a/model/src/main/java/org/openremote/model/protocol/ProtocolUtil.java b/model/src/main/java/org/openremote/model/protocol/ProtocolUtil.javaindex 887441829..567e7b586 100644--- a/model/src/main/java/org/openremote/model/protocol/ProtocolUtil.java+++ b/model/src/main/java/org/openremote/model/protocol/ProtocolUtil.java@@ -1,5 +1,5 @@/*- * Copyright 2020, OpenRemote Inc.+ * Copyright 2024, OpenRemote Inc.** See the CONTRIBUTORS.txt file in the distribution for a* full listing of individual contributors.@@ -22,7 +22,6 @@ package org.openremote.model.protocol;import org.openremote.model.Constants;import org.openremote.model.asset.agent.AgentLink;import org.openremote.model.attribute.Attribute;-import org.openremote.model.attribute.AttributeInfo;import org.openremote.model.attribute.AttributeLink;import org.openremote.model.attribute.AttributeRef;import org.openremote.model.query.filter.ValuePredicate;@@ -33,6 +32,7 @@ import org.openremote.model.util.TsIgnore;import org.openremote.model.util.ValueUtil;import org.openremote.model.value.ValueFilter;+import java.time.Instant;import java.util.Locale;import java.util.Map;import java.util.Optional;@@ -42,7 +42,6 @@ import java.util.function.Consumer;import java.util.function.Supplier;import java.util.logging.Logger;-import static org.openremote.model.Constants.DYNAMIC_VALUE_PLACEHOLDER;import static org.openremote.model.syslog.SyslogCategory.PROTOCOL;import static org.openremote.model.util.ValueUtil.NULL_LITERAL;import static org.openremote.model.util.ValueUtil.applyValueFilters;@@ -61,7 +60,7 @@ public final class ProtocolUtil {* searched on every single write request (for performance reasons), instead this should be recorded when the* attribute is first linked.*/- public static Pair<Boolean, Object> doOutboundValueProcessing(String assetId, AttributeInfo attribute, AgentLink<?> agentLink, Object value, boolean containsDynamicPlaceholder) {+ public static Pair<Boolean, Object> doOutboundValueProcessing(AttributeRef attributeRef, AgentLink<?> agentLink, Object value, boolean containsDynamicPlaceholder, Instant instant) {String writeValue = agentLink.getWriteValue().orElse(null);@@ -70,7 +69,7 @@ public final class ProtocolUtil {// value conversionObject finalValue = value;ignoreAndConvertedValue = agentLink.getWriteValueConverter().map(converter -> {- LOG.finest("Applying attribute write value converter to attribute: assetId=" + assetId + ", attribute=" + attribute.getName());+ LOG.finest("Applying attribute write value converter to attribute: " + attributeRef);return applyValueConverter(finalValue, converter);}).orElse(new Pair<>(false, finalValue));@@ -80,14 +79,14 @@ public final class ProtocolUtil {value = ignoreAndConvertedValue.value;- // dynamic value insertion+ // dynamic placeholder insertionboolean hasWriteValue = !TextUtil.isNullOrEmpty(writeValue);if (hasWriteValue) {if (containsDynamicPlaceholder) {- String valueStr = value == null ? NULL_LITERAL : ValueUtil.convert(value, String.class);- writeValue = writeValue.replaceAll(Constants.DYNAMIC_VALUE_PLACEHOLDER_REGEXP, valueStr);+ writeValue = ValueUtil.doDynamicValueReplace(writeValue, value);+ writeValue = ValueUtil.doDynamicTimeReplace(writeValue, instant);}value = writeValue;@@ -96,8 +95,8 @@ public final class ProtocolUtil {return new Pair<>(false, value);}- public static boolean hasDynamicWriteValue(AgentLink<?> agentLink) {- return agentLink.getWriteValue().map(str -> str.contains(DYNAMIC_VALUE_PLACEHOLDER)).orElse(false);+ public static boolean hasDynamicPlaceholders(AgentLink<?> agentLink) {+ return agentLink.getWriteValue().map(str -> Constants.containsDynamicValuePlaceholder(str) || Constants.containsDynamicTimePlaceholder(str)).orElse(false);}/**@@ -112,7 +111,7 @@ public final class ProtocolUtil {// value filteringagentLink.getValueFilters().ifPresent(valueFilters -> {LOG.finest("Applying attribute value filters to attribute: assetId=" + assetId + ", attribute=" + attribute.getName());- Object o = ValueUtil.applyValueFilters(value, valueFilters);+ Object o = applyValueFilters(value, valueFilters);if (o == null) {LOG.info("Value filters generated a null value for attribute: assetId=" + assetId + ", attribute=" + attribute.getName());}diff --git a/model/src/main/java/org/openremote/model/util/ValueUtil.java b/model/src/main/java/org/openremote/model/util/ValueUtil.javaindex 7a3d18028..88c8a05f9 100644--- a/model/src/main/java/org/openremote/model/util/ValueUtil.java+++ b/model/src/main/java/org/openremote/model/util/ValueUtil.java@@ -65,7 +65,11 @@ import java.io.Serializable;import java.lang.reflect.*;import java.math.BigDecimal;import java.math.BigInteger;+import java.time.Duration;import java.time.Instant;+import java.time.ZoneId;+import java.time.ZonedDateTime;+import java.time.format.DateTimeFormatter;import java.util.*;import java.util.concurrent.ConcurrentHashMap;import java.util.concurrent.atomic.AtomicInteger;@@ -74,6 +78,8 @@ import java.util.function.Function;import java.util.function.Predicate;import java.util.logging.Level;import java.util.logging.Logger;+import java.util.regex.Matcher;+import java.util.regex.Pattern;import java.util.stream.Collectors;import java.util.stream.IntStream;@@ -1337,4 +1343,73 @@ public class ValueUtil {return new byte[0];}}++ public static String doDynamicTimeReplace(String str, Instant instant) {+ if (TextUtil.isNullOrEmpty(str)) {+ return str;+ }++ Pattern pattern = Pattern.compile(Constants.DYNAMIC_TIME_PLACEHOLDER_REGEXP);+ Matcher matcher = pattern.matcher(str);+ StringBuilder result = new StringBuilder();++ while (matcher.find()) {++ String durationStr = matcher.group(1);+ String formatStr = matcher.group(2);++ // Parse the duration+ if (durationStr != null) {+ Duration duration = Duration.parse(durationStr);+ instant = instant.plus(duration);+ }++ // Apply formatting+ if (formatStr == null) formatStr = "";++ String formattedDate = switch (formatStr) {+ case "" -> instant.toString();+ case "EPOCH_SECONDS" -> String.valueOf(instant.getEpochSecond());+ case "EPOCH_MILLIS" -> String.valueOf(instant.toEpochMilli());+ default -> {+ ZonedDateTime zonedDateTime = instant.atZone(ZoneId.systemDefault());+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern(formatStr);+ yield zonedDateTime.format(formatter);+ }+ };++ matcher.appendReplacement(result, formattedDate);+ }+ matcher.appendTail(result);++ return result.toString();+ }++ public static String doDynamicValueReplace(String str, Object value) {+ if (TextUtil.isNullOrEmpty(str)) {+ return str;+ }++ Pattern pattern = Pattern.compile(Constants.DYNAMIC_VALUE_PLACEHOLDER_REGEXP);+ Matcher matcher = pattern.matcher(str);++ StringBuilder result = new StringBuilder();++ while (matcher.find()) {++ String formatStr = matcher.group(1);+ String formattedValue;++ // Apply formatting+ if (TextUtil.isNullOrEmpty(formatStr)) {+ formattedValue = value == null ? NULL_LITERAL : ValueUtil.convert(value, String.class);+ } else {+ formattedValue = String.format(formatStr, value);+ }+ matcher.appendReplacement(result, formattedValue);+ }+ matcher.appendTail(result);++ return result.toString();+ }}diff --git a/test/src/test/groovy/org/openremote/test/protocol/http/HttpClientProtocolTest.groovy b/test/src/test/groovy/org/openremote/test/protocol/http/HttpClientProtocolTest.groovyindex 514881431..a06b3156f 100644--- a/test/src/test/groovy/org/openremote/test/protocol/http/HttpClientProtocolTest.groovy+++ b/test/src/test/groovy/org/openremote/test/protocol/http/HttpClientProtocolTest.groovy@@ -1,5 +1,5 @@/*- * Copyright 2017, OpenRemote Inc.+ * Copyright 2024, OpenRemote Inc.** See the CONTRIBUTORS.txt file in the distribution for a* full listing of individual contributors.@@ -19,7 +19,6 @@*/package org.openremote.test.protocol.http-import jakarta.ws.rs.HttpMethodimport jakarta.ws.rs.client.ClientRequestContextimport jakarta.ws.rs.client.ClientRequestFilter@@ -29,6 +28,7 @@ import org.jboss.resteasy.util.BasicAuthHelperimport org.openremote.agent.protocol.http.HTTPAgentimport org.openremote.agent.protocol.http.HTTPAgentLinkimport org.openremote.agent.protocol.http.HTTPProtocol+import org.openremote.container.timer.TimerServiceimport org.openremote.container.web.OAuthServerResponseimport org.openremote.manager.agent.AgentServiceimport org.openremote.manager.asset.AssetProcessingService@@ -52,8 +52,14 @@ import spock.lang.Sharedimport spock.lang.Specificationimport spock.util.concurrent.PollingConditions+import java.time.LocalDateTime+import java.time.ZoneId+import java.time.format.DateTimeFormatter+import java.time.temporal.ChronoField+import java.time.temporal.ChronoUnitimport java.util.regex.Pattern+import static org.openremote.model.util.ValueUtil.doDynamicTimeReplaceimport static org.openremote.model.value.MetaItemType.AGENT_LINKimport static org.openremote.model.value.ValueType.*@@ -211,6 +217,7 @@ class HttpClientProtocolTest extends Specification implements ManagerContainerTrfailureCount++requestContext.abortWith(Response.status(Response.Status.UNAUTHORIZED).build())return+case "https://mockapi/redirect":requestContext.abortWith(Response.temporaryRedirect(new URI("https://redirected.mockapi/get_success_200")).build())return@@ -221,6 +228,43 @@ class HttpClientProtocolTest extends Specification implements ManagerContainerTr).build())return+ case "https://mockapi/dynamic_time_1":+ pollCountFast+++ def uriInfo = new ResteasyUriInfo(requestContext.uri)+ def queryParams = uriInfo.getQueryParameters(true)+ def yearMonthDay = doDynamicTimeReplace('%TIME:yyyy-MM-dd%', getInstantTimeOf(container))+ def epochMillis = getInstantTimeOf(container).plus(1, ChronoUnit.HOURS).toEpochMilli()+ def epochSeconds = getInstantTimeOf(container).minus(50, ChronoUnit.DAYS).getEpochSecond()+ def localInstant = LocalDateTime.ofInstant(getInstantTimeOf(container), ZoneId.systemDefault())++ if (yearMonthDay.substring(4,5) != '-'+ || yearMonthDay.substring(7,8) != '-'+ || yearMonthDay.substring(0,4) != Integer.toString(localInstant.get(ChronoField.YEAR))+ || !yearMonthDay.substring(5,7).contains(Integer.toString(localInstant.get(ChronoField.MONTH_OF_YEAR)))+ || !yearMonthDay.substring(8,10).contains(Integer.toString(localInstant.get(ChronoField.DAY_OF_MONTH)))+ ) {+ requestContext.abortWith(Response.status(Response.Status.BAD_REQUEST).build())+ return+ }++ if (queryParams.get("param1").size() == 1+ && queryParams.getFirst("param1") == yearMonthDay+ && Long.parseLong(requestContext.getHeaderString("header1")) == epochMillis+ && Long.parseLong(requestContext.getHeaderString("header2")) == epochSeconds+ && requestContext.getHeaderString("header3") == DateTimeFormatter.ISO_INSTANT.format(getInstantTimeOf(container))) {++ String bodyStr = (String) requestContext.getEntity()+ Map body = (Map) ValueUtil.parse(bodyStr).orElse(null)+ if (body.containsKey("prop1")+ && body.get("prop1") == doDynamicTimeReplace("%TIME+PT1H:yyyy-MM-dd HH:mm%", getInstantTimeOf(container))) {+ requestContext.abortWith(+ Response+ .ok(requestContext.getEntity() as String, MediaType.APPLICATION_JSON_TYPE)+ .build()+ )+ return+ }+ }}requestContext.abortWith(Response.serverError().build())@@ -299,7 +343,7 @@ class HttpClientProtocolTest extends Specification implements ManagerContainerTrnew MetaItem<>(AGENT_LINK, new HTTPAgentLink(agent.id).setPath("put_request_with_headers").setMethod(HTTPMethod.PUT)- .setWriteValue('{"prop1": {$value}, "prop2": "prop2Value"}')+ .setWriteValue('{"prop1": %VALUE%, "prop2": "prop2Value"}').setContentType(MediaType.APPLICATION_JSON).setHeaders(new MultivaluedStringMap([@@ -318,7 +362,7 @@ class HttpClientProtocolTest extends Specification implements ManagerContainerTrnew Attribute<>("getRequestWithDynamicPath", BOOLEAN).addMeta(new MetaItem<>(AGENT_LINK, new HTTPAgentLink(agent.id)- .setPath('value/{$value}/set')+ .setPath('value/%VALUE%/set').setWriteValueConverter((Map)ValueUtil.parse("{\n" +" \"TRUE\": \"on\",\n" +" \"FALSE\": \"off\"\n" +@@ -549,4 +593,105 @@ class HttpClientProtocolTest extends Specification implements ManagerContainerTrHTTPProtocol.client.set(null)}}++ def "Check HTTP client dynamic time feature"() {++ given: "expected conditions"+ def conditions = new PollingConditions(timeout: 10, initialDelay: 1)++ and: "the HTTP client protocol min times are adjusted for testing"+ HTTPProtocol.MIN_POLLING_MILLIS = 10++ and: "the container starts"+ def container = startContainer(defaultConfig(), defaultServices())+ def assetStorageService = container.getService(AssetStorageService.class)+ def assetProcessingService = container.getService(AssetProcessingService.class)+ def agentService = container.getService(AgentService.class)+ def timerService = container.getService(TimerService.class)++++ when: "the web target builder is configured to use the mock server"+ HTTPProtocol.initClient()+ if (!HTTPProtocol.client.get().configuration.isRegistered(mockServer)) {+ HTTPProtocol.client.get().register(mockServer, Integer.MAX_VALUE)+ }+++ and: "a HTTP client agent is created"+ HTTPAgent agent = new HTTPAgent("Test agent")+ .setRealm(Constants.MASTER_REALM)+ .setBaseURI("https://mockapi")+ .setOAuthGrant(+ new OAuthPasswordGrant("https://mockapi/token",+ "TestClient",+ "TestSecret",+ "scope1 scope2",+ "testuser",+ "password")+ )+ .setFollowRedirects(true)++ and: "the agent is added to the asset service"+ agent = assetStorageService.merge(agent)++ then: "the protocol should authenticate and the connection status should become CONNECTED"+ conditions.eventually {+ agent = assetStorageService.find(agent.id, HTTPAgent.class)+ assert agent.getAgentStatus().orElse(ConnectionStatus.DISCONNECTED) == ConnectionStatus.CONNECTED+ }+++ when: "An asset is created"+ def asset = new ThingAsset("Test Asset")+ .setParent(agent)+ .addOrReplaceAttributes(+ // attribute that polls the server using GET and uses regex filter on response+ new Attribute<>("testPostRequest", TEXT)+ .addMeta(+ new MetaItem<>(AGENT_LINK, new HTTPAgentLink(agent.id)+ .setPath("dynamic_time_1")+ .setMethod(HTTPMethod.POST)+ .setPollingMillis(500)+ .setWriteValue('{"prop1": "%TIME+PT1H:yyyy-MM-dd HH:mm%"}')+ .setHeaders(new MultivaluedStringMap(+ [+ ("header1") : ['%TIME+PT1H:EPOCH_MILLIS%'],+ ("header2") : ['%TIME-P50D:EPOCH_SECONDS%'],+ ("header3") : ['%TIME%']+ ]+ ))+ .setQueryParameters(new MultivaluedStringMap(+ [+ ("param1") : ['%TIME:yyyy-MM-dd%']+ ]+ ))+ )+ )+ )++ and: "the clock is stopped"+ stopPseudoClock()++ and: "the asset is merged into the asset service"+ asset = assetStorageService.merge(asset)++ then: "new request maps should be created in the HTTP client protocol for the linked attributes"+ conditions.eventually {+ assert ((HTTPProtocol)agentService.getProtocolInstance(agent.id)).requestMap.size() == 1+ }++ and: "the attribute should be polling the server"+ conditions.eventually {+ assert mockServer.pollCountFast > 0+ }++ and: "the attribute value should contain the dynamic time (which means headers and query params are also correct)"+ conditions.eventually {+ String expectedPostRequest = doDynamicTimeReplace("%TIME+PT1H:yyyy-MM-dd HH:mm%", timerService.getNow())+ asset = assetStorageService.find(asset.getId(), true)+ assert asset.getAttribute("testPostRequest").flatMap {it.value}.orElse(null) == "{\"prop1\": \"${expectedPostRequest}\"}"+ }+ }}+diff --git a/test/src/test/groovy/org/openremote/test/protocol/http/WebTargetTest.groovy b/test/src/test/groovy/org/openremote/test/protocol/http/WebTargetTest.groovyindex 66e477638..82185fd1b 100644--- a/test/src/test/groovy/org/openremote/test/protocol/http/WebTargetTest.groovy+++ b/test/src/test/groovy/org/openremote/test/protocol/http/WebTargetTest.groovy@@ -19,25 +19,24 @@*/package org.openremote.test.protocol.http+import jakarta.ws.rs.client.ClientRequestContext+import jakarta.ws.rs.client.ClientRequestFilter+import jakarta.ws.rs.core.*import org.apache.http.client.utils.URIBuilderimport org.jboss.resteasy.client.jaxrs.ResteasyClientimport org.jboss.resteasy.specimpl.ResteasyUriInfoimport org.jboss.resteasy.util.BasicAuthHelper+import org.openremote.container.web.DynamicValueInjectorFilter+import org.openremote.container.web.OAuthServerResponse+import org.openremote.container.web.WebTargetBuilderimport org.openremote.model.auth.OAuthClientCredentialsGrantimport org.openremote.model.auth.OAuthGrantimport org.openremote.model.auth.OAuthPasswordGrantimport org.openremote.model.auth.OAuthRefreshTokenGrant-import org.openremote.container.web.OAuthServerResponse-import org.openremote.container.web.QueryParameterInjectorFilter-import org.openremote.container.web.WebTargetBuilderimport org.openremote.model.util.ValueUtilimport spock.lang.Sharedimport spock.lang.Specification-import jakarta.ws.rs.client.ClientRequestContext-import jakarta.ws.rs.client.ClientRequestFilter-import jakarta.ws.rs.core.*-class WebTargetTest extends Specification {@Shared@@ -154,7 +153,7 @@ class WebTargetTest extends Specification {case "https://headerserver/get":if (requestContext.getHeaderString("MyHeader") == "MyHeaderValue"&& requestContext.getHeaderString("MyHeaderNew") == "MyHeaderNewValue"- && requestContext.getHeaderString("MyMultiHeader") == "MyMultiHeaderValue3,MyMultiHeaderValue1,MyMultiHeaderValue2") {+ && requestContext.getHeaderString("MyMultiHeader") == "MyMultiHeaderValue1,MyMultiHeaderValue2,MyMultiHeaderValue3") {requestContext.abortWith(Response.ok().build())return}@@ -428,23 +427,20 @@ class WebTargetTest extends Specification {and: "a web target for a server"def target = new WebTargetBuilder(client, new URIBuilder("https://headerserver").build())- .setInjectHeaders(headers).build()when: "a request is made to the server"- def response = target.request().get()+ def request = target.request()+ request = WebTargetBuilder.addHeaders(request, headers)+ def response = request.get()then: "the response should be a 200 OK indicating the custom headers reached the server"assert response.getStatus() == 200when: "a request is made to the server with additional headers"- headers = new MultivaluedHashMap<String, String>(3)headers.add("MyHeaderNew", "MyHeaderNewValue")headers.add("MyMultiHeader", "MyMultiHeaderValue3")- response = target.path("get")- .request()- .headers(headers)- .get()+ response = WebTargetBuilder.addHeaders(target.path("get").request(), headers).get()then: "the response should be a 200 OK indicating the custom headers reached the server"assert response.getStatus() == 200@@ -474,23 +470,24 @@ class WebTargetTest extends Specification {and: "a web target for a server"def target = new WebTargetBuilder(client, new URIBuilder("https://paramserver").build())- .setInjectQueryParameters(params).build()+ and: "some query parameters"+ target = WebTargetBuilder.addQueryParams(target, params)+when: "a request is made to the server"def response = target.request().get()then: "the response should be a 200 OK indicating the query parameters reached the server"assert response.getStatus() == 200- when: "a request is made to the server with additional query parameters"- params = target.getConfiguration().getProperty(QueryParameterInjectorFilter.QUERY_PARAMETERS_PROPERTY) as MultivaluedMap<String, String>- params = new MultivaluedHashMap<String, String>(params)+ when: "a request is made to the server with a different path and additional query parameters"+ params = new MultivaluedHashMap<String, String>()params.add("param1", "param1Value2")params.add("param3", "param3Value1")-- response = target.path("get")- .property(QueryParameterInjectorFilter.QUERY_PARAMETERS_PROPERTY, params)+ def newTarget = target.path("get")+ newTarget = WebTargetBuilder.addQueryParams(newTarget, params)+ response = newTarget.request().get()@@ -502,17 +499,19 @@ class WebTargetTest extends Specification {given: "query parameters to inject with dynamic placeholders"def params = new MultivaluedHashMap<String, String>(2)- params.add("param1", "{\$value}")+ params.add("param1", "%VALUE%")params.put("param2", ["param2Value1","param2Value2"])and: "a web target for a server"def target = new WebTargetBuilder(client, new URIBuilder("https://dynamicparamserver").build())- .setInjectQueryParameters(params).build()- when: "a request is made to the server"+ and: "dynamic query params"+ target = WebTargetBuilder.addQueryParams(target, params)++ when: "a request is made to the server with a dynamic value"def response = target.request()- .property(QueryParameterInjectorFilter.DYNAMIC_VALUE_PROPERTY, "dynamicValue1")+ .property(DynamicValueInjectorFilter.DYNAMIC_VALUE_PROPERTY, "dynamicValue1").get()then: "the response should be a 200 OK indicating the query parameters reached the server"diff --git a/test/src/test/groovy/org/openremote/test/protocol/mqtt/MQTTClientProtocolTest.groovy b/test/src/test/groovy/org/openremote/test/protocol/mqtt/MQTTClientProtocolTest.groovyindex 71832040c..e691b31c4 100644--- a/test/src/test/groovy/org/openremote/test/protocol/mqtt/MQTTClientProtocolTest.groovy+++ b/test/src/test/groovy/org/openremote/test/protocol/mqtt/MQTTClientProtocolTest.groovy@@ -97,7 +97,7 @@ class MQTTClientProtocolTest extends Specification implements ManagerContainerTrnew MetaItem<>(AGENT_LINK, new MQTTAgentLink(agent.id).setSubscriptionTopic("${keycloakTestSetup.realmBuilding.name}/$clientId/${DefaultMQTTHandler.ATTRIBUTE_VALUE_TOPIC}/targetTemperature/${managerTestSetup.apartment1LivingroomId}").setPublishTopic("${keycloakTestSetup.realmBuilding.name}/$clientId/${DefaultMQTTHandler.ATTRIBUTE_VALUE_WRITE_TOPIC}/targetTemperature/${managerTestSetup.apartment1LivingroomId}")- .setWriteValue("${Constants.DYNAMIC_VALUE_PLACEHOLDER}")+ .setWriteValue("%VALUE%"))))diff --git a/test/src/test/groovy/org/openremote/test/protocol/udp/UdpClientProtocolTest.groovy b/test/src/test/groovy/org/openremote/test/protocol/udp/UdpClientProtocolTest.groovyindex 3b623c6a2..3e1d6e92e 100644--- a/test/src/test/groovy/org/openremote/test/protocol/udp/UdpClientProtocolTest.groovy+++ b/test/src/test/groovy/org/openremote/test/protocol/udp/UdpClientProtocolTest.groovy@@ -122,7 +122,7 @@ class UdpClientProtocolTest extends Specification implements ManagerContainerTranew Attribute<>("echoHello", TEXT).addMeta(new MetaItem<>(AGENT_LINK, new DefaultAgentLink(agent.id)- .setWriteValue('Hello {$value};'))+ .setWriteValue('Hello %VALUE%;'))),new Attribute<>("echoWorld", TEXT).addMeta(diff --git a/test/src/test/groovy/org/openremote/test/protocol/websocket/WebsocketClientProtocolTest.groovy b/test/src/test/groovy/org/openremote/test/protocol/websocket/WebsocketClientProtocolTest.groovyindex 2f603e9d4..973b15be4 100644--- a/test/src/test/groovy/org/openremote/test/protocol/websocket/WebsocketClientProtocolTest.groovy+++ b/test/src/test/groovy/org/openremote/test/protocol/websocket/WebsocketClientProtocolTest.groovy@@ -195,7 +195,7 @@ class WebsocketClientProtocolTest extends Specification implements ManagerContai"targetTemperature",0.12345)).orElse(ValueUtil.NULL_LITERAL)- .replace("0.12345", Constants.DYNAMIC_VALUE_PLACEHOLDER)+ .replace("0.12345", "%VALUE%")).setMessageMatchFilters([diff --git a/test/src/testFixtures/groovy/org/openremote/test/ManagerContainerTrait.groovy b/test/src/testFixtures/groovy/org/openremote/test/ManagerContainerTrait.groovyindex 2f6d74a9c..9fddb2e77 100644--- a/test/src/testFixtures/groovy/org/openremote/test/ManagerContainerTrait.groovy+++ b/test/src/testFixtures/groovy/org/openremote/test/ManagerContainerTrait.groovy@@ -9,6 +9,7 @@ import org.openremote.manager.mqtt.MQTTBrokerServiceimport org.openremote.model.ContainerServiceimport spock.util.concurrent.PollingConditions+import java.time.Instantimport java.util.concurrent.TimeUnitimport java.util.stream.Collectors@@ -58,7 +59,11 @@ trait ManagerContainerTrait extends ContainerTrait {}long getClockTimeOf(Container container) {- container.getService(TimerService.class).getClock().getCurrentTimeMillis()+ container.getService(TimerService.class).getCurrentTimeMillis()+ }++ Instant getInstantTimeOf(Container container) {+ container.getService(TimerService.class).getNow()}void advancePseudoClock(long amount, TimeUnit unit, Container container) {diff --git a/ui/component/or-attribute-input/src/index.ts b/ui/component/or-attribute-input/src/index.tsindex c5e2ada27..b5ace81c7 100644--- a/ui/component/or-attribute-input/src/index.ts+++ b/ui/component/or-attribute-input/src/index.ts@@ -172,7 +172,7 @@ export const jsonFormsInputTemplateProvider: (fallback: ValueInputProvider) => Vif (!schema) {// TODO: Load agent link schema from AssetModelUtil- schema = JSON.parse("{\"$schema\":\"http://json-schema.org/draft-07/schema#\",\"title\":\"Agent Link\",\"oneOf\":[{\"$ref\":\"#/definitions/SNMPAgentLink\"},{\"$ref\":\"#/definitions/HTTPAgentLink\"},{\"$ref\":\"#/definitions/DefaultAgentLink\"},{\"$ref\":\"#/definitions/ZWaveAgentLink\"},{\"$ref\":\"#/definitions/WebsocketAgentLink\"},{\"$ref\":\"#/definitions/StorageSimulatorAgentLink\"},{\"$ref\":\"#/definitions/MockAgentLink\"},{\"$ref\":\"#/definitions/BluetoothMeshAgentLink\"},{\"$ref\":\"#/definitions/MQTTAgentLink\"},{\"$ref\":\"#/definitions/KNXAgentLink\"},{\"$ref\":\"#/definitions/SimulatorAgentLink\"},{\"$ref\":\"#/definitions/VelbusAgentLink\"}],\"definitions\":{\"SNMPAgentLink\":{\"type\":\"object\",\"additionalProperties\":true,\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"SNMPAgentLink\"],\"default\":\"SNMPAgentLink\"},\"id\":{\"type\":\"string\",\"format\":\"or-agent-id\"},\"valueFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order\"},\"valueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValue\":{\"type\":\"string\",\"format\":\"or-multiline\",\"description\":\"String to be used for attribute writes and can contain '{$value}' placeholders to allow the written value to be injected into the string or to even hardcode the value written to the protocol (particularly useful for executable attributes)\"},\"messageMatchPredicate\":{\"oneOf\":[{\"$ref\":\"#/definitions/StringPredicate\"},{\"$ref\":\"#/definitions/BooleanPredicate\"},{\"$ref\":\"#/definitions/DateTimePredicate\"},{\"$ref\":\"#/definitions/NumberPredicate\"},{\"$ref\":\"#/definitions/RadialGeofencePredicate\"},{\"$ref\":\"#/definitions/RectangularGeofencePredicate\"},{\"$ref\":\"#/definitions/ArrayPredicate\"},{\"$ref\":\"#/definitions/ValueAnyPredicate\"},{\"$ref\":\"#/definitions/ValueEmptyPredicate\"},{\"$ref\":\"#/definitions/CalendarEventPredicate\"}],\"description\":\"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent.\"},\"messageMatchFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate\"},\"updateOnWrite\":{\"type\":\"boolean\",\"description\":\"Don't expect a response from the protocol just update the attribute immediately on write\"},\"oid\":{\"type\":\"string\"}},\"title\":\"SNMPAgentLink\",\"required\":[\"type\",\"oid\"]},\"regex\":{\"type\":\"object\",\"additionalProperties\":true,\"title\":\"Regex\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"regex\"],\"default\":\"regex\"},\"pattern\":{\"type\":\"string\"},\"matchGroup\":{\"type\":\"integer\"},\"matchIndex\":{\"type\":\"integer\"}},\"required\":[\"type\"]},\"substring\":{\"type\":\"object\",\"additionalProperties\":true,\"title\":\"Substring\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"substring\"],\"default\":\"substring\"},\"beginIndex\":{\"type\":\"integer\"},\"endIndex\":{\"type\":\"integer\"}},\"required\":[\"type\",\"beginIndex\"]},\"jsonPath\":{\"type\":\"object\",\"additionalProperties\":true,\"title\":\"JSON Path\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"jsonPath\"],\"default\":\"jsonPath\"},\"path\":{\"type\":\"string\"},\"returnFirst\":{\"type\":\"boolean\"},\"returnLast\":{\"type\":\"boolean\"}},\"required\":[\"type\",\"path\",\"returnFirst\",\"returnLast\"]},\"PatternPropertiesSimpleKeyAnyType\":{\"type\":\"object\",\"additionalProperties\":true,\"patternProperties\":{\"^[a-zA-Z][a-zA-Z0-9]*\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}},\"properties\":{}},\"StringPredicate\":{\"type\":\"object\",\"additionalProperties\":true,\"description\":\"Predicate for string values; will match based on configured options.\",\"properties\":{\"predicateType\":{\"type\":\"string\",\"enum\":[\"string\"],\"default\":\"string\"},\"match\":{\"type\":\"string\",\"enum\":[\"EXACT\",\"BEGIN\",\"END\",\"CONTAINS\"]},\"caseSensitive\":{\"type\":\"boolean\"},\"value\":{\"type\":\"string\"},\"negate\":{\"type\":\"boolean\"}},\"title\":\"string\",\"required\":[\"predicateType\",\"caseSensitive\",\"negate\"]},\"BooleanPredicate\":{\"type\":\"object\",\"additionalProperties\":true,\"description\":\"Predicate for boolean values; will evaluate the value as a boolean and match against this predicates value, any value that is not a boolean will not match\",\"properties\":{\"predicateType\":{\"type\":\"string\",\"enum\":[\"boolean\"],\"default\":\"boolean\"},\"value\":{\"type\":\"boolean\"}},\"title\":\"boolean\",\"required\":[\"predicateType\",\"value\"]},\"DateTimePredicate\":{\"type\":\"object\",\"additionalProperties\":true,\"description\":\"Predicate for date time values; provided values should be valid ISO 8601 datetime strings (e.g. yyyy-MM-dd'T'HH:mm:ssZ or yyyy-MM-dd'T'HH:mm:ss±HH:mm), offset and time are optional, if no offset information is supplied then UTC is assumed.\",\"properties\":{\"predicateType\":{\"type\":\"string\",\"enum\":[\"datetime\"],\"default\":\"datetime\"},\"value\":{\"type\":\"string\"},\"rangeValue\":{\"type\":\"string\"},\"operator\":{\"type\":\"string\",\"enum\":[\"EQUALS\",\"GREATER_THAN\",\"GREATER_EQUALS\",\"LESS_THAN\",\"LESS_EQUALS\",\"BETWEEN\"]},\"negate\":{\"type\":\"boolean\"}},\"title\":\"datetime\",\"required\":[\"predicateType\",\"negate\"]},\"NumberPredicate\":{\"type\":\"object\",\"additionalProperties\":true,\"description\":\"Predicate for number values; will match based on configured options.\",\"properties\":{\"predicateType\":{\"type\":\"string\",\"enum\":[\"number\"],\"default\":\"number\"},\"value\":{\"type\":\"number\"},\"rangeValue\":{\"type\":\"number\"},\"operator\":{\"type\":\"string\",\"enum\":[\"EQUALS\",\"GREATER_THAN\",\"GREATER_EQUALS\",\"LESS_THAN\",\"LESS_EQUALS\",\"BETWEEN\"]},\"negate\":{\"type\":\"boolean\"}},\"title\":\"number\",\"required\":[\"predicateType\",\"negate\"]},\"RadialGeofencePredicate\":{\"type\":\"object\",\"additionalProperties\":true,\"description\":\"Predicate for GEO JSON point values; will return true if the point is within the specified radius of the specified latitude and longitude unless negated.\",\"title\":\"Radial geofence\",\"properties\":{\"predicateType\":{\"type\":\"string\",\"enum\":[\"radial\"],\"default\":\"radial\"},\"radius\":{\"type\":\"integer\"},\"lat\":{\"type\":\"number\"},\"lng\":{\"type\":\"number\"},\"negated\":{\"type\":\"boolean\"}},\"required\":[\"predicateType\",\"radius\",\"lat\",\"lng\",\"negated\"]},\"RectangularGeofencePredicate\":{\"type\":\"object\",\"additionalProperties\":true,\"description\":\"Predicate for GEO JSON point values; will return true if the point is within the specified rectangle specified as latitude and longitude values of two corners unless negated.\",\"title\":\"Rectangular geofence\",\"properties\":{\"predicateType\":{\"type\":\"string\",\"enum\":[\"rect\"],\"default\":\"rect\"},\"latMin\":{\"type\":\"number\"},\"lngMin\":{\"type\":\"number\"},\"latMax\":{\"type\":\"number\"},\"lngMax\":{\"type\":\"number\"},\"negated\":{\"type\":\"boolean\"}},\"required\":[\"predicateType\",\"latMin\",\"lngMin\",\"latMax\",\"lngMax\",\"negated\"]},\"ArrayPredicate\":{\"type\":\"object\",\"additionalProperties\":true,\"description\":\"Predicate for array values; will match based on configured options.\",\"properties\":{\"predicateType\":{\"type\":\"string\",\"enum\":[\"array\"],\"default\":\"array\"},\"value\":{\"$ref\":\"#/definitions/AnyType\"},\"index\":{\"type\":\"integer\"},\"lengthEquals\":{\"type\":\"integer\"},\"lengthGreaterThan\":{\"type\":\"integer\"},\"lengthLessThan\":{\"type\":\"integer\"},\"negated\":{\"type\":\"boolean\"}},\"title\":\"array\",\"required\":[\"predicateType\",\"negated\"]},\"AnyType\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"],\"additionalProperties\":true,\"properties\":{}},\"ValueAnyPredicate\":{\"type\":\"object\",\"additionalProperties\":true,\"description\":\"Predicate that matches any value including null.\",\"title\":\"Any value\",\"properties\":{\"predicateType\":{\"type\":\"string\",\"enum\":[\"value-any\"],\"default\":\"value-any\"}},\"required\":[\"predicateType\"]},\"ValueEmptyPredicate\":{\"type\":\"object\",\"additionalProperties\":true,\"description\":\"Predicate that matches any empty/null value; unless negated.\",\"title\":\"Empty value\",\"properties\":{\"predicateType\":{\"type\":\"string\",\"enum\":[\"value-empty\"],\"default\":\"value-empty\"},\"negate\":{\"type\":\"boolean\"}},\"required\":[\"predicateType\",\"negate\"]},\"CalendarEventPredicate\":{\"type\":\"object\",\"additionalProperties\":true,\"description\":\"Predicate for calendar event values; will match based on whether the calendar event is active for the specified time.\",\"title\":\"Calendar\",\"properties\":{\"predicateType\":{\"type\":\"string\",\"enum\":[\"calendar-event\"],\"default\":\"calendar-event\"},\"timestamp\":{\"type\":\"integer\",\"format\":\"utc-millisec\"}},\"required\":[\"predicateType\"]},\"HTTPAgentLink\":{\"type\":\"object\",\"additionalProperties\":true,\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"HTTPAgentLink\"],\"default\":\"HTTPAgentLink\"},\"id\":{\"type\":\"string\",\"format\":\"or-agent-id\"},\"valueFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order\"},\"valueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValue\":{\"type\":\"string\",\"format\":\"or-multiline\",\"description\":\"String to be used for attribute writes and can contain '{$value}' placeholders to allow the written value to be injected into the string or to even hardcode the value written to the protocol (particularly useful for executable attributes)\"},\"messageMatchPredicate\":{\"oneOf\":[{\"$ref\":\"#/definitions/StringPredicate\"},{\"$ref\":\"#/definitions/BooleanPredicate\"},{\"$ref\":\"#/definitions/DateTimePredicate\"},{\"$ref\":\"#/definitions/NumberPredicate\"},{\"$ref\":\"#/definitions/RadialGeofencePredicate\"},{\"$ref\":\"#/definitions/RectangularGeofencePredicate\"},{\"$ref\":\"#/definitions/ArrayPredicate\"},{\"$ref\":\"#/definitions/ValueAnyPredicate\"},{\"$ref\":\"#/definitions/ValueEmptyPredicate\"},{\"$ref\":\"#/definitions/CalendarEventPredicate\"}],\"description\":\"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent.\"},\"messageMatchFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate\"},\"updateOnWrite\":{\"type\":\"boolean\",\"description\":\"Don't expect a response from the protocol just update the attribute immediately on write\"},\"headers\":{\"type\":\"object\",\"additionalProperties\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"description\":\"A JSON object of headers to be added to HTTP request; the key represents the name of the header and for each string value supplied a new header will be added with the key name and specified string value\"},\"queryParameters\":{\"type\":\"object\",\"additionalProperties\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"description\":\"A JSON object of query parameters to be added to HTTP request URL; the key represents the name of the query parameter and for each string value supplied a new query parameter will be added with the key name and specified string value (e.g. 'https://..../?test=1&test=2')\"},\"pollingMillis\":{\"type\":\"integer\",\"description\":\"Indicates that this HTTP request is used to update the linked attribute; this value indicates how frequently the HTTP request is made in order to update the linked attribute value\"},\"pagingMode\":{\"type\":\"boolean\",\"description\":\"Indicates that the HTTP server supports pagination using the standard Link header mechanism\"},\"path\":{\"type\":\"string\",\"description\":\"The URL path to append to the agents Base URL when making requests for this linked attribute\"},\"method\":{\"type\":\"string\",\"enum\":[\"GET\",\"POST\",\"PUT\",\"DELETE\",\"OPTIONS\",\"PATCH\"],\"description\":\"The HTTP method to use when making requests for this linked attribute\"},\"contentType\":{\"type\":\"string\",\"description\":\"The content type header value to use when making requests for this linked attribute (shortcut alternative to using headers parameter)\"},\"pollingAttribute\":{\"type\":\"string\",\"description\":\"Allows the polled response to be written to another attribute with the specified name on the same asset as the linked attribute\"},\"messageConvertBinary\":{\"type\":\"boolean\",\"description\":\"Indicates that the HTTP response is binary and should be converted to binary string representation\"},\"messageConvertHex\":{\"type\":\"boolean\",\"description\":\"Indicates that the HTTP response is binary and should be converted to hexidecimal string representation\"}},\"title\":\"HTTPAgentLink\",\"required\":[\"type\",\"messageConvertBinary\",\"messageConvertHex\"]},\"DefaultAgentLink\":{\"type\":\"object\",\"additionalProperties\":true,\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"DefaultAgentLink\"],\"default\":\"DefaultAgentLink\"},\"id\":{\"type\":\"string\",\"format\":\"or-agent-id\"},\"valueFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order\"},\"valueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValue\":{\"type\":\"string\",\"format\":\"or-multiline\",\"description\":\"String to be used for attribute writes and can contain '{$value}' placeholders to allow the written value to be injected into the string or to even hardcode the value written to the protocol (particularly useful for executable attributes)\"},\"messageMatchPredicate\":{\"oneOf\":[{\"$ref\":\"#/definitions/StringPredicate\"},{\"$ref\":\"#/definitions/BooleanPredicate\"},{\"$ref\":\"#/definitions/DateTimePredicate\"},{\"$ref\":\"#/definitions/NumberPredicate\"},{\"$ref\":\"#/definitions/RadialGeofencePredicate\"},{\"$ref\":\"#/definitions/RectangularGeofencePredicate\"},{\"$ref\":\"#/definitions/ArrayPredicate\"},{\"$ref\":\"#/definitions/ValueAnyPredicate\"},{\"$ref\":\"#/definitions/ValueEmptyPredicate\"},{\"$ref\":\"#/definitions/CalendarEventPredicate\"}],\"description\":\"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent.\"},\"messageMatchFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate\"},\"updateOnWrite\":{\"type\":\"boolean\",\"description\":\"Don't expect a response from the protocol just update the attribute immediately on write\"}},\"title\":\"DefaultAgentLink\",\"required\":[\"type\"]},\"ZWaveAgentLink\":{\"type\":\"object\",\"additionalProperties\":true,\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"ZWaveAgentLink\"],\"default\":\"ZWaveAgentLink\"},\"id\":{\"type\":\"string\",\"format\":\"or-agent-id\"},\"valueFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order\"},\"valueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValue\":{\"type\":\"string\",\"format\":\"or-multiline\",\"description\":\"String to be used for attribute writes and can contain '{$value}' placeholders to allow the written value to be injected into the string or to even hardcode the value written to the protocol (particularly useful for executable attributes)\"},\"messageMatchPredicate\":{\"oneOf\":[{\"$ref\":\"#/definitions/StringPredicate\"},{\"$ref\":\"#/definitions/BooleanPredicate\"},{\"$ref\":\"#/definitions/DateTimePredicate\"},{\"$ref\":\"#/definitions/NumberPredicate\"},{\"$ref\":\"#/definitions/RadialGeofencePredicate\"},{\"$ref\":\"#/definitions/RectangularGeofencePredicate\"},{\"$ref\":\"#/definitions/ArrayPredicate\"},{\"$ref\":\"#/definitions/ValueAnyPredicate\"},{\"$ref\":\"#/definitions/ValueEmptyPredicate\"},{\"$ref\":\"#/definitions/CalendarEventPredicate\"}],\"description\":\"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent.\"},\"messageMatchFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate\"},\"updateOnWrite\":{\"type\":\"boolean\",\"description\":\"Don't expect a response from the protocol just update the attribute immediately on write\"},\"deviceNodeId\":{\"type\":\"integer\"},\"deviceEndpoint\":{\"type\":\"integer\"},\"deviceValue\":{\"type\":\"string\"}},\"title\":\"ZWaveAgentLink\",\"required\":[\"type\"]},\"WebsocketAgentLink\":{\"type\":\"object\",\"additionalProperties\":true,\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"WebsocketAgentLink\"],\"default\":\"WebsocketAgentLink\"},\"id\":{\"type\":\"string\",\"format\":\"or-agent-id\"},\"valueFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order\"},\"valueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValue\":{\"type\":\"string\",\"format\":\"or-multiline\",\"description\":\"String to be used for attribute writes and can contain '{$value}' placeholders to allow the written value to be injected into the string or to even hardcode the value written to the protocol (particularly useful for executable attributes)\"},\"messageMatchPredicate\":{\"oneOf\":[{\"$ref\":\"#/definitions/StringPredicate\"},{\"$ref\":\"#/definitions/BooleanPredicate\"},{\"$ref\":\"#/definitions/DateTimePredicate\"},{\"$ref\":\"#/definitions/NumberPredicate\"},{\"$ref\":\"#/definitions/RadialGeofencePredicate\"},{\"$ref\":\"#/definitions/RectangularGeofencePredicate\"},{\"$ref\":\"#/definitions/ArrayPredicate\"},{\"$ref\":\"#/definitions/ValueAnyPredicate\"},{\"$ref\":\"#/definitions/ValueEmptyPredicate\"},{\"$ref\":\"#/definitions/CalendarEventPredicate\"}],\"description\":\"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent.\"},\"messageMatchFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate\"},\"updateOnWrite\":{\"type\":\"boolean\",\"description\":\"Don't expect a response from the protocol just update the attribute immediately on write\"},\"websocketSubscriptions\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/websocket\"},{\"$ref\":\"#/definitions/http\"}]}}},\"title\":\"WebsocketAgentLink\",\"required\":[\"type\"]},\"websocket\":{\"type\":\"object\",\"additionalProperties\":true,\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"websocket\"],\"default\":\"websocket\"},\"body\":{\"$ref\":\"#/definitions/AnyType\"}},\"title\":\"websocket\",\"required\":[\"type\"]},\"http\":{\"type\":\"object\",\"additionalProperties\":true,\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"http\"],\"default\":\"http\"},\"body\":{\"$ref\":\"#/definitions/AnyType\"},\"method\":{\"type\":\"string\",\"enum\":[\"GET\",\"PUT\",\"POST\"]},\"contentType\":{\"type\":\"string\"},\"headers\":{\"type\":\"object\",\"additionalProperties\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}}},\"uri\":{\"type\":\"string\"}},\"title\":\"http\",\"required\":[\"type\"]},\"StorageSimulatorAgentLink\":{\"type\":\"object\",\"additionalProperties\":true,\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"StorageSimulatorAgentLink\"],\"default\":\"StorageSimulatorAgentLink\"},\"id\":{\"type\":\"string\",\"format\":\"or-agent-id\"},\"valueFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order\"},\"valueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValue\":{\"type\":\"string\",\"format\":\"or-multiline\",\"description\":\"String to be used for attribute writes and can contain '{$value}' placeholders to allow the written value to be injected into the string or to even hardcode the value written to the protocol (particularly useful for executable attributes)\"},\"messageMatchPredicate\":{\"oneOf\":[{\"$ref\":\"#/definitions/StringPredicate\"},{\"$ref\":\"#/definitions/BooleanPredicate\"},{\"$ref\":\"#/definitions/DateTimePredicate\"},{\"$ref\":\"#/definitions/NumberPredicate\"},{\"$ref\":\"#/definitions/RadialGeofencePredicate\"},{\"$ref\":\"#/definitions/RectangularGeofencePredicate\"},{\"$ref\":\"#/definitions/ArrayPredicate\"},{\"$ref\":\"#/definitions/ValueAnyPredicate\"},{\"$ref\":\"#/definitions/ValueEmptyPredicate\"},{\"$ref\":\"#/definitions/CalendarEventPredicate\"}],\"description\":\"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent.\"},\"messageMatchFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate\"},\"updateOnWrite\":{\"type\":\"boolean\",\"description\":\"Don't expect a response from the protocol just update the attribute immediately on write\"}},\"title\":\"StorageSimulatorAgentLink\",\"required\":[\"type\"]},\"MockAgentLink\":{\"type\":\"object\",\"additionalProperties\":true,\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"MockAgentLink\"],\"default\":\"MockAgentLink\"},\"id\":{\"type\":\"string\",\"format\":\"or-agent-id\"},\"valueFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order\"},\"valueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValue\":{\"type\":\"string\",\"format\":\"or-multiline\",\"description\":\"String to be used for attribute writes and can contain '{$value}' placeholders to allow the written value to be injected into the string or to even hardcode the value written to the protocol (particularly useful for executable attributes)\"},\"messageMatchPredicate\":{\"oneOf\":[{\"$ref\":\"#/definitions/StringPredicate\"},{\"$ref\":\"#/definitions/BooleanPredicate\"},{\"$ref\":\"#/definitions/DateTimePredicate\"},{\"$ref\":\"#/definitions/NumberPredicate\"},{\"$ref\":\"#/definitions/RadialGeofencePredicate\"},{\"$ref\":\"#/definitions/RectangularGeofencePredicate\"},{\"$ref\":\"#/definitions/ArrayPredicate\"},{\"$ref\":\"#/definitions/ValueAnyPredicate\"},{\"$ref\":\"#/definitions/ValueEmptyPredicate\"},{\"$ref\":\"#/definitions/CalendarEventPredicate\"}],\"description\":\"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent.\"},\"messageMatchFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate\"},\"updateOnWrite\":{\"type\":\"boolean\",\"description\":\"Don't expect a response from the protocol just update the attribute immediately on write\"},\"requiredValue\":{\"type\":\"string\"}},\"title\":\"MockAgentLink\",\"required\":[\"type\"]},\"BluetoothMeshAgentLink\":{\"type\":\"object\",\"additionalProperties\":true,\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"BluetoothMeshAgentLink\"],\"default\":\"BluetoothMeshAgentLink\"},\"id\":{\"type\":\"string\",\"format\":\"or-agent-id\"},\"valueFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order\"},\"valueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValue\":{\"type\":\"string\",\"format\":\"or-multiline\",\"description\":\"String to be used for attribute writes and can contain '{$value}' placeholders to allow the written value to be injected into the string or to even hardcode the value written to the protocol (particularly useful for executable attributes)\"},\"messageMatchPredicate\":{\"oneOf\":[{\"$ref\":\"#/definitions/StringPredicate\"},{\"$ref\":\"#/definitions/BooleanPredicate\"},{\"$ref\":\"#/definitions/DateTimePredicate\"},{\"$ref\":\"#/definitions/NumberPredicate\"},{\"$ref\":\"#/definitions/RadialGeofencePredicate\"},{\"$ref\":\"#/definitions/RectangularGeofencePredicate\"},{\"$ref\":\"#/definitions/ArrayPredicate\"},{\"$ref\":\"#/definitions/ValueAnyPredicate\"},{\"$ref\":\"#/definitions/ValueEmptyPredicate\"},{\"$ref\":\"#/definitions/CalendarEventPredicate\"}],\"description\":\"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent.\"},\"messageMatchFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate\"},\"updateOnWrite\":{\"type\":\"boolean\",\"description\":\"Don't expect a response from the protocol just update the attribute immediately on write\"},\"appKeyIndex\":{\"type\":\"integer\",\"minimum\":0,\"maximum\":2147483647},\"address\":{\"type\":\"string\",\"pattern\":\"^([0-9A-Fa-f]{4})$\"},\"modelName\":{\"type\":\"string\",\"pattern\":\"^.*\\\\S+.*$\",\"minLength\":1}},\"title\":\"BluetoothMeshAgentLink\",\"required\":[\"type\",\"appKeyIndex\",\"modelName\"]},\"MQTTAgentLink\":{\"type\":\"object\",\"additionalProperties\":true,\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"MQTTAgentLink\"],\"default\":\"MQTTAgentLink\"},\"id\":{\"type\":\"string\",\"format\":\"or-agent-id\"},\"valueFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order\"},\"valueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValue\":{\"type\":\"string\",\"format\":\"or-multiline\",\"description\":\"String to be used for attribute writes and can contain '{$value}' placeholders to allow the written value to be injected into the string or to even hardcode the value written to the protocol (particularly useful for executable attributes)\"},\"messageMatchPredicate\":{\"oneOf\":[{\"$ref\":\"#/definitions/StringPredicate\"},{\"$ref\":\"#/definitions/BooleanPredicate\"},{\"$ref\":\"#/definitions/DateTimePredicate\"},{\"$ref\":\"#/definitions/NumberPredicate\"},{\"$ref\":\"#/definitions/RadialGeofencePredicate\"},{\"$ref\":\"#/definitions/RectangularGeofencePredicate\"},{\"$ref\":\"#/definitions/ArrayPredicate\"},{\"$ref\":\"#/definitions/ValueAnyPredicate\"},{\"$ref\":\"#/definitions/ValueEmptyPredicate\"},{\"$ref\":\"#/definitions/CalendarEventPredicate\"}],\"description\":\"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent.\"},\"messageMatchFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate\"},\"updateOnWrite\":{\"type\":\"boolean\",\"description\":\"Don't expect a response from the protocol just update the attribute immediately on write\"},\"subscriptionTopic\":{\"type\":\"string\"},\"publishTopic\":{\"type\":\"string\"}},\"title\":\"MQTTAgentLink\",\"required\":[\"type\"]},\"KNXAgentLink\":{\"type\":\"object\",\"additionalProperties\":true,\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"KNXAgentLink\"],\"default\":\"KNXAgentLink\"},\"id\":{\"type\":\"string\",\"format\":\"or-agent-id\"},\"valueFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order\"},\"valueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValue\":{\"type\":\"string\",\"format\":\"or-multiline\",\"description\":\"String to be used for attribute writes and can contain '{$value}' placeholders to allow the written value to be injected into the string or to even hardcode the value written to the protocol (particularly useful for executable attributes)\"},\"messageMatchPredicate\":{\"oneOf\":[{\"$ref\":\"#/definitions/StringPredicate\"},{\"$ref\":\"#/definitions/BooleanPredicate\"},{\"$ref\":\"#/definitions/DateTimePredicate\"},{\"$ref\":\"#/definitions/NumberPredicate\"},{\"$ref\":\"#/definitions/RadialGeofencePredicate\"},{\"$ref\":\"#/definitions/RectangularGeofencePredicate\"},{\"$ref\":\"#/definitions/ArrayPredicate\"},{\"$ref\":\"#/definitions/ValueAnyPredicate\"},{\"$ref\":\"#/definitions/ValueEmptyPredicate\"},{\"$ref\":\"#/definitions/CalendarEventPredicate\"}],\"description\":\"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent.\"},\"messageMatchFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate\"},\"updateOnWrite\":{\"type\":\"boolean\",\"description\":\"Don't expect a response from the protocol just update the attribute immediately on write\"},\"dpt\":{\"type\":\"string\",\"pattern\":\"^\\\\d{1,3}\\\\.\\\\d{1,3}$\"},\"actionGroupAddress\":{\"type\":\"string\",\"pattern\":\"^\\\\d{1,3}/\\\\d{1,3}/\\\\d{1,3}$\"},\"statusGroupAddress\":{\"type\":\"string\",\"pattern\":\"^\\\\d{1,3}/\\\\d{1,3}/\\\\d{1,3}$\"}},\"title\":\"KNXAgentLink\",\"required\":[\"type\",\"dpt\"]},\"SimulatorAgentLink\":{\"type\":\"object\",\"additionalProperties\":true,\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"SimulatorAgentLink\"],\"default\":\"SimulatorAgentLink\"},\"id\":{\"type\":\"string\",\"format\":\"or-agent-id\"},\"valueFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order\"},\"valueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValue\":{\"type\":\"string\",\"format\":\"or-multiline\",\"description\":\"String to be used for attribute writes and can contain '{$value}' placeholders to allow the written value to be injected into the string or to even hardcode the value written to the protocol (particularly useful for executable attributes)\"},\"messageMatchPredicate\":{\"oneOf\":[{\"$ref\":\"#/definitions/StringPredicate\"},{\"$ref\":\"#/definitions/BooleanPredicate\"},{\"$ref\":\"#/definitions/DateTimePredicate\"},{\"$ref\":\"#/definitions/NumberPredicate\"},{\"$ref\":\"#/definitions/RadialGeofencePredicate\"},{\"$ref\":\"#/definitions/RectangularGeofencePredicate\"},{\"$ref\":\"#/definitions/ArrayPredicate\"},{\"$ref\":\"#/definitions/ValueAnyPredicate\"},{\"$ref\":\"#/definitions/ValueEmptyPredicate\"},{\"$ref\":\"#/definitions/CalendarEventPredicate\"}],\"description\":\"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent.\"},\"messageMatchFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate\"},\"updateOnWrite\":{\"type\":\"boolean\",\"description\":\"Don't expect a response from the protocol just update the attribute immediately on write\"},\"replayData\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/SimulatorReplayDatapoint\"},\"description\":\"Used to store 24h dataset of values that should be replayed (i.e. written to the linked attribute) in a continuous loop.\"}},\"title\":\"SimulatorAgentLink\",\"required\":[\"type\"]},\"SimulatorReplayDatapoint\":{\"type\":\"object\",\"additionalProperties\":true,\"properties\":{\"timestamp\":{\"type\":\"integer\"},\"value\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"array\",\"object\",\"string\"]}},\"title\":\"Data point\",\"required\":[\"timestamp\", \"value\"]},\"VelbusAgentLink\":{\"type\":\"object\",\"additionalProperties\":true,\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"VelbusAgentLink\"],\"default\":\"VelbusAgentLink\"},\"id\":{\"type\":\"string\",\"format\":\"or-agent-id\"},\"deviceAddress\":{\"type\":\"integer\",\"minimum\":1,\"maximum\":255},\"deviceValueLink\":{\"type\":\"string\",\"pattern\":\"^.*\\\\S+.*$\",\"minLength\":1},\"valueFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order\"},\"valueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValue\":{\"type\":\"string\",\"format\":\"or-multiline\",\"description\":\"String to be used for attribute writes and can contain '{$value}' placeholders to allow the written value to be injected into the string or to even hardcode the value written to the protocol (particularly useful for executable attributes)\"},\"messageMatchPredicate\":{\"oneOf\":[{\"$ref\":\"#/definitions/StringPredicate\"},{\"$ref\":\"#/definitions/BooleanPredicate\"},{\"$ref\":\"#/definitions/DateTimePredicate\"},{\"$ref\":\"#/definitions/NumberPredicate\"},{\"$ref\":\"#/definitions/RadialGeofencePredicate\"},{\"$ref\":\"#/definitions/RectangularGeofencePredicate\"},{\"$ref\":\"#/definitions/ArrayPredicate\"},{\"$ref\":\"#/definitions/ValueAnyPredicate\"},{\"$ref\":\"#/definitions/ValueEmptyPredicate\"},{\"$ref\":\"#/definitions/CalendarEventPredicate\"}],\"description\":\"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent.\"},\"messageMatchFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate\"},\"updateOnWrite\":{\"type\":\"boolean\",\"description\":\"Don't expect a response from the protocol just update the attribute immediately on write\"}},\"title\":\"VelbusAgentLink\",\"required\":[\"type\",\"deviceAddress\",\"deviceValueLink\"]}}}");+ schema = JSON.parse("{\"$schema\":\"http://json-schema.org/draft-07/schema#\",\"title\":\"Agent Link\",\"oneOf\":[{\"$ref\":\"#/definitions/SNMPAgentLink\"},{\"$ref\":\"#/definitions/HTTPAgentLink\"},{\"$ref\":\"#/definitions/DefaultAgentLink\"},{\"$ref\":\"#/definitions/ZWaveAgentLink\"},{\"$ref\":\"#/definitions/WebsocketAgentLink\"},{\"$ref\":\"#/definitions/StorageSimulatorAgentLink\"},{\"$ref\":\"#/definitions/MockAgentLink\"},{\"$ref\":\"#/definitions/BluetoothMeshAgentLink\"},{\"$ref\":\"#/definitions/MQTTAgentLink\"},{\"$ref\":\"#/definitions/KNXAgentLink\"},{\"$ref\":\"#/definitions/SimulatorAgentLink\"},{\"$ref\":\"#/definitions/VelbusAgentLink\"}],\"definitions\":{\"SNMPAgentLink\":{\"type\":\"object\",\"additionalProperties\":true,\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"SNMPAgentLink\"],\"default\":\"SNMPAgentLink\"},\"id\":{\"type\":\"string\",\"format\":\"or-agent-id\"},\"valueFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order\"},\"valueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValue\":{\"type\":\"string\",\"format\":\"or-multiline\",\"description\":\"String to be used for attribute writes and can contain '%VALUE%' placeholders to allow the written value to be injected into the string or to even hardcode the value written to the protocol (particularly useful for executable attributes)\"},\"messageMatchPredicate\":{\"oneOf\":[{\"$ref\":\"#/definitions/StringPredicate\"},{\"$ref\":\"#/definitions/BooleanPredicate\"},{\"$ref\":\"#/definitions/DateTimePredicate\"},{\"$ref\":\"#/definitions/NumberPredicate\"},{\"$ref\":\"#/definitions/RadialGeofencePredicate\"},{\"$ref\":\"#/definitions/RectangularGeofencePredicate\"},{\"$ref\":\"#/definitions/ArrayPredicate\"},{\"$ref\":\"#/definitions/ValueAnyPredicate\"},{\"$ref\":\"#/definitions/ValueEmptyPredicate\"},{\"$ref\":\"#/definitions/CalendarEventPredicate\"}],\"description\":\"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent.\"},\"messageMatchFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate\"},\"updateOnWrite\":{\"type\":\"boolean\",\"description\":\"Don't expect a response from the protocol just update the attribute immediately on write\"},\"oid\":{\"type\":\"string\"}},\"title\":\"SNMPAgentLink\",\"required\":[\"type\",\"oid\"]},\"regex\":{\"type\":\"object\",\"additionalProperties\":true,\"title\":\"Regex\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"regex\"],\"default\":\"regex\"},\"pattern\":{\"type\":\"string\"},\"matchGroup\":{\"type\":\"integer\"},\"matchIndex\":{\"type\":\"integer\"}},\"required\":[\"type\"]},\"substring\":{\"type\":\"object\",\"additionalProperties\":true,\"title\":\"Substring\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"substring\"],\"default\":\"substring\"},\"beginIndex\":{\"type\":\"integer\"},\"endIndex\":{\"type\":\"integer\"}},\"required\":[\"type\",\"beginIndex\"]},\"jsonPath\":{\"type\":\"object\",\"additionalProperties\":true,\"title\":\"JSON Path\",\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"jsonPath\"],\"default\":\"jsonPath\"},\"path\":{\"type\":\"string\"},\"returnFirst\":{\"type\":\"boolean\"},\"returnLast\":{\"type\":\"boolean\"}},\"required\":[\"type\",\"path\",\"returnFirst\",\"returnLast\"]},\"PatternPropertiesSimpleKeyAnyType\":{\"type\":\"object\",\"additionalProperties\":true,\"patternProperties\":{\"^[a-zA-Z][a-zA-Z0-9]*\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}},\"properties\":{}},\"StringPredicate\":{\"type\":\"object\",\"additionalProperties\":true,\"description\":\"Predicate for string values; will match based on configured options.\",\"properties\":{\"predicateType\":{\"type\":\"string\",\"enum\":[\"string\"],\"default\":\"string\"},\"match\":{\"type\":\"string\",\"enum\":[\"EXACT\",\"BEGIN\",\"END\",\"CONTAINS\"]},\"caseSensitive\":{\"type\":\"boolean\"},\"value\":{\"type\":\"string\"},\"negate\":{\"type\":\"boolean\"}},\"title\":\"string\",\"required\":[\"predicateType\",\"caseSensitive\",\"negate\"]},\"BooleanPredicate\":{\"type\":\"object\",\"additionalProperties\":true,\"description\":\"Predicate for boolean values; will evaluate the value as a boolean and match against this predicates value, any value that is not a boolean will not match\",\"properties\":{\"predicateType\":{\"type\":\"string\",\"enum\":[\"boolean\"],\"default\":\"boolean\"},\"value\":{\"type\":\"boolean\"}},\"title\":\"boolean\",\"required\":[\"predicateType\",\"value\"]},\"DateTimePredicate\":{\"type\":\"object\",\"additionalProperties\":true,\"description\":\"Predicate for date time values; provided values should be valid ISO 8601 datetime strings (e.g. yyyy-MM-dd'T'HH:mm:ssZ or yyyy-MM-dd'T'HH:mm:ss±HH:mm), offset and time are optional, if no offset information is supplied then UTC is assumed.\",\"properties\":{\"predicateType\":{\"type\":\"string\",\"enum\":[\"datetime\"],\"default\":\"datetime\"},\"value\":{\"type\":\"string\"},\"rangeValue\":{\"type\":\"string\"},\"operator\":{\"type\":\"string\",\"enum\":[\"EQUALS\",\"GREATER_THAN\",\"GREATER_EQUALS\",\"LESS_THAN\",\"LESS_EQUALS\",\"BETWEEN\"]},\"negate\":{\"type\":\"boolean\"}},\"title\":\"datetime\",\"required\":[\"predicateType\",\"negate\"]},\"NumberPredicate\":{\"type\":\"object\",\"additionalProperties\":true,\"description\":\"Predicate for number values; will match based on configured options.\",\"properties\":{\"predicateType\":{\"type\":\"string\",\"enum\":[\"number\"],\"default\":\"number\"},\"value\":{\"type\":\"number\"},\"rangeValue\":{\"type\":\"number\"},\"operator\":{\"type\":\"string\",\"enum\":[\"EQUALS\",\"GREATER_THAN\",\"GREATER_EQUALS\",\"LESS_THAN\",\"LESS_EQUALS\",\"BETWEEN\"]},\"negate\":{\"type\":\"boolean\"}},\"title\":\"number\",\"required\":[\"predicateType\",\"negate\"]},\"RadialGeofencePredicate\":{\"type\":\"object\",\"additionalProperties\":true,\"description\":\"Predicate for GEO JSON point values; will return true if the point is within the specified radius of the specified latitude and longitude unless negated.\",\"title\":\"Radial geofence\",\"properties\":{\"predicateType\":{\"type\":\"string\",\"enum\":[\"radial\"],\"default\":\"radial\"},\"radius\":{\"type\":\"integer\"},\"lat\":{\"type\":\"number\"},\"lng\":{\"type\":\"number\"},\"negated\":{\"type\":\"boolean\"}},\"required\":[\"predicateType\",\"radius\",\"lat\",\"lng\",\"negated\"]},\"RectangularGeofencePredicate\":{\"type\":\"object\",\"additionalProperties\":true,\"description\":\"Predicate for GEO JSON point values; will return true if the point is within the specified rectangle specified as latitude and longitude values of two corners unless negated.\",\"title\":\"Rectangular geofence\",\"properties\":{\"predicateType\":{\"type\":\"string\",\"enum\":[\"rect\"],\"default\":\"rect\"},\"latMin\":{\"type\":\"number\"},\"lngMin\":{\"type\":\"number\"},\"latMax\":{\"type\":\"number\"},\"lngMax\":{\"type\":\"number\"},\"negated\":{\"type\":\"boolean\"}},\"required\":[\"predicateType\",\"latMin\",\"lngMin\",\"latMax\",\"lngMax\",\"negated\"]},\"ArrayPredicate\":{\"type\":\"object\",\"additionalProperties\":true,\"description\":\"Predicate for array values; will match based on configured options.\",\"properties\":{\"predicateType\":{\"type\":\"string\",\"enum\":[\"array\"],\"default\":\"array\"},\"value\":{\"$ref\":\"#/definitions/AnyType\"},\"index\":{\"type\":\"integer\"},\"lengthEquals\":{\"type\":\"integer\"},\"lengthGreaterThan\":{\"type\":\"integer\"},\"lengthLessThan\":{\"type\":\"integer\"},\"negated\":{\"type\":\"boolean\"}},\"title\":\"array\",\"required\":[\"predicateType\",\"negated\"]},\"AnyType\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"],\"additionalProperties\":true,\"properties\":{}},\"ValueAnyPredicate\":{\"type\":\"object\",\"additionalProperties\":true,\"description\":\"Predicate that matches any value including null.\",\"title\":\"Any value\",\"properties\":{\"predicateType\":{\"type\":\"string\",\"enum\":[\"value-any\"],\"default\":\"value-any\"}},\"required\":[\"predicateType\"]},\"ValueEmptyPredicate\":{\"type\":\"object\",\"additionalProperties\":true,\"description\":\"Predicate that matches any empty/null value; unless negated.\",\"title\":\"Empty value\",\"properties\":{\"predicateType\":{\"type\":\"string\",\"enum\":[\"value-empty\"],\"default\":\"value-empty\"},\"negate\":{\"type\":\"boolean\"}},\"required\":[\"predicateType\",\"negate\"]},\"CalendarEventPredicate\":{\"type\":\"object\",\"additionalProperties\":true,\"description\":\"Predicate for calendar event values; will match based on whether the calendar event is active for the specified time.\",\"title\":\"Calendar\",\"properties\":{\"predicateType\":{\"type\":\"string\",\"enum\":[\"calendar-event\"],\"default\":\"calendar-event\"},\"timestamp\":{\"type\":\"integer\",\"format\":\"utc-millisec\"}},\"required\":[\"predicateType\"]},\"HTTPAgentLink\":{\"type\":\"object\",\"additionalProperties\":true,\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"HTTPAgentLink\"],\"default\":\"HTTPAgentLink\"},\"id\":{\"type\":\"string\",\"format\":\"or-agent-id\"},\"valueFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order\"},\"valueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValue\":{\"type\":\"string\",\"format\":\"or-multiline\",\"description\":\"String to be used for attribute writes and can contain '{$value}' placeholders to allow the written value to be injected into the string or to even hardcode the value written to the protocol (particularly useful for executable attributes)\"},\"messageMatchPredicate\":{\"oneOf\":[{\"$ref\":\"#/definitions/StringPredicate\"},{\"$ref\":\"#/definitions/BooleanPredicate\"},{\"$ref\":\"#/definitions/DateTimePredicate\"},{\"$ref\":\"#/definitions/NumberPredicate\"},{\"$ref\":\"#/definitions/RadialGeofencePredicate\"},{\"$ref\":\"#/definitions/RectangularGeofencePredicate\"},{\"$ref\":\"#/definitions/ArrayPredicate\"},{\"$ref\":\"#/definitions/ValueAnyPredicate\"},{\"$ref\":\"#/definitions/ValueEmptyPredicate\"},{\"$ref\":\"#/definitions/CalendarEventPredicate\"}],\"description\":\"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent.\"},\"messageMatchFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate\"},\"updateOnWrite\":{\"type\":\"boolean\",\"description\":\"Don't expect a response from the protocol just update the attribute immediately on write\"},\"headers\":{\"type\":\"object\",\"additionalProperties\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"description\":\"A JSON object of headers to be added to HTTP request; the key represents the name of the header and for each string value supplied a new header will be added with the key name and specified string value\"},\"queryParameters\":{\"type\":\"object\",\"additionalProperties\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"description\":\"A JSON object of query parameters to be added to HTTP request URL; the key represents the name of the query parameter and for each string value supplied a new query parameter will be added with the key name and specified string value (e.g. 'https://..../?test=1&test=2')\"},\"pollingMillis\":{\"type\":\"integer\",\"description\":\"Indicates that this HTTP request is used to update the linked attribute; this value indicates how frequently the HTTP request is made in order to update the linked attribute value\"},\"pagingMode\":{\"type\":\"boolean\",\"description\":\"Indicates that the HTTP server supports pagination using the standard Link header mechanism\"},\"path\":{\"type\":\"string\",\"description\":\"The URL path to append to the agents Base URL when making requests for this linked attribute\"},\"method\":{\"type\":\"string\",\"enum\":[\"GET\",\"POST\",\"PUT\",\"DELETE\",\"OPTIONS\",\"PATCH\"],\"description\":\"The HTTP method to use when making requests for this linked attribute\"},\"contentType\":{\"type\":\"string\",\"description\":\"The content type header value to use when making requests for this linked attribute (shortcut alternative to using headers parameter)\"},\"pollingAttribute\":{\"type\":\"string\",\"description\":\"Allows the polled response to be written to another attribute with the specified name on the same asset as the linked attribute\"},\"messageConvertBinary\":{\"type\":\"boolean\",\"description\":\"Indicates that the HTTP response is binary and should be converted to binary string representation\"},\"messageConvertHex\":{\"type\":\"boolean\",\"description\":\"Indicates that the HTTP response is binary and should be converted to hexidecimal string representation\"}},\"title\":\"HTTPAgentLink\",\"required\":[\"type\",\"messageConvertBinary\",\"messageConvertHex\"]},\"DefaultAgentLink\":{\"type\":\"object\",\"additionalProperties\":true,\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"DefaultAgentLink\"],\"default\":\"DefaultAgentLink\"},\"id\":{\"type\":\"string\",\"format\":\"or-agent-id\"},\"valueFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order\"},\"valueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValue\":{\"type\":\"string\",\"format\":\"or-multiline\",\"description\":\"String to be used for attribute writes and can contain '{$value}' placeholders to allow the written value to be injected into the string or to even hardcode the value written to the protocol (particularly useful for executable attributes)\"},\"messageMatchPredicate\":{\"oneOf\":[{\"$ref\":\"#/definitions/StringPredicate\"},{\"$ref\":\"#/definitions/BooleanPredicate\"},{\"$ref\":\"#/definitions/DateTimePredicate\"},{\"$ref\":\"#/definitions/NumberPredicate\"},{\"$ref\":\"#/definitions/RadialGeofencePredicate\"},{\"$ref\":\"#/definitions/RectangularGeofencePredicate\"},{\"$ref\":\"#/definitions/ArrayPredicate\"},{\"$ref\":\"#/definitions/ValueAnyPredicate\"},{\"$ref\":\"#/definitions/ValueEmptyPredicate\"},{\"$ref\":\"#/definitions/CalendarEventPredicate\"}],\"description\":\"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent.\"},\"messageMatchFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate\"},\"updateOnWrite\":{\"type\":\"boolean\",\"description\":\"Don't expect a response from the protocol just update the attribute immediately on write\"}},\"title\":\"DefaultAgentLink\",\"required\":[\"type\"]},\"ZWaveAgentLink\":{\"type\":\"object\",\"additionalProperties\":true,\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"ZWaveAgentLink\"],\"default\":\"ZWaveAgentLink\"},\"id\":{\"type\":\"string\",\"format\":\"or-agent-id\"},\"valueFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order\"},\"valueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValue\":{\"type\":\"string\",\"format\":\"or-multiline\",\"description\":\"String to be used for attribute writes and can contain '{$value}' placeholders to allow the written value to be injected into the string or to even hardcode the value written to the protocol (particularly useful for executable attributes)\"},\"messageMatchPredicate\":{\"oneOf\":[{\"$ref\":\"#/definitions/StringPredicate\"},{\"$ref\":\"#/definitions/BooleanPredicate\"},{\"$ref\":\"#/definitions/DateTimePredicate\"},{\"$ref\":\"#/definitions/NumberPredicate\"},{\"$ref\":\"#/definitions/RadialGeofencePredicate\"},{\"$ref\":\"#/definitions/RectangularGeofencePredicate\"},{\"$ref\":\"#/definitions/ArrayPredicate\"},{\"$ref\":\"#/definitions/ValueAnyPredicate\"},{\"$ref\":\"#/definitions/ValueEmptyPredicate\"},{\"$ref\":\"#/definitions/CalendarEventPredicate\"}],\"description\":\"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent.\"},\"messageMatchFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate\"},\"updateOnWrite\":{\"type\":\"boolean\",\"description\":\"Don't expect a response from the protocol just update the attribute immediately on write\"},\"deviceNodeId\":{\"type\":\"integer\"},\"deviceEndpoint\":{\"type\":\"integer\"},\"deviceValue\":{\"type\":\"string\"}},\"title\":\"ZWaveAgentLink\",\"required\":[\"type\"]},\"WebsocketAgentLink\":{\"type\":\"object\",\"additionalProperties\":true,\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"WebsocketAgentLink\"],\"default\":\"WebsocketAgentLink\"},\"id\":{\"type\":\"string\",\"format\":\"or-agent-id\"},\"valueFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order\"},\"valueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValue\":{\"type\":\"string\",\"format\":\"or-multiline\",\"description\":\"String to be used for attribute writes and can contain '{$value}' placeholders to allow the written value to be injected into the string or to even hardcode the value written to the protocol (particularly useful for executable attributes)\"},\"messageMatchPredicate\":{\"oneOf\":[{\"$ref\":\"#/definitions/StringPredicate\"},{\"$ref\":\"#/definitions/BooleanPredicate\"},{\"$ref\":\"#/definitions/DateTimePredicate\"},{\"$ref\":\"#/definitions/NumberPredicate\"},{\"$ref\":\"#/definitions/RadialGeofencePredicate\"},{\"$ref\":\"#/definitions/RectangularGeofencePredicate\"},{\"$ref\":\"#/definitions/ArrayPredicate\"},{\"$ref\":\"#/definitions/ValueAnyPredicate\"},{\"$ref\":\"#/definitions/ValueEmptyPredicate\"},{\"$ref\":\"#/definitions/CalendarEventPredicate\"}],\"description\":\"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent.\"},\"messageMatchFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate\"},\"updateOnWrite\":{\"type\":\"boolean\",\"description\":\"Don't expect a response from the protocol just update the attribute immediately on write\"},\"websocketSubscriptions\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/websocket\"},{\"$ref\":\"#/definitions/http\"}]}}},\"title\":\"WebsocketAgentLink\",\"required\":[\"type\"]},\"websocket\":{\"type\":\"object\",\"additionalProperties\":true,\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"websocket\"],\"default\":\"websocket\"},\"body\":{\"$ref\":\"#/definitions/AnyType\"}},\"title\":\"websocket\",\"required\":[\"type\"]},\"http\":{\"type\":\"object\",\"additionalProperties\":true,\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"http\"],\"default\":\"http\"},\"body\":{\"$ref\":\"#/definitions/AnyType\"},\"method\":{\"type\":\"string\",\"enum\":[\"GET\",\"PUT\",\"POST\"]},\"contentType\":{\"type\":\"string\"},\"headers\":{\"type\":\"object\",\"additionalProperties\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}}},\"uri\":{\"type\":\"string\"}},\"title\":\"http\",\"required\":[\"type\"]},\"StorageSimulatorAgentLink\":{\"type\":\"object\",\"additionalProperties\":true,\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"StorageSimulatorAgentLink\"],\"default\":\"StorageSimulatorAgentLink\"},\"id\":{\"type\":\"string\",\"format\":\"or-agent-id\"},\"valueFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order\"},\"valueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValue\":{\"type\":\"string\",\"format\":\"or-multiline\",\"description\":\"String to be used for attribute writes and can contain '{$value}' placeholders to allow the written value to be injected into the string or to even hardcode the value written to the protocol (particularly useful for executable attributes)\"},\"messageMatchPredicate\":{\"oneOf\":[{\"$ref\":\"#/definitions/StringPredicate\"},{\"$ref\":\"#/definitions/BooleanPredicate\"},{\"$ref\":\"#/definitions/DateTimePredicate\"},{\"$ref\":\"#/definitions/NumberPredicate\"},{\"$ref\":\"#/definitions/RadialGeofencePredicate\"},{\"$ref\":\"#/definitions/RectangularGeofencePredicate\"},{\"$ref\":\"#/definitions/ArrayPredicate\"},{\"$ref\":\"#/definitions/ValueAnyPredicate\"},{\"$ref\":\"#/definitions/ValueEmptyPredicate\"},{\"$ref\":\"#/definitions/CalendarEventPredicate\"}],\"description\":\"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent.\"},\"messageMatchFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate\"},\"updateOnWrite\":{\"type\":\"boolean\",\"description\":\"Don't expect a response from the protocol just update the attribute immediately on write\"}},\"title\":\"StorageSimulatorAgentLink\",\"required\":[\"type\"]},\"MockAgentLink\":{\"type\":\"object\",\"additionalProperties\":true,\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"MockAgentLink\"],\"default\":\"MockAgentLink\"},\"id\":{\"type\":\"string\",\"format\":\"or-agent-id\"},\"valueFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order\"},\"valueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValue\":{\"type\":\"string\",\"format\":\"or-multiline\",\"description\":\"String to be used for attribute writes and can contain '{$value}' placeholders to allow the written value to be injected into the string or to even hardcode the value written to the protocol (particularly useful for executable attributes)\"},\"messageMatchPredicate\":{\"oneOf\":[{\"$ref\":\"#/definitions/StringPredicate\"},{\"$ref\":\"#/definitions/BooleanPredicate\"},{\"$ref\":\"#/definitions/DateTimePredicate\"},{\"$ref\":\"#/definitions/NumberPredicate\"},{\"$ref\":\"#/definitions/RadialGeofencePredicate\"},{\"$ref\":\"#/definitions/RectangularGeofencePredicate\"},{\"$ref\":\"#/definitions/ArrayPredicate\"},{\"$ref\":\"#/definitions/ValueAnyPredicate\"},{\"$ref\":\"#/definitions/ValueEmptyPredicate\"},{\"$ref\":\"#/definitions/CalendarEventPredicate\"}],\"description\":\"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent.\"},\"messageMatchFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate\"},\"updateOnWrite\":{\"type\":\"boolean\",\"description\":\"Don't expect a response from the protocol just update the attribute immediately on write\"},\"requiredValue\":{\"type\":\"string\"}},\"title\":\"MockAgentLink\",\"required\":[\"type\"]},\"BluetoothMeshAgentLink\":{\"type\":\"object\",\"additionalProperties\":true,\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"BluetoothMeshAgentLink\"],\"default\":\"BluetoothMeshAgentLink\"},\"id\":{\"type\":\"string\",\"format\":\"or-agent-id\"},\"valueFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order\"},\"valueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValue\":{\"type\":\"string\",\"format\":\"or-multiline\",\"description\":\"String to be used for attribute writes and can contain '{$value}' placeholders to allow the written value to be injected into the string or to even hardcode the value written to the protocol (particularly useful for executable attributes)\"},\"messageMatchPredicate\":{\"oneOf\":[{\"$ref\":\"#/definitions/StringPredicate\"},{\"$ref\":\"#/definitions/BooleanPredicate\"},{\"$ref\":\"#/definitions/DateTimePredicate\"},{\"$ref\":\"#/definitions/NumberPredicate\"},{\"$ref\":\"#/definitions/RadialGeofencePredicate\"},{\"$ref\":\"#/definitions/RectangularGeofencePredicate\"},{\"$ref\":\"#/definitions/ArrayPredicate\"},{\"$ref\":\"#/definitions/ValueAnyPredicate\"},{\"$ref\":\"#/definitions/ValueEmptyPredicate\"},{\"$ref\":\"#/definitions/CalendarEventPredicate\"}],\"description\":\"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent.\"},\"messageMatchFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate\"},\"updateOnWrite\":{\"type\":\"boolean\",\"description\":\"Don't expect a response from the protocol just update the attribute immediately on write\"},\"appKeyIndex\":{\"type\":\"integer\",\"minimum\":0,\"maximum\":2147483647},\"address\":{\"type\":\"string\",\"pattern\":\"^([0-9A-Fa-f]{4})$\"},\"modelName\":{\"type\":\"string\",\"pattern\":\"^.*\\\\S+.*$\",\"minLength\":1}},\"title\":\"BluetoothMeshAgentLink\",\"required\":[\"type\",\"appKeyIndex\",\"modelName\"]},\"MQTTAgentLink\":{\"type\":\"object\",\"additionalProperties\":true,\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"MQTTAgentLink\"],\"default\":\"MQTTAgentLink\"},\"id\":{\"type\":\"string\",\"format\":\"or-agent-id\"},\"valueFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order\"},\"valueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValue\":{\"type\":\"string\",\"format\":\"or-multiline\",\"description\":\"String to be used for attribute writes and can contain '{$value}' placeholders to allow the written value to be injected into the string or to even hardcode the value written to the protocol (particularly useful for executable attributes)\"},\"messageMatchPredicate\":{\"oneOf\":[{\"$ref\":\"#/definitions/StringPredicate\"},{\"$ref\":\"#/definitions/BooleanPredicate\"},{\"$ref\":\"#/definitions/DateTimePredicate\"},{\"$ref\":\"#/definitions/NumberPredicate\"},{\"$ref\":\"#/definitions/RadialGeofencePredicate\"},{\"$ref\":\"#/definitions/RectangularGeofencePredicate\"},{\"$ref\":\"#/definitions/ArrayPredicate\"},{\"$ref\":\"#/definitions/ValueAnyPredicate\"},{\"$ref\":\"#/definitions/ValueEmptyPredicate\"},{\"$ref\":\"#/definitions/CalendarEventPredicate\"}],\"description\":\"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent.\"},\"messageMatchFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate\"},\"updateOnWrite\":{\"type\":\"boolean\",\"description\":\"Don't expect a response from the protocol just update the attribute immediately on write\"},\"subscriptionTopic\":{\"type\":\"string\"},\"publishTopic\":{\"type\":\"string\"}},\"title\":\"MQTTAgentLink\",\"required\":[\"type\"]},\"KNXAgentLink\":{\"type\":\"object\",\"additionalProperties\":true,\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"KNXAgentLink\"],\"default\":\"KNXAgentLink\"},\"id\":{\"type\":\"string\",\"format\":\"or-agent-id\"},\"valueFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order\"},\"valueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValue\":{\"type\":\"string\",\"format\":\"or-multiline\",\"description\":\"String to be used for attribute writes and can contain '{$value}' placeholders to allow the written value to be injected into the string or to even hardcode the value written to the protocol (particularly useful for executable attributes)\"},\"messageMatchPredicate\":{\"oneOf\":[{\"$ref\":\"#/definitions/StringPredicate\"},{\"$ref\":\"#/definitions/BooleanPredicate\"},{\"$ref\":\"#/definitions/DateTimePredicate\"},{\"$ref\":\"#/definitions/NumberPredicate\"},{\"$ref\":\"#/definitions/RadialGeofencePredicate\"},{\"$ref\":\"#/definitions/RectangularGeofencePredicate\"},{\"$ref\":\"#/definitions/ArrayPredicate\"},{\"$ref\":\"#/definitions/ValueAnyPredicate\"},{\"$ref\":\"#/definitions/ValueEmptyPredicate\"},{\"$ref\":\"#/definitions/CalendarEventPredicate\"}],\"description\":\"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent.\"},\"messageMatchFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate\"},\"updateOnWrite\":{\"type\":\"boolean\",\"description\":\"Don't expect a response from the protocol just update the attribute immediately on write\"},\"dpt\":{\"type\":\"string\",\"pattern\":\"^\\\\d{1,3}\\\\.\\\\d{1,3}$\"},\"actionGroupAddress\":{\"type\":\"string\",\"pattern\":\"^\\\\d{1,3}/\\\\d{1,3}/\\\\d{1,3}$\"},\"statusGroupAddress\":{\"type\":\"string\",\"pattern\":\"^\\\\d{1,3}/\\\\d{1,3}/\\\\d{1,3}$\"}},\"title\":\"KNXAgentLink\",\"required\":[\"type\",\"dpt\"]},\"SimulatorAgentLink\":{\"type\":\"object\",\"additionalProperties\":true,\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"SimulatorAgentLink\"],\"default\":\"SimulatorAgentLink\"},\"id\":{\"type\":\"string\",\"format\":\"or-agent-id\"},\"valueFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order\"},\"valueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValue\":{\"type\":\"string\",\"format\":\"or-multiline\",\"description\":\"String to be used for attribute writes and can contain '{$value}' placeholders to allow the written value to be injected into the string or to even hardcode the value written to the protocol (particularly useful for executable attributes)\"},\"messageMatchPredicate\":{\"oneOf\":[{\"$ref\":\"#/definitions/StringPredicate\"},{\"$ref\":\"#/definitions/BooleanPredicate\"},{\"$ref\":\"#/definitions/DateTimePredicate\"},{\"$ref\":\"#/definitions/NumberPredicate\"},{\"$ref\":\"#/definitions/RadialGeofencePredicate\"},{\"$ref\":\"#/definitions/RectangularGeofencePredicate\"},{\"$ref\":\"#/definitions/ArrayPredicate\"},{\"$ref\":\"#/definitions/ValueAnyPredicate\"},{\"$ref\":\"#/definitions/ValueEmptyPredicate\"},{\"$ref\":\"#/definitions/CalendarEventPredicate\"}],\"description\":\"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent.\"},\"messageMatchFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate\"},\"updateOnWrite\":{\"type\":\"boolean\",\"description\":\"Don't expect a response from the protocol just update the attribute immediately on write\"},\"replayData\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/SimulatorReplayDatapoint\"},\"description\":\"Used to store 24h dataset of values that should be replayed (i.e. written to the linked attribute) in a continuous loop.\"}},\"title\":\"SimulatorAgentLink\",\"required\":[\"type\"]},\"SimulatorReplayDatapoint\":{\"type\":\"object\",\"additionalProperties\":true,\"properties\":{\"timestamp\":{\"type\":\"integer\"},\"value\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"array\",\"object\",\"string\"]}},\"title\":\"Data point\",\"required\":[\"timestamp\", \"value\"]},\"VelbusAgentLink\":{\"type\":\"object\",\"additionalProperties\":true,\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"VelbusAgentLink\"],\"default\":\"VelbusAgentLink\"},\"id\":{\"type\":\"string\",\"format\":\"or-agent-id\"},\"deviceAddress\":{\"type\":\"integer\",\"minimum\":1,\"maximum\":255},\"deviceValueLink\":{\"type\":\"string\",\"pattern\":\"^.*\\\\S+.*$\",\"minLength\":1},\"valueFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"Defines ValueFilters to apply to an incoming value before it is written to a protocol linked attribute; this is particularly useful for generic protocols. The message should pass through the filters in array order\"},\"valueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValueConverter\":{\"type\":\"object\",\"patternProperties\":{\".+\":{\"type\":[\"null\",\"number\",\"integer\",\"boolean\",\"string\",\"array\",\"object\"]}}},\"writeValue\":{\"type\":\"string\",\"format\":\"or-multiline\",\"description\":\"String to be used for attribute writes and can contain '{$value}' placeholders to allow the written value to be injected into the string or to even hardcode the value written to the protocol (particularly useful for executable attributes)\"},\"messageMatchPredicate\":{\"oneOf\":[{\"$ref\":\"#/definitions/StringPredicate\"},{\"$ref\":\"#/definitions/BooleanPredicate\"},{\"$ref\":\"#/definitions/DateTimePredicate\"},{\"$ref\":\"#/definitions/NumberPredicate\"},{\"$ref\":\"#/definitions/RadialGeofencePredicate\"},{\"$ref\":\"#/definitions/RectangularGeofencePredicate\"},{\"$ref\":\"#/definitions/ArrayPredicate\"},{\"$ref\":\"#/definitions/ValueAnyPredicate\"},{\"$ref\":\"#/definitions/ValueEmptyPredicate\"},{\"$ref\":\"#/definitions/CalendarEventPredicate\"}],\"description\":\"The predicate to apply to incoming messages to determine if the message is intended for the linked attribute; the value used in the predicate can be filtered using the message match filters. This must be defined to enable attributes to be updated by the linked agent.\"},\"messageMatchFilters\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/regex\"},{\"$ref\":\"#/definitions/substring\"},{\"$ref\":\"#/definitions/jsonPath\"}]},\"description\":\"ValueFilters to apply to incoming messages prior to comparison with the messageMatchPredicate\"},\"updateOnWrite\":{\"type\":\"boolean\",\"description\":\"Don't expect a response from the protocol just update the attribute immediately on write\"}},\"title\":\"VelbusAgentLink\",\"required\":[\"type\",\"deviceAddress\",\"deviceValueLink\"]}}}");}loadedAgents = await loadAgents();