Class: ESPHome::Cli::Entities::DateTime

Inherits:
Form show all
Defined in:
lib/esphome/cli/entities/date_time.rb

Instance Attribute Summary

Attributes inherited from ESPHome::Cli::Entity

#cli, #index

Instance Method Summary collapse

Methods inherited from Form

#activate, #initial_value, #initialize, #suffix

Methods inherited from ESPHome::Cli::Entity

#initialize, #move_left, #move_right, #print, #touch

Constructor Details

This class inherits a constructor from ESPHome::Cli::Entities::Form

Instance Method Details

#command(value) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/esphome/cli/entities/date_time.rb', line 15

def command(value)
  begin
    value = Time.parse(value)
  rescue ArgumentError
    cli.error("Invalid timestamp: #{value}")
    return
  end

  cli.info("Setting #{object_id_} to #{value.iso8601}")
  super
end

#length_rangeObject



11
12
13
# File 'lib/esphome/cli/entities/date_time.rb', line 11

def length_range
  25..25
end