Module: OpenHAB::Core::Items::Persistence
- Included in:
- GenericItem
- Defined in:
- lib/openhab/core/items/persistence.rb
Overview
Items extensions to support openHAB's Persistence feature.
Defined Under Namespace
Classes: HistoricState
Instance Method Summary collapse
-
#all_states_between(start, finish, service = nil) ⇒ Array<HistoricState>
Returns all the states between two points in time.
-
#all_states_since(timestamp, service = nil) ⇒ Array<HistoricState>
Returns all the states from a point in time until now.
-
#average_between(start, finish, service = nil) ⇒ DecimalType, ...
Returns the average value of the item's state between two points in time.
-
#average_since(timestamp, service = nil) ⇒ DecimalType, ...
Returns the average value of the item's state since the given time.
-
#changed_between?(start, finish, service = nil) ⇒ true, false
Whether the item's state changed between two points in time.
-
#changed_since?(timestamp, service = nil) ⇒ true, false
Whether the item's state has changed since the given time.
-
#count_between(start, finish, service = nil) ⇒ Integer
Returns the number of available historic data points between two points in time.
-
#count_since(timestamp, service = nil) ⇒ Integer
Returns the number of available historic data points from a point in time until now.
-
#count_state_changes_between(start, finish, service = nil) ⇒ Integer
(also: #state_changes_between)
Returns the number of changes in historic data points between two points in time.
-
#count_state_changes_since(timestamp, service = nil) ⇒ Integer
(also: #state_changes_since)
Returns the number of changes in historic data points from a point in time until now.
-
#delta_between(start, finish, service = nil) ⇒ DecimalType, ...
Returns the difference value of the item's state between two points in time.
-
#delta_since(timestamp, service = nil) ⇒ DecimalType, ...
Returns the difference value of the item's state since the given time.
-
#deviation_between(start, finish, service = nil) ⇒ DecimalType, ...
Returns the standard deviation of the item's state between two points in time.
-
#deviation_since(timestamp, service = nil) ⇒ DecimalType, ...
Returns the standard deviation of the item's state since the given time.
-
#evolution_rate(timestamp, service = nil) ⇒ DecimalType, ...
Returns the evolution rate of the item's state.
-
#historic_state(timestamp, service = nil) ⇒ HistoricState?
Returns the the item's state at the given time.
-
#last_update(service = nil) ⇒ ZonedDateTime?
Returns the time the item was last updated.
-
#maximum_between(start, finish, service = nil) ⇒ HistoricState?
Returns the maximum value of the item's state between two points in time.
-
#maximum_since(timestamp, service = nil) ⇒ HistoricState?
Returns the maximum value of the item's state since the given time.
-
#minimum_between(start, finish, service = nil) ⇒ HistoricState?
Returns the minimum value of the item's state between two points in time.
-
#minimum_since(timestamp, service = nil) ⇒ HistoricState?
Returns the minimum value of the item's state since the given time.
-
#persist(service = nil) ⇒ void
Persists the state of the item.
-
#previous_state(service = nil, skip_equal: false) ⇒ HistoricState?
Return the previous state of the item.
-
#sum_between(start, finish, service = nil) ⇒ DecimalType, ...
Returns the sum of the item's state between two points in time.
-
#sum_since(timestamp, service = nil) ⇒ DecimalType, ...
Returns the sum of the item's state since the given time.
-
#updated_between?(start, finish, service = nil) ⇒ true, false
Whether the item's state was updated between two points in time.
-
#updated_since?(timestamp, service = nil) ⇒ true, false
Whether the item's state has been updated since the given time.
-
#variance_between(start, finish, service = nil) ⇒ DecimalType, ...
Returns the variance of the item's state between two points in time.
-
#variance_since(timestamp, service = nil) ⇒ DecimalType, ...
Returns the variance of the item's state since the given time.
Instance Method Details
#all_states_between(start, finish, service = nil) ⇒ Array<HistoricState>
Returns all the states between two points in time.
300 301 302 303 304 305 |
# File 'lib/openhab/core/items/persistence.rb', line 300 %i[persist last_update].each do |method| define_method(method) do |service = nil| service ||= persistence_service Actions::PersistenceExtensions.public_send(method, self, service&.to_s) end end |
#all_states_since(timestamp, service = nil) ⇒ Array<HistoricState>
Returns all the states from a point in time until now.
|
# File 'lib/openhab/core/items/persistence.rb', line 285
|
#average_between(start, finish, service = nil) ⇒ DecimalType, ...
Returns the average value of the item's state between two points in time
|
# File 'lib/openhab/core/items/persistence.rb', line 110
|
#average_since(timestamp, service = nil) ⇒ DecimalType, ...
Returns the average value of the item's state since the given time
|
# File 'lib/openhab/core/items/persistence.rb', line 103
|
#changed_between?(start, finish, service = nil) ⇒ true, false
Whether the item's state changed between two points in time
|
# File 'lib/openhab/core/items/persistence.rb', line 184
|
#changed_since?(timestamp, service = nil) ⇒ true, false
Whether the item's state has changed since the given time
|
# File 'lib/openhab/core/items/persistence.rb', line 178
|
#count_between(start, finish, service = nil) ⇒ Integer
Returns the number of available historic data points between two points in time.
|
# File 'lib/openhab/core/items/persistence.rb', line 265
|
#count_since(timestamp, service = nil) ⇒ Integer
Returns the number of available historic data points from a point in time until now.
|
# File 'lib/openhab/core/items/persistence.rb', line 259
|
#count_state_changes_between(start, finish, service = nil) ⇒ Integer Also known as: state_changes_between
Returns the number of changes in historic data points between two points in time.
|
# File 'lib/openhab/core/items/persistence.rb', line 278
|
#count_state_changes_since(timestamp, service = nil) ⇒ Integer Also known as: state_changes_since
Returns the number of changes in historic data points from a point in time until now.
|
# File 'lib/openhab/core/items/persistence.rb', line 272
|
#delta_between(start, finish, service = nil) ⇒ DecimalType, ...
Returns the difference value of the item's state between two points in time
|
# File 'lib/openhab/core/items/persistence.rb', line 125
|
#delta_since(timestamp, service = nil) ⇒ DecimalType, ...
Returns the difference value of the item's state since the given time
|
# File 'lib/openhab/core/items/persistence.rb', line 118
|
#deviation_between(start, finish, service = nil) ⇒ DecimalType, ...
Returns the standard deviation of the item's state between two points in time
|
# File 'lib/openhab/core/items/persistence.rb', line 140
|
#deviation_since(timestamp, service = nil) ⇒ DecimalType, ...
Returns the standard deviation of the item's state since the given time
|
# File 'lib/openhab/core/items/persistence.rb', line 133
|
#evolution_rate(timestamp, service = nil) ⇒ DecimalType, ... #evolution_rate(start, finish, service = nil) ⇒ DecimalType, ...
Returns the evolution rate of the item's state
|
# File 'lib/openhab/core/items/persistence.rb', line 191
|
#historic_state(timestamp, service = nil) ⇒ HistoricState?
Returns the the item's state at the given time
|
# File 'lib/openhab/core/items/persistence.rb', line 209
|
#last_update(service = nil) ⇒ ZonedDateTime?
Returns the time the item was last updated.
|
# File 'lib/openhab/core/items/persistence.rb', line 98
|
#maximum_between(start, finish, service = nil) ⇒ HistoricState?
Returns the maximum value of the item's state between two points in time
|
# File 'lib/openhab/core/items/persistence.rb', line 223
|
#maximum_since(timestamp, service = nil) ⇒ HistoricState?
Returns the maximum value of the item's state since the given time
|
# File 'lib/openhab/core/items/persistence.rb', line 216
|
#minimum_between(start, finish, service = nil) ⇒ HistoricState?
Returns the minimum value of the item's state between two points in time
|
# File 'lib/openhab/core/items/persistence.rb', line 238
|
#minimum_since(timestamp, service = nil) ⇒ HistoricState?
Returns the minimum value of the item's state since the given time
|
# File 'lib/openhab/core/items/persistence.rb', line 231
|
#persist(service = nil) ⇒ void
This method returns an undefined value.
Persists the state of the item
|
# File 'lib/openhab/core/items/persistence.rb', line 93
|
#previous_state(service = nil, skip_equal: false) ⇒ HistoricState?
Return the previous state of the item
318 319 320 321 322 |
# File 'lib/openhab/core/items/persistence.rb', line 318 def previous_state(service = nil, skip_equal: false) service ||= persistence_service result = Actions::PersistenceExtensions.previous_state(self, skip_equal, service&.to_s) HistoricState.new(quantify(result.state), result) if result end |
#sum_between(start, finish, service = nil) ⇒ DecimalType, ...
Returns the sum of the item's state between two points in time
|
# File 'lib/openhab/core/items/persistence.rb', line 155
|
#sum_since(timestamp, service = nil) ⇒ DecimalType, ...
Returns the sum of the item's state since the given time
|
# File 'lib/openhab/core/items/persistence.rb', line 148
|
#updated_between?(start, finish, service = nil) ⇒ true, false
Whether the item's state was updated between two points in time
|
# File 'lib/openhab/core/items/persistence.rb', line 252
|
#updated_since?(timestamp, service = nil) ⇒ true, false
Whether the item's state has been updated since the given time
|
# File 'lib/openhab/core/items/persistence.rb', line 246
|
#variance_between(start, finish, service = nil) ⇒ DecimalType, ...
Returns the variance of the item's state between two points in time
|
# File 'lib/openhab/core/items/persistence.rb', line 170
|
#variance_since(timestamp, service = nil) ⇒ DecimalType, ...
Returns the variance of the item's state since the given time
|
# File 'lib/openhab/core/items/persistence.rb', line 163
|