Class: Kasa::SmartStrip
- Inherits:
-
NonDimmable
- Object
- Device
- NonDimmable
- Kasa::SmartStrip
- Defined in:
- lib/kasa/devices.rb
Overview
add dimmable device
Constant Summary
Constants inherited from Device
Instance Attribute Summary collapse
-
#children ⇒ Object
Returns the value of attribute children.
Attributes inherited from Device
#alias, #dev_name, #ip, #mac, #model
Instance Method Summary collapse
-
#initialize(ip, args) ⇒ SmartStrip
constructor
A new instance of SmartStrip.
-
#off(index) ⇒ Object
Turn off light.
- #off?(index) ⇒ Boolean
-
#on(index) ⇒ Object
Turn on light.
- #on?(index) ⇒ Boolean
Methods inherited from Device
Constructor Details
#initialize(ip, args) ⇒ SmartStrip
Returns a new instance of SmartStrip.
86 87 88 89 |
# File 'lib/kasa/devices.rb', line 86 def initialize(ip, args) super @children = args['children'].map { |c| c['id'] } end |
Instance Attribute Details
#children ⇒ Object
Returns the value of attribute children.
84 85 86 |
# File 'lib/kasa/devices.rb', line 84 def children @children end |
Instance Method Details
#off(index) ⇒ Object
Turn off light
97 98 99 |
# File 'lib/kasa/devices.rb', line 97 def off(index) relay OFF, index end |
#off?(index) ⇒ Boolean
101 102 103 |
# File 'lib/kasa/devices.rb', line 101 def off?(index) relay_state(index).zero? end |
#on(index) ⇒ Object
Turn on light
92 93 94 |
# File 'lib/kasa/devices.rb', line 92 def on(index) relay ON, index end |
#on?(index) ⇒ Boolean
105 106 107 |
# File 'lib/kasa/devices.rb', line 105 def on?(index) relay_state(index).eql? 1 end |