Class: OpenHAB::Core::Items::Persistence::PersistedState

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/openhab/core/items/persistence.rb

Overview

A wrapper for HistoricItem that delegates to its state.

Examples:

max = Power_Usage.maximum_since(LocalTime::MIDNIGHT)
logger.info "Highest power usage: #{max} occurred at #{max.timestamp}" if max > 5 | "kW"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(historic_item, state = nil) ⇒ PersistedState

Returns a new instance of PersistedState.



65
66
67
68
# File 'lib/openhab/core/items/persistence.rb', line 65

def initialize(historic_item, state = nil)
  @historic_item = historic_item
  super(state || historic_item.state)
end

Instance Attribute Details

#nameString (readonly)

Returns Item name.

Returns:

  • (String)

    Item name



63
# File 'lib/openhab/core/items/persistence.rb', line 63

delegate %i[timestamp name] => :@historic_item

#stateTypes::State (readonly)

Returns:



55
# File 'lib/openhab/core/items/persistence.rb', line 55

alias_method :state, :__getobj__

#timestampZonedDateTime (readonly)

Returns:



# File 'lib/openhab/core/items/persistence.rb', line 57