Class: RZWaveWay::CommandClasses::WakeUp
Constant Summary
RZWaveWay::CommandClass::ALARM, RZWaveWay::CommandClass::ALARM_SENSOR, RZWaveWay::CommandClass::ASSOCIATION, RZWaveWay::CommandClass::BASIC, RZWaveWay::CommandClass::BATTERY, RZWaveWay::CommandClass::CONFIGURATION, RZWaveWay::CommandClass::MANUFACTURER_SPECIFIC, RZWaveWay::CommandClass::METER, RZWaveWay::CommandClass::NOTIFICATION, RZWaveWay::CommandClass::SECURITY, RZWaveWay::CommandClass::SENSOR_BINARY, RZWaveWay::CommandClass::SENSOR_MULTI_LEVEL, RZWaveWay::CommandClass::SWITCH_BINARY, RZWaveWay::CommandClass::SWITCH_MULTI_LEVEL, RZWaveWay::CommandClass::VERSION, RZWaveWay::CommandClass::WAKEUP
Instance Attribute Summary
#device
Instance Method Summary
collapse
#initialize, #name, #to_s
#save_properties, #to_hash
Methods included from Logger
#log
Instance Method Details
#build_from(data) ⇒ Object
5
6
7
8
9
10
11
|
# File 'lib/rzwaveway/command_classes/wake_up.rb', line 5
def build_from(data)
define_property(:contact_frequency, 'data.interval', true, data)
define_property(:last_sleep_time, 'data.lastSleep', true, data)
define_property(:last_wakeup_time, 'data.lastWakeup', true, data)
device.notify_contacted(find('data.lastWakeup.value', data))
end
|
13
14
15
|
# File 'lib/rzwaveway/command_classes/wake_up.rb', line 13
def missed_contact_count(time = Time.now)
(elapsed_seconds_since_last_contact(time) / contact_frequency).to_i
end
|
#on_time?(time = Time.now) ⇒ Boolean
17
18
19
|
# File 'lib/rzwaveway/command_classes/wake_up.rb', line 17
def on_time?(time = Time.now)
elapsed_seconds_since_last_contact(time) < (contact_frequency * 1.2)
end
|
#process(updates) ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/rzwaveway/command_classes/wake_up.rb', line 21
def process(updates)
if updates.keys.include?('data.lastWakeup')
data = updates['data.lastWakeup']
value = data['value']
update_time = data['updateTime']
if @properties[:last_wakeup_time].update(value, update_time)
device.notify_contacted(value)
end
end
nil
end
|