Skip to content

TPLinkSmartPlug Class

Namespace: TPLinkSmartDevices.Devices
Inheritance: TPLinkSmartDevice -> TPLinkSmartPlug

encloses plug specific system information and plug controls

Properties

Features

Returns the feature (capability) abbreviations for this plug
public string[] Features { get; private set; }

LedOn

If status led on smart plug is on
public bool LedOn { get; private set; }

OutletPowered

Returns whether the plugs outlet relay is powered on
public bool OutletPowered { get; private set; }

PoweredOnSince

Returns DateTime the relay was powered on
public DateTime PoweredOnSince { get; private set; }

Constructors

TPLinkSmartPlug(string, int)

Creates a new object of this type, used for HS100/HS105 plug

public TPLinkSmartPlug(string hostname, int port=9999)

Parameters
  • string hostname: ip-address of of this plug
  • int port: plug communicates on this port, defaults to 9999

Methods

Create(string, int)

Factory instantiation method. Returns a new instance of this type.

public static async Task<TPLinkSmartPlug> Create(string hostname, int port = 9999)

Parameters
  • string hostname: ip-address of of this plug
  • int port: plug communicates on this port, defaults to 9999

Refresh()

Refreshes all properties of this plug (includes a call to TPLinkSmartDevice.Refresh(dynamic) for the common device information)
public async Task Refresh()

SetPoweredOn(bool)

Change the plugs outlet relay state

public async Task SetPoweredOn(bool value)

Parameters
  • bool value: true power on, false power off

SetLedOn(bool)

Change the plugs LED state; branded as night mode by tp-link :)

public void SetLedOn(bool value)

Parameters
  • bool value: true LED on (day mode), false LED off (night mode)