diff --git a/lib/openhab/core/items/persistence.rb b/lib/openhab/core/items/persistence.rb index b22f157ca..e735c5736 100644 --- a/lib/openhab/core/items/persistence.rb +++ b/lib/openhab/core/items/persistence.rb @@ -74,6 +74,7 @@ def timestamp PERSISTENCE_METHODS = (QUANTITY_METHODS + %i[changed_since? count_since + count_state_changes_since evolution_rate historic_state maximum_since @@ -249,6 +250,19 @@ def timestamp # @param [Symbol, String] service An optional persistence id instead of the default persistence service. # @return [Integer] The number of values persisted for this item. + # @!method count_state_changes_since(timestamp, service = nil) + # Returns the number of changes in historic data points from a point in time until now. + # @param [#to_zoned_date_time] timestamp The point in time from which to search + # @param [Symbol, String] service An optional persistence id instead of the default persistence service. + # @return [Integer] The number of values persisted for this item. + + # @!method count_state_changes_between(start, finish, service = nil) + # Returns the number of changes in historic data points between two points in time. + # @param [#to_zoned_date_time] start The point in time from which to search + # @param [#to_zoned_date_time] finish The point in time to which to search + # @param [Symbol, String] service An optional persistence id instead of the default persistence service. + # @return [Integer] The number of values persisted for this item. + %i[persist last_update].each do |method| define_method(method) do |service = nil| service ||= persistence_service