Skip to content

Latest commit

 

History

History
104 lines (70 loc) · 3.37 KB

README.md

File metadata and controls

104 lines (70 loc) · 3.37 KB

NuGet NuGet Build Status license Twitter Follow

General

This section contains various useful projects that should help your development-process.

This section of our GIT repositories is free. You may copy, use or rewrite every single one of its contained projects to your hearts content.
In order to get help with basic GIT commands you may try the GIT cheat-sheet on our homepage.

This repository located on our homepage is private since this is the master- and release-branch. You may clone it, but it will be read-only.
If you want to contribute to our repository (push, open pull requests), please use the copy on github located here: the public github repository

MyStromRestApiCSharp

An implementation of the MyStrom REST API in C#.

If you like this repo, please don't forget to star it. Thank you.

Getting Started

First you device has to be in your LAN. You can achieve that by following the instructions of that device until you are able to use it with the MyStrom App. After that just note the IP-Address (and the Token if you set one) and you can remove it from the MyStromApp again.

Then just import this repository into your application as nuget-package, create your first device and start sending and receiving messages.

Example

[Test]
public void SetColorTest()
{
    var b = new MyStromBulb("Testbulb", "192.168.0.123", "600365A444BA", "93fnafh4o9f8h943rh");
    ToggleResultJson r;
    r = b.SetColor("2050ff80");
    r = b.SetColor("300;100;100", 1000);
    r = b.SetColor("12;100");

    Console.Out.WriteLine();
}
[Test]
public void ToggleTest()
{
    var b = new MyStromBulb("Testbulb", "192.168.0.123", "600365A444BA", "93fnafh4o9f8h943rh");
    ToggleResultJson r;
    r = b.SendToggle();
    r = b.SendToggle();

    Console.Out.WriteLine();
}
[Test]
public void ScannedWifisDetailedTest()
{
    var b = new MyStromSwitch("Testswitch", "192.168.0.124", "93fnafh4o9f8h943rh");

    var r = b.ScanForWifisDetailed();

    Console.Out.WriteLine();
}
[Test]
public void ReceiveDiscoveryTests()
{
    DeviceDiscovery.Start((json) =>
                          Console.Out.WriteLine($"[{json.IpEndPoint}]: {json.MacAddress}-{json.DeviceType}"));

    Thread.Sleep(5000);
    DeviceDiscovery.Stop();
    Thread.Sleep(1000);
}

Attributions

Thx to MyStrom for providing a REST API.

References