Class: RZWaveWay::CommandClasses::Battery
- Inherits:
-
RZWaveWay::CommandClass
- Object
- RZWaveWay::CommandClass
- RZWaveWay::CommandClasses::Battery
- Defined in:
- lib/rzwaveway/command_classes/battery.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
Methods included from PropertiesCache
Methods included from Logger
Constructor Details
This class inherits a constructor from RZWaveWay::CommandClass
Instance Method Details
#build_from(data) ⇒ Object
5 6 7 |
# File 'lib/rzwaveway/command_classes/battery.rb', line 5 def build_from(data) define_property(:battery_level, 'data.last', true, data) end |
#process(updates) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/rzwaveway/command_classes/battery.rb', line 9 def process(updates) if updates.keys.include?('data.last') data = updates['data.last'] value = data['value'] update_time = data['updateTime'] if @properties[:battery_level].update(value, update_time) yield BatteryValueEvent.new(device_id: device.id, time: update_time, value: value) end end end |