lib/cosmos/packets/limits.rb in cosmos-3.2.1 vs lib/cosmos/packets/limits.rb in cosmos-3.3.0
- old
+ new
@@ -199,11 +199,12 @@
# @param persistence [Integer] The number of samples the value must be out of limits before detecting a limits change. nil = Leave unchanged
# @param enabled [Boolean] If limits monitoring is enabled for this item
# @return [Array<limits_set, persistence, enabled, red_low, yellow_low, red_high, yellow_high, green_low (optional), green_high (optional)] Limits information
def set(target_name, packet_name, item_name, red_low, yellow_low, yellow_high, red_high, green_low = nil, green_high = nil, limits_set = :CUSTOM, persistence = nil, enabled = true)
packet = get_packet(target_name, packet_name)
- limits = packet.get_item(item_name).limits
+ item = packet.get_item(item_name)
+ limits = item.limits
if limits_set
limits_set = limits_set.to_s.upcase.intern
else
limits_set = System.limits_set
end
@@ -229,10 +230,10 @@
limits_for_set[4] = green_low.to_f
limits_for_set[5] = green_high.to_f
end
limits.enabled = enabled
limits.persistence_setting = Integer(persistence) if persistence
- packet.update_limits_items_cache
+ packet.update_limits_items_cache(item)
@config.limits_sets << limits_set
@config.limits_sets.uniq!
return [limits_set, limits.persistence_setting, limits.enabled, limits_for_set[0], limits_for_set[1], limits_for_set[2], limits_for_set[3], limits_for_set[4], limits_for_set[5]]
end