Class: RZWaveWay::CommandClasses::Alarm
- Inherits:
-
RZWaveWay::CommandClass
- Object
- RZWaveWay::CommandClass
- RZWaveWay::CommandClasses::Alarm
- Defined in:
- lib/rzwaveway/command_classes/alarm.rb
Constant Summary
Constants inherited from RZWaveWay::CommandClass
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
Attributes inherited from RZWaveWay::CommandClass
Instance Method Summary collapse
Methods inherited from RZWaveWay::CommandClass
#build_from, #initialize, #name, #to_s
Methods included from PropertiesCache
Methods included from Logger
Constructor Details
This class inherits a constructor from RZWaveWay::CommandClass
Instance Method Details
#process(updates) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/rzwaveway/command_classes/alarm.rb', line 5 def process(updates) updates.each do |key, value| if key == 'data.V1event' alarm_type = value['alarmType']['value'] yield AlarmEvent.new(device_id: device.id, time: value['updateTime'], alarm_type: ALARM_TYPES[alarm_type], level: value['level']['value']) else match_data = key.match(/^data.(\d+)/) if match_data alarm_type = match_data[1].to_i yield AlarmEvent.new(device_id: device.id, time: value['updateTime'], alarm_type: ALARM_TYPES[alarm_type], level: value['event']['value']) end end end end |