class TPLink::Plug
Control TPLink
Smart Plugs
Public Instance Methods
off()
click to toggle source
Turn device off
# File lib/tp_link/plug.rb, line 12 def off relay_state(0) end
on()
click to toggle source
Turn device on
# File lib/tp_link/plug.rb, line 7 def on relay_state(1) end
toggle()
click to toggle source
Toggle device (turn off if on, on if off)
# File lib/tp_link/plug.rb, line 17 def toggle if on? off else on end end
Private Instance Methods
relay_state(s)
click to toggle source
# File lib/tp_link/plug.rb, line 27 def relay_state(s) @parent.send_data(self, "system": { "set_relay_state": { "state": s } }) end