Class: ESPHome::Entities::Select

Inherits:
ESPHome::Entity show all
Includes:
HasState
Defined in:
lib/esphome/entities/select.rb

Instance Attribute Summary collapse

Attributes inherited from ESPHome::Entity

#device, #disabled_by_default, #entity_category, #icon, #key, #name, #object_id_

Instance Method Summary collapse

Methods inherited from ESPHome::Entity

#inspect

Constructor Details

#initialize(_device, list_entities_response) ⇒ Select

Returns a new instance of Select.



10
11
12
13
14
# File 'lib/esphome/entities/select.rb', line 10

def initialize(_device, list_entities_response)
  super

  @options = list_entities_response.options.map(&:freeze).freeze
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



8
9
10
# File 'lib/esphome/entities/select.rb', line 8

def options
  @options
end

Instance Method Details

#command(state) ⇒ Object



16
17
18
# File 'lib/esphome/entities/select.rb', line 16

def command(state)
  device.send(Api::SelectCommandRequest.new(key:, state:))
end