Class TimedataInfluxDb
java.lang.Object
io.openems.backend.common.component.AbstractOpenemsBackendComponent
io.openems.backend.timedata.influx.TimedataInfluxDb
- All Implemented Interfaces:
DebugLoggable
,BackendTimedata
,Timedata
,CommonTimedataService
,org.osgi.service.event.EventHandler
public class TimedataInfluxDb
extends AbstractOpenemsBackendComponent
implements Timedata, org.osgi.service.event.EventHandler, DebugLoggable
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondebugLog()
Gets some output that is suitable for a continuous Debug log.Gets some output that is suitable for a debug metrics to write down asTimedata
.void
handleEvent
(org.osgi.service.event.Event event) id()
Returns a unique ID for this OpenEMS component.protected static boolean
protected void
Log an info message including the Component ID.protected void
Log a warn message including the Component ID.SortedMap
<ZonedDateTime, SortedMap<ChannelAddress, com.google.gson.JsonElement>> queryHistoricData
(String edgeId, ZonedDateTime fromDate, ZonedDateTime toDate, Set<ChannelAddress> channels, Resolution resolution) Queries historic data.SortedMap
<ChannelAddress, com.google.gson.JsonElement> queryHistoricEnergy
(String edgeId, ZonedDateTime fromDate, ZonedDateTime toDate, Set<ChannelAddress> channels) Queries historic energy.SortedMap
<ZonedDateTime, SortedMap<ChannelAddress, com.google.gson.JsonElement>> queryHistoricEnergyPerPeriod
(String edgeId, ZonedDateTime fromDate, ZonedDateTime toDate, Set<ChannelAddress> channels, Resolution resolution) Queries historic energy per period.void
write
(String edgeId, AggregatedDataNotification notification) Sends the data points to the Timedata service.void
write
(String edgeId, ResendDataNotification data) Sends the data points to the Timedata service.void
write
(String edgeId, TimestampedDataNotification notification) Sends the data points to the Timedata service.Methods inherited from class io.openems.backend.common.component.AbstractOpenemsBackendComponent
getName, logDebug, logDebug, logError, logError, logInfo, logWarn
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.openems.backend.common.timedata.BackendTimedata
queryFirstValueBefore
Methods inherited from interface io.openems.common.timedata.CommonTimedataService
handleQueryHistoricTimeseriesExportXlxsRequest, queryHistoricData
-
Field Details
-
metadata
-
-
Constructor Details
-
TimedataInfluxDb
public TimedataInfluxDb()
-
-
Method Details
-
handleEvent
public void handleEvent(org.osgi.service.event.Event event) - Specified by:
handleEvent
in interfaceorg.osgi.service.event.EventHandler
-
write
Description copied from interface:BackendTimedata
Sends the data points to the Timedata service.- Specified by:
write
in interfaceBackendTimedata
- Parameters:
edgeId
- The unique Edge-IDnotification
- Table of timestamp (epoch in milliseconds), Channel-Address and the Channel value as JsonElement. Sorted by timestamp.
-
write
Description copied from interface:BackendTimedata
Sends the data points to the Timedata service.- Specified by:
write
in interfaceBackendTimedata
- Parameters:
edgeId
- The unique Edge-IDnotification
- Table of timestamp (epoch in milliseconds), Channel-Address and the Channel value as AggregatedData. Sorted by timestamp.
-
write
Description copied from interface:BackendTimedata
Sends the data points to the Timedata service.- Specified by:
write
in interfaceBackendTimedata
- Parameters:
edgeId
- The unique Edge-IDdata
- Table of timestamp (epoch in milliseconds), Channel-Address and the Channel value as ResendData. Sorted by timestamp.
-
queryHistoricData
public SortedMap<ZonedDateTime,SortedMap<ChannelAddress, queryHistoricDatacom.google.gson.JsonElement>> (String edgeId, ZonedDateTime fromDate, ZonedDateTime toDate, Set<ChannelAddress> channels, Resolution resolution) throws OpenemsError.OpenemsNamedException Description copied from interface:CommonTimedataService
Queries historic data.- Specified by:
queryHistoricData
in interfaceCommonTimedataService
- Parameters:
edgeId
- the Edge-ID; or null query allfromDate
- the From-DatetoDate
- the To-Datechannels
- the Channelsresolution
- theResolution
- Returns:
- the query result; possibly null
- Throws:
OpenemsError.OpenemsNamedException
-
queryHistoricEnergy
public SortedMap<ChannelAddress,com.google.gson.JsonElement> queryHistoricEnergy(String edgeId, ZonedDateTime fromDate, ZonedDateTime toDate, Set<ChannelAddress> channels) throws OpenemsError.OpenemsNamedException Description copied from interface:CommonTimedataService
Queries historic energy.- Specified by:
queryHistoricEnergy
in interfaceCommonTimedataService
- Parameters:
edgeId
- the Edge-ID; or null query allfromDate
- the From-DatetoDate
- the To-Datechannels
- the Channels- Returns:
- the query result; possibly null
- Throws:
OpenemsError.OpenemsNamedException
-
queryHistoricEnergyPerPeriod
public SortedMap<ZonedDateTime,SortedMap<ChannelAddress, queryHistoricEnergyPerPeriodcom.google.gson.JsonElement>> (String edgeId, ZonedDateTime fromDate, ZonedDateTime toDate, Set<ChannelAddress> channels, Resolution resolution) throws OpenemsError.OpenemsNamedException Description copied from interface:CommonTimedataService
Queries historic energy per period.This is for use-cases where you want to get the energy for each period (with
Resolution
) per Channel, e.g. to visualize energy in a histogram chart. For each period the energy is calculated by subtracting first value of the period from the last value of the period.- Specified by:
queryHistoricEnergyPerPeriod
in interfaceCommonTimedataService
- Parameters:
edgeId
- the Edge-ID; or null query allfromDate
- the From-DatetoDate
- the To-Datechannels
- the Channelsresolution
- theResolution
- Returns:
- the query result; possibly null
- Throws:
OpenemsError.OpenemsNamedException
-
logInfo
Description copied from class:AbstractOpenemsBackendComponent
Log an info message including the Component ID.- Overrides:
logInfo
in classAbstractOpenemsBackendComponent
- Parameters:
log
- the Logger that is used for writing the logmessage
- the Info-message
-
logWarn
Description copied from class:AbstractOpenemsBackendComponent
Log a warn message including the Component ID.- Overrides:
logWarn
in classAbstractOpenemsBackendComponent
- Parameters:
log
- the Logger that is used for writing the logmessage
- the Warn-message
-
id
Description copied from interface:Timedata
Returns a unique ID for this OpenEMS component. -
isAllowed
-
debugLog
Description copied from interface:DebugLoggable
Gets some output that is suitable for a continuous Debug log.- Specified by:
debugLog
in interfaceDebugLoggable
- Returns:
- the debug log output; null for no log
-
debugMetrics
Description copied from interface:DebugLoggable
Gets some output that is suitable for a debug metrics to write down asTimedata
.- Specified by:
debugMetrics
in interfaceDebugLoggable
- Returns:
- the key value entries to write down; null or emptyMap for no metrics
-