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
Add timezone parameter to SimulatorAgentLink (#2371)
Koen2906a4d34f69
diff --git a/agent/src/main/java/org/openremote/agent/protocol/simulator/SimulatorAgentLink.java b/agent/src/main/java/org/openremote/agent/protocol/simulator/SimulatorAgentLink.javaindex 400ac64e0..5411939cc 100644--- a/agent/src/main/java/org/openremote/agent/protocol/simulator/SimulatorAgentLink.java+++ b/agent/src/main/java/org/openremote/agent/protocol/simulator/SimulatorAgentLink.java@@ -24,7 +24,9 @@ import org.openremote.model.simulator.SimulatorReplayDatapoint;import org.openremote.model.util.JSONSchemaUtil.*;import java.util.Optional;+import java.util.TimeZone;+@JsonSchemaDefault("{\"timezone\":\"\"}")public class SimulatorAgentLink extends AgentLink<SimulatorAgentLink> {@JsonSchemaDescription("Used to store a dataset of values that should be replayed (i.e. written to the" +@@ -33,6 +35,10 @@ public class SimulatorAgentLink extends AgentLink<SimulatorAgentLink> {" immediately as determined by the schedule. Datapoints scheduled after the replay loop are ignored.")protected SimulatorReplayDatapoint[] replayData;+ @JsonSchemaDescription("The timezone the Simulator should follow to replay the dataset.")+ @JsonSchemaFormat("timezone")+ protected TimeZone timezone;+@JsonSchemaTitle("Schedule")@JsonSchemaDescription("Overwrites the possible dataset length and when it is replayed." +" The dataset can be scheduled to stop based on the UNTIL rule part" +@@ -68,4 +74,13 @@ public class SimulatorAgentLink extends AgentLink<SimulatorAgentLink> {this.schedule = schedule;return this;}++ public Optional<TimeZone> getTimezone() {+ return Optional.ofNullable(timezone);+ }++ public SimulatorAgentLink setTimezone(TimeZone timezone) {+ this.timezone = timezone;+ return this;+ }}diff --git a/agent/src/main/java/org/openremote/agent/protocol/simulator/SimulatorProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/simulator/SimulatorProtocol.javaindex 636df6902..b36a168f9 100644--- a/agent/src/main/java/org/openremote/agent/protocol/simulator/SimulatorProtocol.java+++ b/agent/src/main/java/org/openremote/agent/protocol/simulator/SimulatorProtocol.java@@ -190,14 +190,18 @@ public class SimulatorProtocol extends AbstractProtocol<SimulatorAgent, SimulatoLOG.finest("Scheduling linked attribute replay update");Optional<Schedule> schedule = agentLink.getSchedule();+ TimeZone timezone = agentLink.getTimezone().orElse(TimeZone.getTimeZone("UTC"));- long now = timerService.getNow().toEpochMilli(); // UTC- long timeSinceOccurrenceStarted = schedule.map(s -> now - s.tryAdvanceActive(now))+ long nowUTC = timerService.getNow().toEpochMilli(); // UTC+ long tzOffset = timezone.getOffset(nowUTC);+ long now = nowUTC + tzOffset;++ long timeSinceOccurrenceStart = schedule.map(s -> now - s.tryAdvanceActive(now, tzOffset)).orElse(now % DEFAULT_REPLAY_LOOP_DURATION); // Remainder since 00:00// Find datapoint with timestamp after the current occurrenceSimulatorReplayDatapoint nextDatapoint = Arrays.stream(simulatorReplayDatapoints)- .filter(replaySimulatorDatapoint -> replaySimulatorDatapoint.timestamp*1000 > timeSinceOccurrenceStarted)+ .filter(replaySimulatorDatapoint -> replaySimulatorDatapoint.timestamp*1000 > timeSinceOccurrenceStart).findFirst().orElse(simulatorReplayDatapoints[0]);@@ -206,9 +210,9 @@ public class SimulatorProtocol extends AbstractProtocol<SimulatorAgent, Simulatoreturn null;}- OptionalLong nextRun = Schedule.getDelay(nextDatapoint.timestamp, timeSinceOccurrenceStarted, schedule.orElse(null));+ OptionalLong nextRun = Schedule.getDelay(nextDatapoint.timestamp, timeSinceOccurrenceStart, schedule.orElse(null));if (nextRun.isEmpty() || nextRun.getAsLong() < 0 || (schedule.isPresent() && schedule.get().isAfterScheduleEnd(now))) {- LOG.warning("Replay schedule has ended for: " + attributeRef);+ LOG.warning("Replay loop has ended for: " + attributeRef);predictedDatapointService.purgeValuesBefore(attributeRef.getId(), attributeRef.getName(), Instant.ofEpochMilli(now));return null;}@@ -216,7 +220,7 @@ public class SimulatorProtocol extends AbstractProtocol<SimulatorAgent, Simulatoif (attribute.getMeta().get(HAS_PREDICTED_DATA_POINTS).flatMap(AbstractNameValueHolder::getValue).orElse(false)) {PredictedDatapointWindow status = predictedDatapointWindowMap.get(attributeRef);List<ValueDatapoint<?>> predictedDatapoints =- calculatePredictedDatapoints(simulatorReplayDatapoints, schedule, status, timeSinceOccurrenceStarted, now);+ calculatePredictedDatapoints(simulatorReplayDatapoints, schedule, status, timeSinceOccurrenceStart, now, tzOffset);try {updateLinkedAttributePredictedDataPoints(attributeRef, predictedDatapoints);} catch (Exception e) {@@ -237,7 +241,7 @@ public class SimulatorProtocol extends AbstractProtocol<SimulatorAgent, SimulatoLOG.fine("Updating asset " + attributeRef.getId() + " for attribute " + attributeRef.getName() + " with value " + nextDatapoint.value.toString());try {updateLinkedAttribute(attributeRef, nextDatapoint.value);- Instant before = Instant.ofEpochMilli(now + nextRun.getAsLong());+ Instant before = Instant.ofEpochMilli(now-tzOffset + nextRun.getAsLong());predictedDatapointService.purgeValuesBefore(attributeRef.getId(), attributeRef.getName(), before);} catch (Exception e) {LOG.log(Level.SEVERE, "Exception thrown when updating value: %s", e);@@ -256,8 +260,9 @@ public class SimulatorProtocol extends AbstractProtocol<SimulatorAgent, SimulatoSimulatorReplayDatapoint[] simulatorReplayDatapoints,Optional<Schedule> schedule,PredictedDatapointWindow status,- long timeSinceOccurrenceStarted,- long now+ long timeSinceOccurrenceStart,+ long now,+ long tzOffset) {List<ValueDatapoint<?>> predictedDatapoints = new ArrayList<>();@@ -271,7 +276,7 @@ public class SimulatorProtocol extends AbstractProtocol<SimulatorAgent, Simulatoif (status.equals(PredictedDatapointWindow.BOTH)) {for (SimulatorReplayDatapoint datapoint : simulatorReplayDatapoints) {- OptionalLong delay = Schedule.getDelay(datapoint.timestamp, timeSinceOccurrenceStarted, schedule.orElse(null));+ OptionalLong delay = Schedule.getDelay(datapoint.timestamp, timeSinceOccurrenceStart, schedule.orElse(null));if (delay.isEmpty()) {return predictedDatapoints;}@@ -279,14 +284,15 @@ public class SimulatorProtocol extends AbstractProtocol<SimulatorAgent, Simulatoif (timestamp > now) { // Delay can be negative// If the predicted datapoint rolls past the current occurrence skip it// This happens when the offset is less than the time since the occurrence started- if (timeSinceOccurrenceStarted >= 0 && schedule.isPresent() && schedule.get().isAfterUpcoming(timestamp)) {+ if (timeSinceOccurrenceStart >= 0 && schedule.isPresent() && schedule.get().isAfterUpcoming(timestamp)) {continue;}// Return remaining predictions if single occurrence or recurrence end has been surpassedif (schedule.isPresent() && schedule.get().isAfterScheduleEnd(timestamp)) {return predictedDatapoints;}- predictedDatapoints.add(new SimulatorReplayDatapoint(timestamp, datapoint.value).toValueDatapoint());+ long UTCTimestamp = timestamp - tzOffset;+ predictedDatapoints.add(new SimulatorReplayDatapoint(UTCTimestamp, datapoint.value).toValueDatapoint());}}}@@ -303,8 +309,8 @@ public class SimulatorProtocol extends AbstractProtocol<SimulatorAgent, Simulatoif (status.equals(PredictedDatapointWindow.BOTH) || status.equals(PredictedDatapointWindow.NEXT)) {for (SimulatorReplayDatapoint datapoint : simulatorReplayDatapoints) {long timeSinceUpcoming = schedule- .map(s -> now - s.getUpcoming().toInstant(ZoneOffset.UTC).toEpochMilli())- .orElse(timeSinceOccurrenceStarted - DEFAULT_REPLAY_LOOP_DURATION);+ .map(s -> now - s.upcoming.toInstant(ZoneOffset.UTC).toEpochMilli())+ .orElse(timeSinceOccurrenceStart - DEFAULT_REPLAY_LOOP_DURATION);OptionalLong delay = Schedule.getDelay(datapoint.timestamp, timeSinceUpcoming, schedule.orElse(null));if (delay.isEmpty()) {@@ -314,7 +320,8 @@ public class SimulatorProtocol extends AbstractProtocol<SimulatorAgent, Simulatoif (schedule.isPresent() && schedule.get().isAfterScheduleEnd(timestamp)) {return predictedDatapoints;}- predictedDatapoints.add(new SimulatorReplayDatapoint(timestamp, datapoint.value).toValueDatapoint());+ long UTCTimestamp = timestamp - tzOffset;+ predictedDatapoints.add(new SimulatorReplayDatapoint(UTCTimestamp, datapoint.value).toValueDatapoint());}}@@ -404,14 +411,6 @@ public class SimulatorProtocol extends AbstractProtocol<SimulatorAgent, Simulatoreturn recurrence;}- protected LocalDateTime getCurrent() {- return current;- }-- protected LocalDateTime getUpcoming() {- return upcoming;- }-public Optional<Long> calculateDuration() {if (start == null || end == null) {return Optional.empty();@@ -429,8 +428,8 @@ public class SimulatorProtocol extends AbstractProtocol<SimulatorAgent, Simulato* @param millisSinceEpoch Milliseconds since the epoch (1970-01-01T00:00:00Z)* @return The start time of the active occurrence in milliseconds. If not started, the start of the schedule is returned.*/- public long tryAdvanceActive(long millisSinceEpoch) {- long startInMillis = start.toInstant(ZoneOffset.UTC).toEpochMilli();+ public long tryAdvanceActive(long millisSinceEpoch, long tzOffset) {+ long startInMillis = start.toInstant(ZoneOffset.UTC).toEpochMilli() + tzOffset;if (recurrence == null) {current = start;@@ -480,40 +479,23 @@ public class SimulatorProtocol extends AbstractProtocol<SimulatorAgent, Simulato}/**- * Gets the time until the next occurrence starts.- *- * @param timeSinceOccurrenceStarted Milliseconds since the current occurrence started- * @return Milliseconds until the next occurrence starts.- * <p>- * If the recurrence rule has ended returns {@code null} instead.- */- public OptionalLong getTimeUntilNextOccurrence(long timeSinceOccurrenceStarted) {- if (current == null || upcoming == null) {- return OptionalLong.empty();- }-- long duration = upcoming.toEpochSecond(ZoneOffset.UTC) - current.toEpochSecond(ZoneOffset.UTC);- return OptionalLong.of(duration*1000 - timeSinceOccurrenceStarted);- }-- /**- * Calculates the remaining occurrence delay in milliseconds relative to the current time.+ * Calculates the remaining offset delay in milliseconds relative to the current time.** @param offset The offset from the current occurrence in seconds.- * @param timeSinceOccurrenceStarted The time since the occurrence started in milliseconds.- * @return The remaining occurrence delay in milliseconds relative to the current time.+ * @param timeSinceOccurrenceStart The time since the occurrence started in milliseconds.+ * @return The remaining offset delay in milliseconds relative to the current time.* <p>- * If this is a one-time event, or if the recurrence rule has ended returns {@code null} instead.+ * If the recurrence rule has ended returns {@code null} instead.*/- public static OptionalLong getDelay(long offset, long timeSinceOccurrenceStarted, Schedule schedule) {+ public static OptionalLong getDelay(long offset, long timeSinceOccurrenceStart, Schedule schedule) {long offsetInMillis = offset * 1000;- if (offsetInMillis <= timeSinceOccurrenceStarted) {- return getTimeUntilNextOccurrence(timeSinceOccurrenceStarted, schedule)+ if (offsetInMillis <= timeSinceOccurrenceStart) {+ return getTimeUntilNextOccurrence(timeSinceOccurrenceStart, schedule).stream().map(n -> offsetInMillis + n).findFirst();}- return OptionalLong.of(offsetInMillis - timeSinceOccurrenceStarted);+ return OptionalLong.of(offsetInMillis - timeSinceOccurrenceStart);}/**@@ -521,19 +503,23 @@ public class SimulatorProtocol extends AbstractProtocol<SimulatorAgent, Simulato* <p>* If no schedule has been defined uses the default 1-day schedule.*- * @param timeSinceOccurrenceStarted The time since the occurrence started in milliseconds.+ * @param timeSinceOccurrenceStart The time since the occurrence started in milliseconds.* @return The delay in milliseconds until the next occurrence.* <p>- * If this is a one-time event, or if the recurrence rule has ended returns {@code null} instead.+ * If the recurrence rule has ended returns {@code null} instead.*/- public static OptionalLong getTimeUntilNextOccurrence(long timeSinceOccurrenceStarted, Schedule schedule) {+ public static OptionalLong getTimeUntilNextOccurrence(long timeSinceOccurrenceStart, Schedule schedule) {if (schedule != null) {if (schedule.recurrence != null) {- return schedule.getTimeUntilNextOccurrence(timeSinceOccurrenceStarted);+ if (schedule.current == null || schedule.upcoming == null) {+ return OptionalLong.empty();+ }+ long duration = schedule.upcoming.toEpochSecond(ZoneOffset.UTC) - schedule.current.toEpochSecond(ZoneOffset.UTC);+ return OptionalLong.of(duration*1000 - timeSinceOccurrenceStart);}- return OptionalLong.of(-timeSinceOccurrenceStarted);+ return OptionalLong.of(-timeSinceOccurrenceStart);}- return OptionalLong.of(DEFAULT_REPLAY_LOOP_DURATION - timeSinceOccurrenceStarted);+ return OptionalLong.of(DEFAULT_REPLAY_LOOP_DURATION - timeSinceOccurrenceStart);}public boolean hasCurrent() {diff --git a/agent/src/test/java/org/openremote/agent/protocol/simulator/SimulatorAgentProtocolScheduleTest.java b/agent/src/test/java/org/openremote/agent/protocol/simulator/SimulatorAgentProtocolScheduleTest.javaindex 6cfce1ffb..512c8287a 100644--- a/agent/src/test/java/org/openremote/agent/protocol/simulator/SimulatorAgentProtocolScheduleTest.java+++ b/agent/src/test/java/org/openremote/agent/protocol/simulator/SimulatorAgentProtocolScheduleTest.java@@ -31,7 +31,7 @@ public class SimulatorAgentProtocolScheduleTest {Instant.parse("9999-12-31T23:59:59.999Z").toEpochMilli()};for (long epoch : instants) {- assertEquals(start.toEpochMilli(), schedule.tryAdvanceActive(epoch));+ assertEquals(start.toEpochMilli(), schedule.tryAdvanceActive(epoch, 0));}}@@ -54,12 +54,12 @@ public class SimulatorAgentProtocolScheduleTest {start.toEpochMilli() + DAY * 9,};for (long epoch : instants) {- assertEquals(start.toEpochMilli(), schedule.tryAdvanceActive(epoch));+ assertEquals(start.toEpochMilli(), schedule.tryAdvanceActive(epoch, 0));}// Reaching the end will continue to return the start value, so we use another check to end itassertTrue(schedule.isAfterScheduleEnd(Instant.parse("2000-01-10T00:00:00.001Z").toEpochMilli()));- assertEquals(start.toEpochMilli(), schedule.tryAdvanceActive(end.toEpochMilli()+1));+ assertEquals(start.toEpochMilli(), schedule.tryAdvanceActive(end.toEpochMilli()+1, 0));}@Test@@ -68,7 +68,7 @@ public class SimulatorAgentProtocolScheduleTest {SimulatorProtocol.Schedule schedule = new SimulatorProtocol.Schedule(LocalDateTime.ofInstant(start, ZoneOffset.UTC), null, "FREQ=DAILY;UNTIL=20000104T235959");long epoch = Instant.parse("1999-01-01T00:00:00.000Z").toEpochMilli();- assertEquals(start.toEpochMilli(), schedule.tryAdvanceActive(epoch + DAY-1));+ assertEquals(start.toEpochMilli(), schedule.tryAdvanceActive(epoch + DAY-1, 0));long[] instants = {start.toEpochMilli(),@@ -77,16 +77,16 @@ public class SimulatorAgentProtocolScheduleTest {start.toEpochMilli() + DAY * 3,};for (long instant : instants) {- assertEquals(instant, schedule.tryAdvanceActive(instant));+ assertEquals(instant, schedule.tryAdvanceActive(instant, 0));// DAY-1 is within the active occurrence- assertEquals(instant, schedule.tryAdvanceActive(instant + DAY-1));+ assertEquals(instant, schedule.tryAdvanceActive(instant + DAY-1, 0));}// Should only return the start of the current occurrence '2000-01-04T00:00:00.000Z' as there are no future// occurrenceslong until = Instant.parse("2000-01-04T00:00:00.000Z").toEpochMilli();- assertEquals(until, schedule.tryAdvanceActive(until));- assertEquals(until, schedule.tryAdvanceActive(until + DAY));+ assertEquals(until, schedule.tryAdvanceActive(until, 0));+ assertEquals(until, schedule.tryAdvanceActive(until + DAY, 0));}@Test@@ -95,7 +95,7 @@ public class SimulatorAgentProtocolScheduleTest {SimulatorProtocol.Schedule schedule = new SimulatorProtocol.Schedule(LocalDateTime.ofInstant(start, ZoneOffset.UTC), null, "FREQ=DAILY;COUNT=4");long epoch = Instant.parse("1999-01-01T00:00:00.000Z").toEpochMilli();- assertEquals(start.toEpochMilli(), schedule.tryAdvanceActive(epoch + DAY-1));+ assertEquals(start.toEpochMilli(), schedule.tryAdvanceActive(epoch + DAY-1, 0));long[] instants = {start.toEpochMilli(),@@ -103,16 +103,16 @@ public class SimulatorAgentProtocolScheduleTest {start.toEpochMilli() + DAY * 2,};for (long instant : instants) {- assertEquals(instant, schedule.tryAdvanceActive(instant));+ assertEquals(instant, schedule.tryAdvanceActive(instant, 0));// DAY-1 is within the active occurrence- assertEquals(instant, schedule.tryAdvanceActive(instant + DAY-1));+ assertEquals(instant, schedule.tryAdvanceActive(instant + DAY-1, 0));}// Should only return the start of the current occurrence 2000-01-04T00:00:00.000Z as there are no future// occurrenceslong count = Instant.parse("2000-01-04T00:00:00.000Z").toEpochMilli();- assertEquals(count, schedule.tryAdvanceActive(count));- assertEquals(count, schedule.tryAdvanceActive(count + DAY));+ assertEquals(count, schedule.tryAdvanceActive(count, 0));+ assertEquals(count, schedule.tryAdvanceActive(count + DAY, 0));}@Test@@ -121,7 +121,7 @@ public class SimulatorAgentProtocolScheduleTest {SimulatorProtocol.Schedule schedule = new SimulatorProtocol.Schedule(LocalDateTime.ofInstant(start, ZoneOffset.UTC), null, "FREQ=DAILY;BYHOUR=17;BYMINUTE=30");long epoch = Instant.parse("1999-01-01T00:00:00.000Z").toEpochMilli();- assertEquals(start.toEpochMilli() + 17*HOUR + 30*MINUTE, schedule.tryAdvanceActive(epoch + DAY-1));+ assertEquals(start.toEpochMilli() + 17*HOUR + 30*MINUTE, schedule.tryAdvanceActive(epoch + DAY-1, 0));}@Test@@ -132,7 +132,7 @@ public class SimulatorAgentProtocolScheduleTest {SimulatorProtocol.Schedule schedule = new SimulatorProtocol.Schedule(LocalDateTime.ofInstant(start, ZoneOffset.UTC), null, "FREQ=MINUTELY;UNTIL=20000101T000500");long epoch = Instant.parse("1999-01-01T00:00:00.000Z").toEpochMilli();- assertEquals(start.toEpochMilli(), schedule.tryAdvanceActive(epoch + MINUTE-1));+ assertEquals(start.toEpochMilli(), schedule.tryAdvanceActive(epoch + MINUTE-1, 0));long[] instants = {start.toEpochMilli(),@@ -141,14 +141,14 @@ public class SimulatorAgentProtocolScheduleTest {start.toEpochMilli() + MINUTE * 3,};for (long instant : instants) {- assertEquals(instant, schedule.tryAdvanceActive(instant));+ assertEquals(instant, schedule.tryAdvanceActive(instant, 0));// DAY-1 is within the active occurrence- assertEquals(instant, schedule.tryAdvanceActive(instant + MINUTE-1));+ assertEquals(instant, schedule.tryAdvanceActive(instant + MINUTE-1, 0));}long until = Instant.parse("2000-01-01T00:04:00.000Z").toEpochMilli();- assertEquals(until, schedule.tryAdvanceActive(until + MINUTE));- assertEquals(until, schedule.tryAdvanceActive(until + MINUTE * 2));+ assertEquals(until, schedule.tryAdvanceActive(until + MINUTE, 0));+ assertEquals(until, schedule.tryAdvanceActive(until + MINUTE * 2, 0));}@Test@@ -157,8 +157,8 @@ public class SimulatorAgentProtocolScheduleTest {SimulatorProtocol.Schedule schedule = new SimulatorProtocol.Schedule(LocalDateTime.ofInstant(start, ZoneOffset.UTC), null, "FREQ=MINUTELY");long epoch = Instant.parse("2000-01-01T01:00:00.000Z").toEpochMilli();- assertEquals(start.toEpochMilli() + 60*MINUTE, schedule.tryAdvanceActive(epoch));- assertEquals(start.toEpochMilli() + 61*MINUTE, schedule.tryAdvanceActive(epoch+MINUTE));+ assertEquals(start.toEpochMilli() + 60*MINUTE, schedule.tryAdvanceActive(epoch, 0));+ assertEquals(start.toEpochMilli() + 61*MINUTE, schedule.tryAdvanceActive(epoch+MINUTE, 0));}}@@ -171,15 +171,15 @@ public class SimulatorAgentProtocolScheduleTest {SimulatorProtocol.Schedule schedule = new SimulatorProtocol.Schedule(LocalDateTime.ofInstant(start, ZoneOffset.UTC), null, "FREQ=HOURLY");long now = start.toEpochMilli();- long timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now);+ long timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);assertEquals(100 * SECOND, SimulatorProtocol.Schedule.getDelay(100, timeSinceOccurrenceStarted, schedule).getAsLong());now = Instant.parse("2000-01-01T00:01:39.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now);+ timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);assertEquals(SECOND, SimulatorProtocol.Schedule.getDelay(100, timeSinceOccurrenceStarted, schedule).getAsLong());now = Instant.parse("2000-01-01T00:01:40.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now);+ timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);assertEquals(3600 * SECOND, SimulatorProtocol.Schedule.getDelay(100, timeSinceOccurrenceStarted, schedule).getAsLong());}@@ -189,15 +189,15 @@ public class SimulatorAgentProtocolScheduleTest {SimulatorProtocol.Schedule schedule = new SimulatorProtocol.Schedule(LocalDateTime.ofInstant(start, ZoneOffset.UTC), null, "FREQ=HOURLY");long now = Instant.parse("2000-01-01T00:00:00.000Z").toEpochMilli();- long timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now);+ long timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);assertEquals(DAY + 100 * SECOND, SimulatorProtocol.Schedule.getDelay(100, timeSinceOccurrenceStarted, schedule).getAsLong());now = Instant.parse("2000-01-01T00:01:00.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now);+ timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);assertEquals(DAY + 40 * SECOND, SimulatorProtocol.Schedule.getDelay(100, timeSinceOccurrenceStarted, schedule).getAsLong());now = Instant.parse("2000-01-01T00:02:00.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now);+ timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);assertEquals(DAY - 20 * SECOND, SimulatorProtocol.Schedule.getDelay(100, timeSinceOccurrenceStarted, schedule).getAsLong());}@@ -207,35 +207,35 @@ public class SimulatorAgentProtocolScheduleTest {SimulatorProtocol.Schedule schedule = new SimulatorProtocol.Schedule(LocalDateTime.ofInstant(start, ZoneOffset.UTC), null, "FREQ=HOURLY;UNTIL=20000101T020000");long now = Instant.parse("2000-01-01T00:00:00.000Z").toEpochMilli();- long timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now);+ long timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);assertEquals(100 * SECOND, SimulatorProtocol.Schedule.getDelay(100, timeSinceOccurrenceStarted, schedule).getAsLong());now = Instant.parse("2000-01-01T00:01:00.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now);+ timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);assertEquals(40 * SECOND, SimulatorProtocol.Schedule.getDelay(100, timeSinceOccurrenceStarted, schedule).getAsLong());now = Instant.parse("2000-01-01T00:02:00.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now);+ timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);assertEquals(3580 * SECOND, SimulatorProtocol.Schedule.getDelay(100, timeSinceOccurrenceStarted, schedule).getAsLong());now = Instant.parse("2000-01-01T01:00:00.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now);+ timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);assertEquals(100 * SECOND, SimulatorProtocol.Schedule.getDelay(100, timeSinceOccurrenceStarted, schedule).getAsLong());now = Instant.parse("2000-01-01T01:01:00.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now);+ timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);assertEquals(40 * SECOND, SimulatorProtocol.Schedule.getDelay(100, timeSinceOccurrenceStarted, schedule).getAsLong());now = Instant.parse("2000-01-01T01:02:00.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now);+ timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);assertEquals(3580 * SECOND, SimulatorProtocol.Schedule.getDelay(100, timeSinceOccurrenceStarted, schedule).getAsLong());now = Instant.parse("2000-01-01T02:00:00.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now);+ timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);assertEquals(100 * SECOND, SimulatorProtocol.Schedule.getDelay(100, timeSinceOccurrenceStarted, schedule).getAsLong());now = Instant.parse("2000-01-01T02:01:00.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now);+ timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);assertEquals(40 * SECOND, SimulatorProtocol.Schedule.getDelay(100, timeSinceOccurrenceStarted, schedule).getAsLong());// UNTIL will continue to return positive delays if now < UNTIL + offset, so we use another check to end it@@ -243,11 +243,11 @@ public class SimulatorAgentProtocolScheduleTest {// The datapoint won't be replayed after the 3rd occurrence so the delay is negativenow = Instant.parse("2000-01-01T02:02:00.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now);+ timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);assertEquals(-20 * SECOND, SimulatorProtocol.Schedule.getDelay(100, timeSinceOccurrenceStarted, schedule).getAsLong());now = Instant.parse("2000-01-01T03:00:00.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now);+ timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);assertEquals(-3500 * SECOND, SimulatorProtocol.Schedule.getDelay(100, timeSinceOccurrenceStarted, schedule).getAsLong());}@@ -258,44 +258,44 @@ public class SimulatorAgentProtocolScheduleTest {SimulatorProtocol.Schedule schedule = new SimulatorProtocol.Schedule(LocalDateTime.ofInstant(start, ZoneOffset.UTC), null, "FREQ=HOURLY;COUNT=3");long now = Instant.parse("2000-01-01T00:00:00.000Z").toEpochMilli();- long timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now);+ long timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);assertEquals(100 * SECOND, SimulatorProtocol.Schedule.getDelay(100, timeSinceOccurrenceStarted, schedule).getAsLong());now = Instant.parse("2000-01-01T00:01:00.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now);+ timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);assertEquals(40 * SECOND, SimulatorProtocol.Schedule.getDelay(100, timeSinceOccurrenceStarted, schedule).getAsLong());now = Instant.parse("2000-01-01T00:02:00.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now);+ timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);assertEquals(3580 * SECOND, SimulatorProtocol.Schedule.getDelay(100, timeSinceOccurrenceStarted, schedule).getAsLong());now = Instant.parse("2000-01-01T01:00:00.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now);+ timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);assertEquals(100 * SECOND, SimulatorProtocol.Schedule.getDelay(100, timeSinceOccurrenceStarted, schedule).getAsLong());now = Instant.parse("2000-01-01T01:01:00.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now);+ timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);assertEquals(40 * SECOND, SimulatorProtocol.Schedule.getDelay(100, timeSinceOccurrenceStarted, schedule).getAsLong());now = Instant.parse("2000-01-01T01:02:00.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now);+ timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);assertEquals(3580 * SECOND, SimulatorProtocol.Schedule.getDelay(100, timeSinceOccurrenceStarted, schedule).getAsLong());now = Instant.parse("2000-01-01T02:00:00.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now);+ timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);assertEquals(100 * SECOND, SimulatorProtocol.Schedule.getDelay(100, timeSinceOccurrenceStarted, schedule).getAsLong());now = Instant.parse("2000-01-01T02:01:00.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now);+ timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);assertEquals(40 * SECOND, SimulatorProtocol.Schedule.getDelay(100, timeSinceOccurrenceStarted, schedule).getAsLong());// The datapoint won't be replayed after the 3rd occurrence so the delay is negativenow = Instant.parse("2000-01-01T02:02:00.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now);+ timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);assertEquals(-20 * SECOND, SimulatorProtocol.Schedule.getDelay(100, timeSinceOccurrenceStarted, schedule).getAsLong());now = Instant.parse("2000-01-01T03:00:00.000Z").toEpochMilli();- timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now);+ timeSinceOccurrenceStarted = now - schedule.tryAdvanceActive(now, 0);assertEquals(-3500 * SECOND, SimulatorProtocol.Schedule.getDelay(100, timeSinceOccurrenceStarted, schedule).getAsLong());}}diff --git a/test/src/test/groovy/org/openremote/test/protocol/simulator/SimulatorProtocolTest.groovy b/test/src/test/groovy/org/openremote/test/protocol/simulator/SimulatorProtocolTest.groovyindex c3630577f..f29336754 100644--- a/test/src/test/groovy/org/openremote/test/protocol/simulator/SimulatorProtocolTest.groovy+++ b/test/src/test/groovy/org/openremote/test/protocol/simulator/SimulatorProtocolTest.groovy@@ -350,7 +350,7 @@ class SimulatorProtocolTest extends Specification implements ManagerContainerTra// Starting at 2 days, because start date + first datapoint = 2 days since epoch(2..3).each { i ->- def days = i * DAY_IN_MILLIS // Starts at 0 days, increments with 1 day+ def days = i * DAY_IN_MILLIS // Starts at 2 days, increments with 1 dayand: "the delay is 24 hours"conditions.eventually {@@ -639,4 +639,109 @@ class SimulatorProtocolTest extends Specification implements ManagerContainerTradatapoints.get(0).getTimestamp() == HOUR_IN_MILLIS * 3}}++ def "Check Simulator Agent protocol adds predicted datapoints recurringly for Europe/Amsterdam timezone"() {+ when: "replayData is configured to add 3 datapoints every day until the 2nd at 1 for Europe/Amsterdam timezone"+ asset.addOrReplaceAttributes(new Attribute<>("test7", ValueType.TEXT).addMeta(+ new MetaItem<>(AGENT_LINK, new SimulatorAgentLink(agent.getId()).setReplayData(+ new SimulatorReplayDatapoint(HOUR_IN_SECONDS, "test"),+ new SimulatorReplayDatapoint(HOUR_IN_SECONDS * 12, "test"),+ new SimulatorReplayDatapoint(HOUR_IN_SECONDS * 24, "test"),+ ).setSchedule(new SimulatorProtocol.Schedule(+ LocalDateTime.ofInstant(Instant.parse("1970-01-01T00:00:00.000Z"), ZoneOffset.UTC),+ null,+ "FREQ=DAILY;UNTIL=19700102T010000"+ )).setTimezone(TimeZone.getTimeZone("Europe/Amsterdam"))),+ new MetaItem<>(HAS_PREDICTED_DATA_POINTS, true))+ )+ asset = assetStorageService.merge(asset)+ def attribute = asset.getAttribute("test7").get()+ def attributeRef = new AttributeRef(asset.getId(), attribute.getName())++ then: "the agent status should become CONNECTED and the attribute linked to the protocol"+ conditions.eventually {+ assetStorageService.find(agent.getId(), Agent.class).getAgentStatus().orElse(null) == ConnectionStatus.CONNECTED+ protocol.linkedAttributes.get(attributeRef) == attribute+ }++ and: "the delay is 11 hours"+ conditions.eventually {+ delay == HOUR_IN_MILLIS * 11+ }++ and: "the predicted datapoints are present"+ conditions.eventually {+ def datapoints = assetPredictedDatapointService.getDatapoints(attributeRef)+ datapoints.size() == 3+ datapoints.get(2).getTimestamp() == HOUR_IN_MILLIS * 11+ datapoints.get(1).getTimestamp() == HOUR_IN_MILLIS * 23+ datapoints.get(0).getTimestamp() == HOUR_IN_MILLIS * 24+ }++ when: "fast forward 11 hours"+ advancePseudoClock(11, HOURS, container)+ future.get() // resolve future manually, because we surpassed the delay++ then: "the delay is 12 hours"+ conditions.eventually {+ delay == HOUR_IN_MILLIS * 12+ }++ and: "the predicted datapoints are present"+ conditions.eventually {+ def datapoints = assetPredictedDatapointService.getDatapoints(attributeRef)+ datapoints.size() == 3+ datapoints.get(2).getTimestamp() == HOUR_IN_MILLIS * 11+ datapoints.get(1).getTimestamp() == HOUR_IN_MILLIS * 23+ datapoints.get(0).getTimestamp() == HOUR_IN_MILLIS * 24+ }++ when: "fast forward 12 hours"+ advancePseudoClock(12, HOURS, container)+ future.get() // resolve future manually, because we surpassed the delay++ then: "the delay is 1 hour"+ conditions.eventually {+ delay == HOUR_IN_MILLIS+ }++ and: "the predicted datapoints are present"+ conditions.eventually {+ def datapoints = assetPredictedDatapointService.getDatapoints(attributeRef)+ datapoints.size() == 2+ datapoints.get(1).getTimestamp() == HOUR_IN_MILLIS * 23+ datapoints.get(0).getTimestamp() == HOUR_IN_MILLIS * 24+ }++ when: "fast forward 1 hours"+ advancePseudoClock(1, HOURS, container)+ future.get() // resolve future manually, because we surpassed the delay++ then: "the delay is 11 hours"+ conditions.eventually {+ delay == HOUR_IN_MILLIS * 11+ }++ and: "the predicted datapoints are present"+ conditions.eventually {+ def datapoints = assetPredictedDatapointService.getDatapoints(attributeRef)+ datapoints.size() == 1+ datapoints.get(0).getTimestamp() == HOUR_IN_MILLIS * 24 // Last datapoint on the 2nd but -1 because CET+ }++ when: "fast forward 11 hours"+ advancePseudoClock(11, HOURS, container)+ future.get() // resolve future manually, because we surpassed the delay++ then: "the delay is 11 hours"+ conditions.eventually {+ delay == HOUR_IN_MILLIS * 11 // delay hasn't changed as the recurrence ended+ }++ and: "the predicted datapoints are present"+ conditions.eventually {+ def datapoints = assetPredictedDatapointService.getDatapoints(attributeRef)+ datapoints.size() == 0+ }+ }}diff --git a/ui/app/shared/locales/ar/or.json b/ui/app/shared/locales/ar/or.jsonindex 484e7bd58..617cc5520 100644--- a/ui/app/shared/locales/ar/or.json+++ b/ui/app/shared/locales/ar/or.json@@ -553,6 +553,9 @@},"replayData": {"description": ""+ },+ "timezone": {+ "description": ""}},"SimulatorProtocol": {diff --git a/ui/app/shared/locales/cn/or.json b/ui/app/shared/locales/cn/or.jsonindex 4a056c3c6..21b0c9471 100644--- a/ui/app/shared/locales/cn/or.json+++ b/ui/app/shared/locales/cn/or.json@@ -602,6 +602,9 @@},"replayData": {"description": ""+ },+ "timezone": {+ "description": ""}},"SimulatorProtocol": {diff --git a/ui/app/shared/locales/de/or.json b/ui/app/shared/locales/de/or.jsonindex 467c8a8bb..e741146a9 100644--- a/ui/app/shared/locales/de/or.json+++ b/ui/app/shared/locales/de/or.json@@ -648,6 +648,9 @@},"replayData": {"description": ""+ },+ "timezone": {+ "description": ""}},"SimulatorProtocol": {diff --git a/ui/app/shared/locales/en/or.json b/ui/app/shared/locales/en/or.jsonindex 851d134df..a48bb4b85 100644--- a/ui/app/shared/locales/en/or.json+++ b/ui/app/shared/locales/en/or.json@@ -1156,6 +1156,9 @@},"replayData": {"description": "Used to store a dataset of values that should be replayed (i.e. written to the linked attribute) in a continuous loop based on a schedule (by default replays every 24h). Predicted datapoints can be added by configuring 'Store predicted datapoints' which will insert the datapoints immediately as determined by the schedule. Datapoints scheduled after the replay loop are ignored."+ },+ "timezone": {+ "description": "The timezone the Simulator should follow to replay the dataset."}},"SimulatorProtocol": {diff --git a/ui/app/shared/locales/es/or.json b/ui/app/shared/locales/es/or.jsonindex 124e104a4..1bba60cf7 100644--- a/ui/app/shared/locales/es/or.json+++ b/ui/app/shared/locales/es/or.json@@ -605,6 +605,9 @@},"replayData": {"description": ""+ },+ "timezone": {+ "description": ""}},"SimulatorProtocol": {diff --git a/ui/app/shared/locales/fr/or.json b/ui/app/shared/locales/fr/or.jsonindex ea1b71cb7..43e9d23f3 100644--- a/ui/app/shared/locales/fr/or.json+++ b/ui/app/shared/locales/fr/or.json@@ -608,6 +608,9 @@},"replayData": {"description": ""+ },+ "timezone": {+ "description": ""}},"SimulatorProtocol": {diff --git a/ui/app/shared/locales/it/or.json b/ui/app/shared/locales/it/or.jsonindex 9d9493183..e6b881b4b 100644--- a/ui/app/shared/locales/it/or.json+++ b/ui/app/shared/locales/it/or.json@@ -602,6 +602,9 @@},"replayData": {"description": ""+ },+ "timezone": {+ "description": ""}},"SimulatorProtocol": {diff --git a/ui/app/shared/locales/nl/or.json b/ui/app/shared/locales/nl/or.jsonindex 724207ccd..bbe485b63 100644--- a/ui/app/shared/locales/nl/or.json+++ b/ui/app/shared/locales/nl/or.json@@ -1151,6 +1151,9 @@},"replayData": {"description": ""+ },+ "timezone": {+ "description": "De tijdzone die de Simulator moet volgen bij afspelen van de dataset."}},"SimulatorProtocol": {diff --git a/ui/app/shared/locales/pt/or.json b/ui/app/shared/locales/pt/or.jsonindex a1559a9d3..d80f5496d 100644--- a/ui/app/shared/locales/pt/or.json+++ b/ui/app/shared/locales/pt/or.json@@ -603,6 +603,9 @@},"replayData": {"description": ""+ },+ "timezone": {+ "description": ""}},"SimulatorProtocol": {diff --git a/ui/app/shared/locales/ro/or.json b/ui/app/shared/locales/ro/or.jsonindex c1b870c01..f220d980a 100644--- a/ui/app/shared/locales/ro/or.json+++ b/ui/app/shared/locales/ro/or.json@@ -841,6 +841,9 @@},"replayData": {"description": ""+ },+ "timezone": {+ "description": ""}},"SimulatorProtocol": {diff --git a/ui/app/shared/locales/uk/or.json b/ui/app/shared/locales/uk/or.jsonindex 8eeb72e5b..030ed1174 100644--- a/ui/app/shared/locales/uk/or.json+++ b/ui/app/shared/locales/uk/or.json@@ -883,6 +883,9 @@},"replayData": {"description": ""+ },+ "timezone": {+ "description": ""}},"SimulatorProtocol": {diff --git a/ui/component/or-attribute-input/src/agent-link-json-forms-renderer.ts b/ui/component/or-attribute-input/src/agent-link-json-forms-renderer.tsindex f90de9386..3a0693bf3 100644--- a/ui/component/or-attribute-input/src/agent-link-json-forms-renderer.ts+++ b/ui/component/or-attribute-input/src/agent-link-json-forms-renderer.ts@@ -99,7 +99,8 @@ const agentIdRenderer = (state: JsonFormsStateContext, props: ControlProps) => {if (newAgentDescriptor) {props.handleChange("", {id: agent.id,- type: newAgentDescriptor.agentLinkType+ type: newAgentDescriptor.agentLinkType,+ ...(props.rootSchema?.definitions?.[newAgentDescriptor.agentLinkType ?? ""].default ?? {}),});}}diff --git a/ui/component/or-json-forms/package.json b/ui/component/or-json-forms/package.jsonindex 9cac3e568..48caca957 100644--- a/ui/component/or-json-forms/package.json+++ b/ui/component/or-json-forms/package.json@@ -28,7 +28,8 @@"@openremote/or-mwc-components": "workspace:*","@openremote/or-translate": "workspace:*","ajv": "^8.8.2",- "lit": "^3.3.1"+ "lit": "^3.3.1",+ "moment-timezone": "0.6.0"},"publishConfig": {"access": "public"diff --git a/ui/component/or-json-forms/src/controls/control-input-element.ts b/ui/component/or-json-forms/src/controls/control-input-element.tsindex 4d4b05fb8..a83e5e447 100644--- a/ui/component/or-json-forms/src/controls/control-input-element.ts+++ b/ui/component/or-json-forms/src/controls/control-input-element.ts@@ -13,7 +13,9 @@ import {JsonSchema} from "@jsonforms/core";import {isEnumArray} from "../standard-renderers";-import {getSchemaConst} from "../util";+import moment from "moment-timezone";++let defaultTz: string;// language=CSSconst style = css`@@ -51,6 +53,9 @@ export class ControlInputElement extends ControlBaseElement {let options: [string, string][] | undefined;let multiple = false;let value: any = this.data ?? schema.default;+ let searchable: boolean | undefined;+ let searchProvider!: (search?: string) => [any, string][] | undefined;+ let onValueChanged = (e: OrInputChangedEvent) => this.onValueChanged(e);if (Array.isArray(schema.type)) {this.inputType = InputType.JSON;@@ -125,6 +130,21 @@ export class ControlInputElement extends ControlBaseElement {this.inputType = InputType.TEXTAREA;} else if (format === "or-password" || (schema as any).writeOnly) {this.inputType = InputType.PASSWORD;+ } else if (format === "timezone") {+ this.inputType = InputType.SELECT;+ options = moment.tz.names().map(z => [z, z]);+ if (!(defaultTz && value)) {+ defaultTz = Intl.DateTimeFormat().resolvedOptions().timeZone;+ this.handleChange(this.path, defaultTz);+ }+ searchable = true;+ onValueChanged = (e: OrInputChangedEvent) => this.handleChange(this.path, e.detail.value);+ searchProvider = (search?: string) => {+ if (search) {+ return options?.filter(([,name]) => name.toLowerCase().includes(search.toLowerCase()));+ }+ return options?.filter(([,name]) => name.toLowerCase().includes((value ?? defaultTz).toLowerCase().split("/")[0]));+ };}}@@ -136,7 +156,9 @@ export class ControlInputElement extends ControlBaseElement {.id="${this.id}".options="${options}".multiple="${multiple}"- @or-mwc-input-changed="${(e: OrInputChangedEvent) => this.onValueChanged(e)}"+ ?searchable="${searchable}"+ .searchProvider="${searchProvider}"+ @or-mwc-input-changed="${onValueChanged}".maxLength="${maxLength}".minLength="${minLength}".pattern="${pattern}"diff --git a/ui/component/or-json-forms/src/index.ts b/ui/component/or-json-forms/src/index.tsindex 0675edbbd..690c11fbf 100644--- a/ui/component/or-json-forms/src/index.ts+++ b/ui/component/or-json-forms/src/index.ts@@ -41,9 +41,7 @@ declare global {export {ErrorObject,StandardRenderers,- getTemplateWrapper,- JsonFormsRendererRegistryEntry,- UISchemaElement+ getTemplateWrapper};export interface JsonFormsStateContext extends JsonFormsSubStates {@@ -123,7 +121,7 @@ export class OrJSONForms extends translate(i18next)(LitElement) implements OwnPr}if (!this.data) {- this.data = createDefaultValue(this.schema, this.schema);+ this.data = createDefaultValue(this.schema, this.schema);}if (!this.uischema) {diff --git a/yarn.lock b/yarn.lockindex 13469ec39..6703a3382 100644--- a/yarn.lock+++ b/yarn.lock@@ -2118,6 +2118,7 @@ __metadata:"@openremote/or-translate": "workspace:*"ajv: "npm:^8.8.2"lit: "npm:^3.3.1"+ moment-timezone: "npm:0.6.0"languageName: unknownlinkType: soft@@ -8042,6 +8043,15 @@ __metadata:languageName: nodelinkType: hard+"moment-timezone@npm:0.6.0":+ version: 0.6.0+ resolution: "moment-timezone@npm:0.6.0"+ dependencies:+ moment: "npm:^2.29.4"+ checksum: 10c0/16164cf321d8be0bf7d43855286b426c94c8200e0634f2e42cf469f591c6a230ac43f37d3826d76b05ac221f69a571400323fb8625e3d4e8669f4d9ab00fe779+ languageName: node+ linkType: hard+"moment@npm:2.29.4":version: 2.29.4resolution: "moment@npm:2.29.4"