Code Monkey home page Code Monkey logo

tplinksmartdevices's Introduction

TP-Link Smart Devices SDK

This library allows a developer to discover and operate TP-Link Smart Devices with C# applications.

This includes support for TP-Link Smart Switches HS100/105/110 as well as TP-Link Smart Bulbs LB100/110/120/130.

NuGet Packages

A NuGet package for this version is available at https://www.nuget.org/packages/TPLinkSmartDevice.NETCore/

NOTICE: Unfortunately, a couple of other users have forked this work and published their own NuGet packages without attribution. However, instead of publishing yet another .NET package, I have opted to just re-point the project to to netstandard and release a package for that target instead. If there is a need to create another .NET package for it in the future, I will be happy to do so. If users have contributions, I encourage them to open pull requests here.

Usage

Discovery

// Runs in a Task<List<TPLinkSmartDevice>>
var discoveredDevices = new TPLinkSmartDevices.TPLinkDiscovery().Discover().Result;

Basic Usage

var smartPlug = new TPLinkSmartDevices.Devices.TPLinkSmartPlug("HS100.myhome.net");
smartPlug.OutletPowered = true; // Turn on relay
smartPlug.OutletPowered = false; // Turn off relay

var smartBulb = new TPLinkSmartDevices.Devices.TPLinkSmartBulb("LB100.myhome.net");
smartBulb.PoweredOn = true; // Turn on bulb
smartBulb.PoweredOn = false; // Turn off bulb

Message Caching

Both the TPLinkSmartPlug and TPLinkSmartBulb classes have a MessageCache object, which allows the developer to adjust the caching behavior of the library based on their needs. The options as packaged are NoMessageCache, ManualMessageCache, and TimeGatedMessageCache.

  • NoMessageCache passes all requests through to the device in real-time.

  • ManualMessageCache caches everything and only updates the cache after the Flush() function is called.

  • TimeGatedMessageCache (default) expires messages in cache after a given number of seconds from their original cache time.

Disclaimer

This is an unofficial SDK that has no affiliation with TP-Link.

TP-Link and all respective product names are copyright TP-Link Technologies Co, Ltd. and/or its subsidiaries and affiliates.

tplinksmartdevices's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.