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
22
# File 'lib/openhab/core/things/profile_callback.rb', line 16

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

#send_command(command) ⇒ Object

Send a command to the framework.

Parameters:



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

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

#send_time_series(time_series) ⇒ Object

Send a time series to the framework.

Parameters:

Since:

  • openHAB 4.1



# File 'lib/openhab/core/things/profile_callback.rb', line 44

#send_update(state) ⇒ Object

Send a state update to the framework.

Parameters:



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

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