Class: Belphanior::Servant::HomeNetwork::Insteon_2412n_Insteon_Codec

Inherits:
Object
  • Object
show all
Defined in:
lib/belphanior/servant/homenetwork/insteon_2412n_insteon_codec.rb

Defined Under Namespace

Classes: BadCode

Constant Summary collapse

COMMAND_CODE_TABLE =
{
  :on => "11",
  :fast_on => "12",
  :off => "13",
  :fast_off => "14",
}
BRIGHTNESS_CODE_LIST =
[
  [0, "00"],
  [0.1, "19"],
  [0.25, "40"],
  [0.5, "7F"],
  [0.75, "BF"],
  [0.9, "E6"],
  [1, "FF"]
]
INSTEON_PREFIX =
"0262"

Instance Method Summary collapse

Constructor Details

#initialize(marshaller) ⇒ Insteon_2412n_Insteon_Codec

Returns a new instance of Insteon_2412n_Insteon_Codec.



26
27
28
# File 'lib/belphanior/servant/homenetwork/insteon_2412n_insteon_codec.rb', line 26

def initialize(marshaller)
  @marshaller = marshaller
end

Instance Method Details

#device_off(address) ⇒ Object



34
35
36
# File 'lib/belphanior/servant/homenetwork/insteon_2412n_insteon_codec.rb', line 34

def device_off(address)
  send_command(address, :fast_off, "FF")
end

#device_on(address) ⇒ Object



30
31
32
# File 'lib/belphanior/servant/homenetwork/insteon_2412n_insteon_codec.rb', line 30

def device_on(address)
  send_command(address, :fast_on, "FF")
end

#device_set_brightness(address, brightness) ⇒ Object

Set the brightness level. address: 6-hexcode address of INSTEON device. brightness: float value between 0 and 1



41
42
43
# File 'lib/belphanior/servant/homenetwork/insteon_2412n_insteon_codec.rb', line 41

def device_set_brightness(address, brightness)
  send_command(address, :on, brightness_value_to_code(brightness))
end