Skip to content

TPLinkSmartMeterPlug Class

Namespace: TPLinkSmartDevices.Devices
Inheritance: TPLinkSmartPlug -> TPLinkSmartMeterPlug

provides data on power consumption of comsumers connected to a HS110 plug

Properties

CurrentPowerUsage

Returns a PowerData object including power usage data from the latest call to the construtor or .Refresh()
public PowerData CurrentPowerUsage { get; private set; }

IGain

Returns ratio of output current to input current.
public uint IGain { get; private set; }

VGain

Returns ratio of output voltage to input voltage.
public uint VGain { get; private set; }

Constructors

TPLinkSmartMeterPlug(string)

Creates a new object of this type, used for HS110 plug

public TPLinkSmartMeterPlug(string hostname)

Parameters
  • string hostname: ip-address of of this plug

Methods

Create(string, int)

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

public static async Task<TPLinkSmartMeterPlug> 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()

Updates current power usage, gain data and all other properties of this plug (includes a call to TPLinkSmartPlug.Refresh() for the common device information)
public async Task Refresh()

EraseStats()

Erases all collected e-meter statistics of this plug
public void EraseStats()

GetMonthStats(DateTime, float)

Queries collected usage statistics from a specific month. Returns a Dictionary<DateTime, float> of each day in a month and energy consumption of that day in kWh)

public async Task<Dictionary<DateTime, float>> GetMonthStats(int month, int year)

Parameters
  • int month: month of year, ranging from 1(January) to 12(December)
  • int year:

GetYearStats(int, float)

Queries collected usage statistics for a whole year. Returns a Dictionary<int, float> of each month and energy consumption of that month in kWh)

public async Task<Dictionary<int, float>> GetYearStats(int year)

Parameters
  • int year: