Module: ESPHome::Entity::HasState
- Defined in:
- lib/esphome/entity.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(klass) ⇒ Object
6 7 8 9 10 |
# File 'lib/esphome/entity.rb', line 6 def self.included(klass) super klass.attr_reader :state end |
Instance Method Details
#formatted_state ⇒ Object
22 23 24 |
# File 'lib/esphome/entity.rb', line 22 def formatted_state state.nil? ? "-" : state.to_s end |
#update(state_response) ⇒ Object
18 19 20 |
# File 'lib/esphome/entity.rb', line 18 def update(state_response) @state = state_response.missing_state ? nil : state_response.state end |