Skip to content

RolandoMagico/HomeAutomation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HomeAutomation

Just another example how to access Fritz Box services

Example: Reading all DECT devices

FritzBox fritzBox = new FritzBox { Username = "YourUsername", Password = "Yourpassword", Hostname = "fritz.box" };
fritzBox.Connect();
X_AVM_DE_Dect dect = new X_AVM_DE_Dect { FritzBox = fritzBox };
ushort numberOfDectEntries = dect.GetNumberOfDectEntries();
for (ushort i = 0; i < numberOfDectEntries; i++)
{
  var result = dect.GetGenericDectEntry(i);
  Log.Info($"DECT device index {i}");
  Log.Info($"Model: {result.NewModel}");
  Log.Info($"Model: {result.NewName}");
}

Example: Switching on a Fritz!Dect 200 device

FritzBox fritzBox = new FritzBox { Username = "YourUsername", Password = "Yourpassword", Hostname = "fritz.box" };
fritzBox.Connect();
X_AVM_DE_Dect dect = new X_AVM_DE_Dect { FritzBox = fritzBox };
ushort numberOfDectEntries = dect.GetNumberOfDectEntries();
for (ushort i = 0; i < numberOfDectEntries; i++)
{
  var genericResult = dect.GetGenericDectEntry(i);
  if (genericResult.NewName == "Wohnzimmer")
  {
    X_AVM_DE_Homeauto homeAuto = new X_AVM_DE_Homeauto { FritzBox = fritzBox };
    var result = homeAuto.GetGenericDeviceInfos(i);
    homeAuto.SetSwitch(result.NewAIN, "ON");
  }
}

Releases

No releases published

Packages

No packages published

Languages