Class Influx

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected Metadata metadata  
    • Constructor Summary

      Constructors 
      Constructor Description
      Influx()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Optional<com.google.gson.JsonElement> getChannelValue​(java.lang.String edgeId, ChannelAddress address)
      Gets the latest value for the given ChannelAddress.
      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)  
      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, int 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, int resolution)
      Queries historic energy per period.
      void write​(java.lang.String edgeId, com.google.common.collect.TreeBasedTable<java.lang.Long,​ChannelAddress,​com.google.gson.JsonElement> data)
      Sends the data points to the Timedata service.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • metadata

        protected volatile Metadata metadata
    • Constructor Detail

      • Influx

        public Influx()
    • Method Detail

      • write

        public void write​(java.lang.String edgeId,
                          com.google.common.collect.TreeBasedTable<java.lang.Long,​ChannelAddress,​com.google.gson.JsonElement> data)
                   throws OpenemsException
        Description copied from interface: Timedata
        Sends the data points to the Timedata service.
        Specified by:
        write in interface Timedata
        Parameters:
        edgeId - The unique Edge-ID
        data - Table of timestamp (epoch in milliseconds), Channel-Address and the Channel value as JsonElement. Sorted by timestamp.
        Throws:
        OpenemsException
      • 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,
                                                                                                                                                                     int 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 length '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 interface CommonTimedataService
        Parameters:
        edgeId - the Edge-ID; or null query all
        fromDate - the From-Date
        toDate - the To-Date
        channels - the Channels
        resolution - the Resolution in seconds
        Throws:
        OpenemsError.OpenemsNamedException
      • getChannelValue

        public java.util.Optional<com.google.gson.JsonElement> getChannelValue​(java.lang.String edgeId,
                                                                               ChannelAddress address)
        Description copied from interface: Timedata
        Gets the latest value for the given ChannelAddress.
        Specified by:
        getChannelValue in interface Timedata
        Parameters:
        edgeId - The unique Edge-ID
        address - The Channel-Address
        Returns:
      • 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 class AbstractOpenemsBackendComponent
        Parameters:
        log - the Logger that is used for writing the log
        message - 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 class AbstractOpenemsBackendComponent
        Parameters:
        log - the Logger that is used for writing the log
        message - the Warn-message