Class: EmuPower::Notifications::PriceCluster

Inherits:
Notification show all
Defined in:
lib/emu_power/notifications.rb

Constant Summary

Constants inherited from Notification

Notification::UNIX_TIME_OFFSET

Instance Attribute Summary collapse

Attributes inherited from Notification

#device_mac, #meter_mac, #raw, #timestamp

Instance Method Summary collapse

Methods inherited from Notification

#initialize, #parse_amount, #parse_bool, #parse_hex, #parse_timestamp, root_name, subclasses, #to_s

Constructor Details

This class inherits a constructor from EmuPower::Notifications::Notification

Instance Attribute Details

#currency_codeObject

This is an ISO 3-digit currency code. 840 is USD



329
330
331
# File 'lib/emu_power/notifications.rb', line 329

def currency_code
  @currency_code
end

#durationObject

Returns the value of attribute duration.



333
334
335
# File 'lib/emu_power/notifications.rb', line 333

def duration
  @duration
end

#labelObject

Returns the value of attribute label.



334
335
336
# File 'lib/emu_power/notifications.rb', line 334

def label
  @label
end

#priceObject

Returns the value of attribute price.



328
329
330
# File 'lib/emu_power/notifications.rb', line 328

def price
  @price
end

#start_timeObject

Returns the value of attribute start_time.



332
333
334
# File 'lib/emu_power/notifications.rb', line 332

def start_time
  @start_time
end

#tierObject

Returns the value of attribute tier.



331
332
333
# File 'lib/emu_power/notifications.rb', line 331

def tier
  @tier
end

#trailing_digitsObject

Returns the value of attribute trailing_digits.



330
331
332
# File 'lib/emu_power/notifications.rb', line 330

def trailing_digits
  @trailing_digits
end

Instance Method Details

#build(hash) ⇒ Object



336
337
338
339
340
341
342
343
344
# File 'lib/emu_power/notifications.rb', line 336

def build(hash)
	self.price = parse_hex('Price')
	self.currency_code = parse_hex('Currency')
	self.trailing_digits = parse_hex('TrailingDigits')
	self.tier = parse_hex('Tier')
	self.start_time = parse_timestamp('StartTime')
	self.duration = parse_hex('Duration')
	self.label = hash['RateLabel']
end