fritz-box
Promise-based JavaScript FRITZ!Box API.
Examples
Basic
const box = host: 'fritz.box' password: '...' username: '...' const run = async { await box const settings = await box settingsactive = true settingsssid = 'Example!' await box console}
IFTTT Notify
This will activate the guest WLAN and emit a IFTTT Maker channel notify event. If you create the fitting IFTTT recipe, this snippet should send you the WLAN password right to your smartphone.
const box = host: 'fritz.box' password: '...' username: '...'const maker = 'IFTTT_MAKER_TOKEN' const run = async { // generate a random 8-digit hex password const newPassword = crypto; // sign-in await box // get current guest WLAN settings const settings = await box // set new password & turn on guest WLAN settingskey = newPassword settingsactive = true await box // send a message to IFTTT (optional) maker}
Installation
yarn add fritz-box
or
npm i fritz-box
API
<>
default class FritzBox: Object: FritzBox
Creates a new FritzBox with the given parameters.
const box = host: 'fritz.box' password: '...' username: '...';
box.getSession
Attempts to log in and fetches a session ID.
;async { const box = /* ... */ await box // fritz-box is now ready for use}
box.getGuestWLAN
Fetches the guest WLAN configuration from the FRITZ!Box.
;async { const box = /* ... */ await box const settings = await box}
box.setGuestWLAN
Applies the (modified) settings
object.
;async { const box = /* ... */ await box await box}
box.overview
Returns the data contained in the overview tab of the FRITZ!Box user interface.
;async { const box = /* ... */ await box console}
box.getDeviceDetails
Gathers more information about a specific device.
;async { const box = /* ... */ await box console}
box.getLog
type = 'all' : String: Promise
Returns log entries. Supported types: 'all'
, 'system'
, 'internet'
, 'wlan'
, 'usb'
.
;async { const box = /* ... */ await box console}
Disclaimer
Tested in FRITZ!OS 6.92 on a FRITZ!Box 7590.
FRITZ!Box and FRITZ!OS are registered trademarks of AVM. This project does not grant you any permissions to use them.
History
-
1.2.0
- add
getLog
- improve documentation
- add
-
1.1.0
- directly throw errors
- add
getDeviceDetails