Class: ESPHome::Entities::Select
- Inherits:
-
ESPHome::Entity
- Object
- ESPHome::Entity
- ESPHome::Entities::Select
- Includes:
- HasState
- Defined in:
- lib/esphome/entities/select.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Attributes inherited from ESPHome::Entity
#device, #disabled_by_default, #entity_category, #icon, #key, #name, #object_id_
Instance Method Summary collapse
- #command(state) ⇒ Object
-
#initialize(_device, list_entities_response) ⇒ Select
constructor
A new instance of Select.
Methods inherited from ESPHome::Entity
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..map(&:freeze).freeze end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
8 9 10 |
# File 'lib/esphome/entities/select.rb', line 8 def @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 |