Class InfluxImpl
- java.lang.Object
-
- io.openems.backend.common.component.AbstractOpenemsBackendComponent
-
- io.openems.backend.timedata.influx.InfluxImpl
-
- All Implemented Interfaces:
Timedata
,CommonTimedataService
public class InfluxImpl extends AbstractOpenemsBackendComponent implements Timedata
-
-
Constructor Summary
Constructors Constructor Description InfluxImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
id()
Returns a unique ID for this OpenEMS component.protected void
logInfo(org.slf4j.Logger log, java.lang.String message)
Log an info message including the Component ID.protected void
logWarn(org.slf4j.Logger log, java.lang.String message)
Log a warn message including the Component ID.static java.lang.Integer
parseNumberFromName(java.lang.String name)
Parses the number of an Edge from its name string.java.util.SortedMap<java.time.ZonedDateTime,java.util.SortedMap<ChannelAddress,com.google.gson.JsonElement>>
queryHistoricData(java.lang.String edgeId, java.time.ZonedDateTime fromDate, java.time.ZonedDateTime toDate, java.util.Set<ChannelAddress> channels, Resolution resolution)
Queries historic data.java.util.SortedMap<ChannelAddress,com.google.gson.JsonElement>
queryHistoricEnergy(java.lang.String edgeId, java.time.ZonedDateTime fromDate, java.time.ZonedDateTime toDate, java.util.Set<ChannelAddress> channels)
Queries historic energy.java.util.SortedMap<java.time.ZonedDateTime,java.util.SortedMap<ChannelAddress,com.google.gson.JsonElement>>
queryHistoricEnergyPerPeriod(java.lang.String edgeId, java.time.ZonedDateTime fromDate, java.time.ZonedDateTime toDate, java.util.Set<ChannelAddress> channels, Resolution resolution)
Queries historic energy per period.void
write(java.lang.String edgeId, com.google.common.collect.TreeBasedTable<java.lang.Long,java.lang.String,com.google.gson.JsonElement> data)
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.common.timedata.CommonTimedataService
handleQueryHistoricTimeseriesExportXlxsRequest, queryHistoricData
-
-
-
-
Field Detail
-
metadata
protected volatile Metadata metadata
-
-
Method Detail
-
write
public void write(java.lang.String edgeId, com.google.common.collect.TreeBasedTable<java.lang.Long,java.lang.String,com.google.gson.JsonElement> data) throws OpenemsException
Description copied from interface:Timedata
Sends the data points to the Timedata service.- Specified by:
write
in interfaceTimedata
- Parameters:
edgeId
- The unique Edge-IDdata
- Table of timestamp (epoch in milliseconds), Channel-Address and the Channel value as JsonElement. Sorted by timestamp.- Throws:
OpenemsException
- on error
-
parseNumberFromName
public static java.lang.Integer parseNumberFromName(java.lang.String name) throws OpenemsException
Parses the number of an Edge from its name string.e.g. translates "edge0" to "0".
- Parameters:
name
- the edge name- Returns:
- the number
- Throws:
OpenemsException
- on error
-
queryHistoricData
public java.util.SortedMap<java.time.ZonedDateTime,java.util.SortedMap<ChannelAddress,com.google.gson.JsonElement>> queryHistoricData(java.lang.String edgeId, java.time.ZonedDateTime fromDate, java.time.ZonedDateTime toDate, java.util.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
- Throws:
OpenemsError.OpenemsNamedException
-
queryHistoricEnergy
public java.util.SortedMap<ChannelAddress,com.google.gson.JsonElement> queryHistoricEnergy(java.lang.String edgeId, java.time.ZonedDateTime fromDate, java.time.ZonedDateTime toDate, java.util.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
- Throws:
OpenemsError.OpenemsNamedException
-
queryHistoricEnergyPerPeriod
public java.util.SortedMap<java.time.ZonedDateTime,java.util.SortedMap<ChannelAddress,com.google.gson.JsonElement>> queryHistoricEnergyPerPeriod(java.lang.String edgeId, java.time.ZonedDateTime fromDate, java.time.ZonedDateTime toDate, java.util.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
- Throws:
OpenemsError.OpenemsNamedException
-
logInfo
protected void logInfo(org.slf4j.Logger log, java.lang.String message)
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
protected void logWarn(org.slf4j.Logger log, java.lang.String message)
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
-
-