Module: OpenHAB::Core::Things::ProfileCallback

Defined in:
lib/openhab/core/things/profile_callback.rb

Overview

Contains methods for profile's callback to forward commands between items and channels.

Instance Method Summary collapse

Instance Method Details

#handle_command(command) ⇒ Object

Forward the given command to the respective thing handler.

Parameters:



16
17
18
19
20
21
# File 'lib/openhab/core/things/profile_callback.rb', line 16

def handle_command(command)
  @dummy_channel_item ||= DSL::Items::ItemBuilder.item_factory.create_item(link.channel.accepted_item_type,
                                                                           "")
  command = @dummy_channel_item.format_command(command)
  super(command)
end

#send_command(command) ⇒ Object

Send a command to the framework.

Parameters:



28
29
30
31
# File 'lib/openhab/core/things/profile_callback.rb', line 28

def send_command(command)
  command = link.item.format_command(command)
  super(command)
end

#send_update(state) ⇒ Object

Send a state update to the framework.

Parameters:



38
39
40
41
# File 'lib/openhab/core/things/profile_callback.rb', line 38

def send_update(state)
  state = link.item.format_update(state)
  super(state)
end