Class: OpenHAB::Core::Events::ItemEvent

Inherits:
AbstractEvent show all
Defined in:
lib/openhab/core/events/item_event.rb

Overview

Adds methods to core openHAB ItemEvent to make it more natural in Ruby

Instance Attribute Summary collapse

Attributes inherited from AbstractEvent

#attachment, #inputs, #source

Method Summary

Methods inherited from AbstractEvent

#inspect, #payload

Instance Attribute Details

#groupItem? (readonly)

Returns the group item whose member had triggered this event.

This is the equivalent of openHAB's triggeringGroup, and it is only available on a member-of-group trigger.

Returns:

  • (Item, nil)

    The group item whose member had triggered this event. nil when the event wasn't triggered by a member-of-group trigger.

Since:

  • openHAB 4.0 for file-based rules

  • openHAB 4.1 for UI rules



34
35
36
37
# File 'lib/openhab/core/events/item_event.rb', line 34

def group
  triggering_group = inputs&.[]("triggeringGroup") || Core.ui_context&.[](:triggeringGroup)
  Items::Proxy.new(triggering_group) if triggering_group
end

#itemItem (readonly)

Returns The item that triggered this event.

Returns:

  • (Item)

    The item that triggered this event.



16
17
18
# File 'lib/openhab/core/events/item_event.rb', line 16

def item
  EntityLookup.lookup_item(item_name)
end