Skip to content

Commit

Permalink
#23 Metrics based on observed channel
Browse files Browse the repository at this point in the history
  • Loading branch information
baardl committed Nov 14, 2023
1 parent d3a5679 commit 3971540
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<dependency>
<groupId>no.cantara.realestate</groupId>
<artifactId>typelib-java</artifactId>
<version>0.4.3</version>
<version>0.4.4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>no.cantara.realestate</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package no.cantara.realestate.cloudconnector.ingestion;

import no.cantara.realestate.observations.ObservationListener;
import no.cantara.realestate.observations.ObservedValue;
import no.cantara.realestate.observations.ObservedPresentValue;
import no.cantara.realestate.plugins.config.PluginConfig;
import no.cantara.realestate.plugins.ingestion.PresentValueIngestionService;
import no.cantara.realestate.plugins.notifications.NotificationListener;
Expand Down Expand Up @@ -89,7 +89,7 @@ public void ingestPresentValues() {
int max = 35;
int min = 10;
for (SensorId sensorId : sensorIds) {
ObservedValue observedValue = new ObservedValue(sensorId, ((Math.random() * (max - min)) + min));
ObservedPresentValue observedValue = new ObservedPresentValue(sensorId, ((Math.random() * (max - min)) + min));
observationListener.observedValue(observedValue);
addIngestionCount();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package no.cantara.realestate.cloudconnector.ingestion;

import no.cantara.realestate.observations.ObservationListener;
import no.cantara.realestate.observations.ObservedValue;
import no.cantara.realestate.observations.ObservedTrendedValue;
import no.cantara.realestate.plugins.config.PluginConfig;
import no.cantara.realestate.plugins.ingestion.PresentValueIngestionService;
import no.cantara.realestate.plugins.notifications.NotificationListener;
Expand Down Expand Up @@ -93,11 +93,11 @@ public void ingestPresentValues() {
int min = 415;
for (SensorId sensorId : sensorIds) {
int co2Value = (int) ((Math.random() * (max - min)) + min);
ObservedValue olderValue = new ObservedValue(sensorId, co2Value);
ObservedTrendedValue olderValue = new ObservedTrendedValue(sensorId, co2Value);
olderValue.setObservedAt(Instant.now().minusSeconds(60*5));
observationListener.observedValue(olderValue);
addIngestionCount();
ObservedValue latestValue = new ObservedValue(sensorId, co2Value + 100);
ObservedTrendedValue latestValue = new ObservedTrendedValue(sensorId, co2Value + 100);
observationListener.observedValue(latestValue);
addIngestionCount();
}
Expand Down

0 comments on commit 3971540

Please sign in to comment.