Class: ESPHome::Entities::Text
- Inherits:
-
ESPHome::Entity
- Object
- ESPHome::Entity
- ESPHome::Entities::Text
- Includes:
- HasState
- Defined in:
- lib/esphome/entities/text.rb
Instance Attribute Summary collapse
-
#length_range ⇒ Object
readonly
Returns the value of attribute length_range.
-
#mode ⇒ Object
readonly
Returns the value of attribute mode.
-
#pattern ⇒ Object
readonly
Returns the value of attribute pattern.
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) ⇒ Text
constructor
A new instance of Text.
Methods inherited from ESPHome::Entity
Constructor Details
#initialize(_device, list_entities_response) ⇒ Text
Returns a new instance of Text.
10 11 12 13 14 15 16 |
# File 'lib/esphome/entities/text.rb', line 10 def initialize(_device, list_entities_response) super @length_range = Range.new(list_entities_response.min_length, list_entities_response.max_length) @pattern = list_entities_response.pattern.empty? ? nil : list_entities_response.pattern @mode = list_entities_response.mode[10..].downcase.to_sym end |
Instance Attribute Details
#length_range ⇒ Object (readonly)
Returns the value of attribute length_range.
8 9 10 |
# File 'lib/esphome/entities/text.rb', line 8 def length_range @length_range end |
#mode ⇒ Object (readonly)
Returns the value of attribute mode.
8 9 10 |
# File 'lib/esphome/entities/text.rb', line 8 def mode @mode end |
#pattern ⇒ Object (readonly)
Returns the value of attribute pattern.
8 9 10 |
# File 'lib/esphome/entities/text.rb', line 8 def pattern @pattern end |
Instance Method Details
#command(state) ⇒ Object
18 19 20 |
# File 'lib/esphome/entities/text.rb', line 18 def command(state) device.send(Api::TextCommandRequest.new(key:, state:)) end |