TPLinkSmartDimmmer Class
Namespace: TPLinkSmartDevices.Devices
Inheritance: TPLinkSmartDevice -> TPLinkSmartDimmer
controls for wall switches with dimmer functionality 
Properties
Brightness
- Returns brightness (dimmer value) in percent
public int Brightness { get; private set; }
Options
- Returns an object of type DimmerOptionswith configuration propertiespublic DimmerOptions Options { get; private set; }
Presets
- Returns array of the four dimmer state preset configurations containing brightness values
public int[] Presets { get; private set; }
PoweredOn
- Returns whether switch is powered on 
public bool PoweredOn { get; private set; }
Constructors
TPLinkSmartPlug(string, int, DimmerOptions)
- 
Creates a new object of this type, used for HS220 wall switch public TPLinkSmartPlug(string hostname, int port=9999, DimmerOptions opts = null)- Parameters
- 
- string hostname: ip-address of this device
- int port: device communicates on this port, defaults to- 9999
- DimmerOptions opts: configuration properties`
 
 
Methods
Create(string, int, DimmerOptions)
- 
Factory instantiation method. Returns a new instance of this type. public static async Task<TPLinkSmartPlug> Create(string hostname, int port = 9999, DimmerOptions opts = null)- Parameters
- 
- string hostname: ip-address of this device
- int port: device communicates on this port, defaults to- 9999
- DimmerOptions opts: configuration properties`
 
 
Refresh()
- Refreshes all properties of this device (includes a call to TPLinkSmartDevice.Refresh(dynamic)for the common device information)public async Task Refresh()
SetPoweredOn(bool)
- 
Change the power state public void SetPoweredOn(bool value)- Parameters
- 
- bool value:- truepower on,- falsepower off
 
 
TransitionBrightness(int, DimmerMode, int)
- 
Transition to a specified brightness level public async Task TransitionBrightness(int brightness, DimmerMode? mode = null, int? duration = null)- Parameters
- 
- int brightness: dimmer brightness value in percent
- DimmerMode mode(optional):- DimmerModeto use during this transition, if left empty uses default option from- Options.Mode
- int duration(optional): time in milliseconds in which the bulb transitions from old to new brightness
 
- Exceptions
- 
- ArgumentException:- brightnessshould be between- 0and- 100
 
 
SetBrightness(int)
- 
Instantly change to a specified brightness level public async Task SetBrightness(int brightness)- Parameters
- 
- int brightness: dimmer brightness value in percent
 
- Exceptions
- 
- ArgumentException:- brightnessshould be between- 0and- 100
 
 
SetDoubleClickAction(DimmerMode, int)
- 
Configures change mode on double click of switch public async Task SetDoubleClickAction(DimmerMode mode, int index=0)- Parameters
- 
- DimmerMode mode:- DimmerModeto use on double clicking the switch
- int index(optional): zero-based preset index, use in combination with- DimmerMode.Presetto execute preset on double click
 
- Exceptions
- 
- ArgumentException:- indexshould be between- 0and- 3
 
 
SetLongPressAction(DimmerMode, int)
- 
Configures change mode on long press of switch public async Task SetLongPressAction(DimmerMode mode, int index=0)- Parameters
- 
- DimmerMode mode:- DimmerModeto use on long press of switch
- int index(optional): zero-based preset index, use in combination with- DimmerMode.Presetto execute preset on long press
 
- Exceptions
- 
- ArgumentException:- indexshould be between- 0and- 3
 
 
SetFadeOnTime(int)
- 
Configures speed of fade on transition public async Task SetFadeOnTime(int fadeOnTime)- Parameters
- 
- int fadeOnTime: transition time used on next uses of switch when turning on
 
- Exceptions
- 
- ArgumentException:- fadeOnTimeshould be a positive number
 
 
SetFadeOffTime(int)
- 
Configures speed of fade on transition public async Task SetFadeOffTime(int fadeOffTime)- Parameters
- 
- int fadeOffTime: transition time used on next uses of switch when turning off
 
- Exceptions
- 
- ArgumentException:- fadeOffTimeshould be a positive number