class Elemac::Light

Constants

DAYLIGHT_SAVE
DAY_BREAK_END
DAY_BREAK_START
LAMP_POWER_ON_DELAY
NIGHT_BREAK_END
NIGHT_BREAK_START
OFFSET
SUNRISE
SUNSET

Public Class Methods

new(device:) click to toggle source
# File lib/elemac/light.rb, line 16
def initialize(device:)
        @device = device
end

Public Instance Methods

day_break_end() click to toggle source
# File lib/elemac/light.rb, line 39
def day_break_end
        prop = Property.new(offset: get_offset, address: DAY_BREAK_END, type: :short)
        Converter.int_to_hour(get_data(prop.to_s))
end
day_break_start() click to toggle source
# File lib/elemac/light.rb, line 34
def day_break_start
        prop = Property.new(offset: get_offset, address: DAY_BREAK_START, type: :short)
        Converter.int_to_hour(get_data(prop.to_s))
end
get_offset() click to toggle source
# File lib/elemac/light.rb, line 20
def get_offset
        OFFSET
end
inspect() click to toggle source
# File lib/elemac/light.rb, line 59
def inspect
        puts "SUNRISE:\t#{sunrise}"
        puts "D-BREAK START:\t#{day_break_start}"
        puts "D-BREAK END:\t#{day_break_end}"
        puts "SUNSET:\t\t#{sunset}"
        puts "N-BREAK START:\t#{night_break_start}"
        puts "N-BREAK END:\t#{night_break_end}"
        puts "HQI DELAY:\t#{light_power_on_delay}"
end
light_power_on_delay() click to toggle source
# File lib/elemac/light.rb, line 54
def light_power_on_delay
        prop = Property.new(offset: get_offset, address: LAMP_POWER_ON_DELAY, type: :char)
        get_data(prop.to_s)
end
night_break_end() click to toggle source
# File lib/elemac/light.rb, line 49
def night_break_end
        prop = Property.new(offset: get_offset, address: NIGHT_BREAK_END, type: :short)
        Converter.int_to_hour(get_data(prop.to_s))
end
night_break_start() click to toggle source
# File lib/elemac/light.rb, line 44
def night_break_start
        prop = Property.new(offset: get_offset, address: NIGHT_BREAK_START, type: :short)
        Converter.int_to_hour(get_data(prop.to_s))
end
sunrise() click to toggle source
# File lib/elemac/light.rb, line 24
def sunrise
        prop = Property.new(offset: get_offset, address: SUNRISE, type: :short)
        Converter.int_to_hour(get_data(prop.to_s))
end
sunset() click to toggle source
# File lib/elemac/light.rb, line 29
def sunset
        prop = Property.new(offset: get_offset, address: SUNSET, type: :short)
        Converter.int_to_hour(get_data(prop.to_s))
end

Private Instance Methods

get_data(address) click to toggle source
# File lib/elemac/light.rb, line 70
def get_data(address)
        @device.request_data(address)
end