Class: EmuPower::Commands::SetSchedule

Inherits:
Command
  • Object
show all
Defined in:
lib/emu_power/commands.rb

Overview

Note: This doesn’t seem to work. The command is issued successfully, but the EMU does not update any schedule info. This may be disallowed by the meter or something.

Constant Summary collapse

EVENTS =
%w[time message price summation demand scheduled_prices profile_data billing_period block_period]

Instance Method Summary collapse

Methods inherited from Command

#to_command, #to_hex, #to_yn

Constructor Details

#initialize(event, frequency, enabled) ⇒ SetSchedule

Returns a new instance of SetSchedule.

Raises:

  • (ArgumentError)


82
83
84
85
86
87
88
# File 'lib/emu_power/commands.rb', line 82

def initialize(event, frequency, enabled)
  super('set_schedule')
  raise ArgumentError.new("Event must be one of #{EVENTS.join(', ')}") unless EVENTS.include?(event)
  @data[:event] = event
  @data[:frequency] = to_hex(frequency, 4)
  @data[:enabled] = to_yn(enabled)
end