-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [conluz-83] Added a new Telegraf service in docker compose file * [conluz-83] Created processor job to read from MQTT messages InfluxDB measurement, process data, transform data and then store data in another InfluxDB measurement * [conluz-83] Removed references to scheduler to get MQTT messages periodically to persist on InfluxDB * [conluz-83] Fixed some namings
- Loading branch information
1 parent
301953d
commit 302a458
Showing
18 changed files
with
366 additions
and
318 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[[inputs.mqtt_consumer]] | ||
servers = ["${CONLUZ_MQTT_SERVER_URI}"] | ||
username = "${CONLUZ_MQTT_SERVER_USERNAME}" | ||
password = "${CONLUZ_MQTT_SERVER_PASSWORD}" | ||
qos = 1 | ||
connection_timeout = "30s" | ||
topics = [ | ||
"${CONLUZ_MQTT_SERVER_TOPIC_PREFIX}/+/emeter/+/power", | ||
] | ||
name_override = "shelly_mqtt_power_messages" | ||
data_format = "value" | ||
data_type = "float" | ||
|
||
[[outputs.influxdb]] | ||
urls = ["${SPRING_INFLUXDB_URL}"] | ||
username = "${SPRING_INFLUXDB_USERNAME}" | ||
password = "${SPRING_INFLUXDB_PASSWORD}" | ||
database = "${SPRING_INFLUXDB_DATABASE}" # required | ||
timeout = "5s" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 0 additions & 76 deletions
76
...coenergia/conluz/infrastructure/consumption/shelly/ShellyConsumptionMessageProcessor.java
This file was deleted.
Oops, something went wrong.
77 changes: 0 additions & 77 deletions
77
...coenergia/conluz/infrastructure/consumption/shelly/ShellyConsumptionMessageScheduler.java
This file was deleted.
Oops, something went wrong.
33 changes: 33 additions & 0 deletions
33
...org/lucoenergia/conluz/infrastructure/consumption/shelly/ShellyMqttPowerMessagePoint.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package org.lucoenergia.conluz.infrastructure.consumption.shelly; | ||
|
||
import org.influxdb.annotation.Column; | ||
import org.influxdb.annotation.Measurement; | ||
|
||
import java.time.Instant; | ||
|
||
@Measurement(name = ShellyMqttPowerMessagePoint.MEASUREMENT) | ||
public class ShellyMqttPowerMessagePoint { | ||
|
||
public static final String MEASUREMENT = "shelly_mqtt_power_messages"; | ||
public static final String TOPIC = "topic"; | ||
public static final String VALUE = "value"; | ||
|
||
@Column(name = "time") | ||
private Instant time; | ||
@Column(name = TOPIC) | ||
private String topic; | ||
@Column(name = VALUE) | ||
private Double value; | ||
|
||
public Instant getTime() { | ||
return time; | ||
} | ||
|
||
public String getTopic() { | ||
return topic; | ||
} | ||
|
||
public Double getValue() { | ||
return value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...cture/consumption/shelly/parse/ShellyMqttPowerMessagesToInstantConsumptionsProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.lucoenergia.conluz.infrastructure.consumption.shelly.parse; | ||
|
||
import org.lucoenergia.conluz.domain.consumption.shelly.ShellyInstantConsumption; | ||
import org.lucoenergia.conluz.domain.consumption.shelly.get.GetShellyConsumptionRepository; | ||
import org.lucoenergia.conluz.domain.consumption.shelly.persist.PersistShellyConsumptionRepository; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.time.OffsetDateTime; | ||
import java.util.List; | ||
|
||
@Component | ||
public class ShellyMqttPowerMessagesToInstantConsumptionsProcessor { | ||
|
||
private final GetShellyConsumptionRepository getShellyConsumptionRepository; | ||
private final PersistShellyConsumptionRepository persistShellyConsumptionRepository; | ||
|
||
public ShellyMqttPowerMessagesToInstantConsumptionsProcessor( | ||
GetShellyConsumptionRepository getShellyConsumptionRepository, | ||
PersistShellyConsumptionRepository persistShellyConsumptionRepository) { | ||
this.getShellyConsumptionRepository = getShellyConsumptionRepository; | ||
this.persistShellyConsumptionRepository = persistShellyConsumptionRepository; | ||
} | ||
|
||
public void process(OffsetDateTime startDate, OffsetDateTime endDate) { | ||
|
||
List<ShellyInstantConsumption> instantConsumptions = getShellyConsumptionRepository.getShellyMqttPowerMessagesByRangeOfDates( | ||
startDate, endDate); | ||
|
||
persistShellyConsumptionRepository.persistInstantConsumptions(instantConsumptions); | ||
} | ||
} |
Oops, something went wrong.