Class: Kasa::Dimmable

Inherits:
NonDimmable show all
Defined in:
lib/kasa/devices.rb

Overview

add dimmable device

Constant Summary

Constants inherited from Device

Kasa::Device::OFF, Kasa::Device::ON

Instance Attribute Summary

Attributes inherited from Device

#alias, #dev_name, #ip, #mac, #model

Instance Method Summary collapse

Methods inherited from Device

#initialize, #off, #off?, #on, #on?, #sysinfo

Constructor Details

This class inherits a constructor from Kasa::Device

Instance Method Details

#brightnessObject

Get brightness



68
69
70
# File 'lib/kasa/devices.rb', line 68

def brightness
  sysinfo['brightness']
end

#brightness=(level) ⇒ Object

Set brightness



73
74
75
76
77
78
79
# File 'lib/kasa/devices.rb', line 73

def brightness=(level)
  Kasa::Protocol.get(
    @ip,
    location: '/smartlife.iot.dimmer/set_brightness',
    value: { brightness: level }
  )
end