Giter Club home page Giter Club logo

avmsmarthome's Introduction

AvmSmartHome

Implementation of the AVM Smart Home API

Installation

You can install the package from NuGet: AvmSmartHome.NET

The library implements .NET Standard 1.4 and is supported on (and above):

  • .NET Core 1.0
  • .NET Framework 4.6.1
  • Mono 4.6
  • Xamarin.iOS 10.0
  • Xamarin.Android 7.0
  • Universal Windows Platform 10

Usage

SessionInfo session = new SessionInfo("myiotuser", "myiotpwd", "fritz.box");
await session.AuthenticateAsync();
string[] switches = await session.GetSwitchesAsync();

// Steckdose auswählen
string ain = switches[0];

string name = await session.GetSwitchNameAsync(ain);
double power = await session.GetSwitchPowerAsync(ain);
double energy = await session.GetSwitchEnergyAsync(ain);
double temp = await session.GetSwitchTemperatureAsync(ain);

string message = $"Switch {ain}" +
    $"\r\n name   = {name}" +
    $"\r\n P [mW] = {power}" +
    $"\r\n E [Wh] = {energy}" +
    $"\r\n T [°C] = {temp}";
Debug.WriteLine(message);

// Steckdose anschalten
await session.SetSwitchAsync(ain, true);

// Steckdose umschalten
await session.ToggleSwitchAsync(ain);

Example output:

Switch 087610251891
 name   = FRITZ!DECT 200 #2
 P [mW] = 3070
 E [Wh] = 17236
 T [°C] = 23.5

Testing

For running the unit tests, create a user in your Fritz!Box with the credentials found in TestCredentials.cs, or modify the credentials to match with an existing user. The user needs Smart Home permissions only.

Then you can run the unit tests in Visual Studio 2017 (Community).

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.