Compatibility
- v0.5.0 and master5.35.25.15.04.2
- v0.5.0 and masteriOSmacOS(Intel)macOS(ARM)LinuxtvOSwatchOS
Swift SDK to communicate with Fritz!Box routers.
This aims to be a Framework that provides a clean and modern Swift API for communicating with Fritz!Box routers. The focus is on home automation features.
Create an instance of the SDK with your myfritz URL and user credentials.
let fritzBox = FritzBox(
host: "https://YOURID.myfritz.net:46048",
user: "foo",
password: "bar"
)
Get a session identifier by calling the login
method. This will be used for all further requests.
fritzBox.login { result in
if case .success(let info) = result {
print("Info: \(String(describing: info))")
// We are now ready to do further requests.
}
}
You can now get information about devices and then act on them.
fritzBox.getDevices(completion: { result in
if case .success(let devices) = result {
print("Devices: \(String(describing: devices))")
// Prints a list of devices and their properties.
}
})
As I only have one home, this was only tested with the following setup.
When using Swift Package Manager add this:
.package(url: "https://github.com/r-dent/FritzBoxKit.git", from: "0.5.0")
If you´re using CocoaPods, add this to your Podfile:
pod 'FritzBox-Kit'