frtz-core

0.2.0 • Public • Published


Access your FRITZ!Box configuration from Node.js, used in vaaski/frtz.

Usage

const { auth, network } = require("frtz")
 
!(async () => {
  const { SID } = await auth.login({ password: "mypassword" })
  const { passive } = await network.getDevices({ SID })
 
  const woke = await network.wake({ UID: passive[0], SID })
})()

Functions

frtz.auth.getNewSession(options)Promise.<Session>

get a new challenge token

frtz.auth.getLoginToken(options)string

get a login token (challenge + password)

frtz.auth.getSession(options)Promise.<Session>

get session with username and loginToken, expires in 20 minutes unless used

frtz.auth.checkAuth(options)Promise.<boolean>

this makes a request to the region & language page, which seems to be the fastest in terms of response time (~650ms)

frtz.auth.login(options)Promise.<session>

Takes password and optionally username and host and returns a logged in session object

frtz.network.getDevices(options)Promise.<Object>

Get a list of devices

frtz.network.wake(options)Promise.<boolean>

Wake a device from sleep (Wake On Lan)

Typedefs

Session : Object

A session object

frtz.auth.getNewSession(options) ⇒ Promise.<Session>

get a new challenge token

Kind: global function

Param Type
options Object
options.host string

frtz.auth.getLoginToken(options) ⇒ string

get a login token (challenge + password)

Kind: global function
Returns: string - solved challenge

Param Type
options Object
options.password string
option.challenge string

frtz.auth.getSession(options) ⇒ Promise.<Session>

get session with username and loginToken, expires in 20 minutes unless used

Kind: global function

Param Type
options Object
options.loginToken string
options.host string
options.username string

frtz.auth.checkAuth(options) ⇒ Promise.<boolean>

this makes a request to the region & language page, which seems to be the fastest in terms of response time (~650ms)

Kind: global function

Param Type Default
options Object
options.SID string
[options.host] string "https://fritz.box"

frtz.auth.login(options) ⇒ Promise.<session>

Takes password and optionally username and host and returns a logged in session object

Kind: global function
Returns: Promise.<session> - session object

Param Type Default
options object
options.password string
[options.username] string
[options.host] string "https://fritz.box"

frtz.network.getDevices(options) ⇒ Promise.<Object>

Get a list of devices

Kind: global function
Returns: Promise.<Object> - data object containing both online and offline devices

Param Type Default Description
options Object
options.SID string session ID
[options.host] string "https://fritz.box"

frtz.network.wake(options) ⇒ Promise.<boolean>

Wake a device from sleep (Wake On Lan)

Kind: global function

Param Type Default Description
options Object
options.SID string session ID
options.UID string unit ID (device ID)
[options.host] string "https://fritz.box"

Session : Object

A session object

Kind: global typedef
Properties

Name Type
SID string
Challenge string
BlockTime string
[expires] number
[Rights] Object
[Rights.Name] Array.<string>
[Rights.Access] Array.<string>

Readme

Keywords

Package Sidebar

Install

npm i frtz-core

Weekly Downloads

0

Version

0.2.0

License

MIT

Unpacked Size

14.3 kB

Total Files

8

Last publish

Collaborators

  • vaaski