# fritzbox

> Fritzbox - UPnP/IGD for node.js

Latest version **1.1.4** (published 2023-11-07) · Apache License license · 0 weekly downloads

## Install

```sh
npm install fritzbox
pnpm add fritzbox
yarn add fritzbox
bun add fritzbox
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.4 |
| Published | 2023-11-07 |
| First published | 2016-10-10 |
| Weekly downloads | 0 |
| License | Apache License |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10 |
| Dependencies | 4 |
| Unpacked size | 30 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 8 |
| Author | Jochen Scheib |
| Maintainers | mapero |
| Keywords | TR-064, UPnP, IGD, Fritz.Box, Router |

## Links

- npm: https://www.npmjs.com/package/fritzbox
- Repository: https://github.com/mapero/Fritzbox
- Homepage: https://github.com/mapero/Fritzbox#readme
- Issues: https://github.com/mapero/Fritzbox/issues
- npm.io page: https://npm.io/package/fritzbox

## Dependencies (4)

- [xml2js](https://npm.io/package/xml2js.md) >=0.4.0
- [request](https://npm.io/package/request.md) >=2.30
- [underscore](https://npm.io/package/underscore.md) ^1.8.3
- [xmlbuilder](https://npm.io/package/xmlbuilder.md) ^15.1.1

## Alternatives

- [express-promise-router](https://npm.io/package/express-promise-router.md) — 736.1K weekly downloads
- [next-usequerystate](https://npm.io/package/next-usequerystate.md) — 29.8K weekly downloads
- [@bitkyc08/opencodex](https://npm.io/package/@bitkyc08/opencodex.md) — 4.6K weekly downloads
- [lynkr](https://npm.io/package/lynkr.md) — 575 weekly downloads
- [baremetal.js](https://npm.io/package/baremetal.js.md) — 42 weekly downloads

## Recent versions

- 1.1.4 (latest) — 2023-11-07
- 1.1.3 — 2023-11-06
- 1.1.2 — 2023-10-09
- 1.1.1 — 2023-10-08
- 1.0.0 — 2016-10-10

## README

Fritz!Box (fritzbox)
======

## Description

A library to connect to the TR-064 and UPnP API of an AVM Fritz!Box and to interact with it.

This library is capable of:
* Supports the UPnP and TR-064 specification of the Fritz!Box
* Call actions of services
* Authentication with username/password on http authentication level
* SSL encryption with custom port settings
* Using promises instead of callbacks
* Subscribe to Events with included EventServer (not working at the moment)

More info about capabilities provided by the TR-064 specification: http://www.avm.de/de/Extern/files/tr-064/AVM_TR-064_first_steps.pdf

## Special thanks

This library is a complete rework of the tr-064 library from [Hendrik Westerberg](https://github.com/hendrikw01). Thanks for the initial work.

## Install

<pre>
  npm install tr-064
</pre>

## It is simple

Connect to the device and read a Service.

```javascript
var Fritzbox = require('fritzbox');
var options = {
  host: 'fritz.box',
  port: 49000,
  ssl: false,
  user: 'username',
  password: 'password'
}

var fritzbox = new Fritzbox(options);

fritzbox.initTR064Device().then(function(){
    console.log('Successfully initialized device');
    var wanip = fritzbox.services["urn:dslforum-org:service:WANIPConnection:1"];
    return wanip.actions.GetInfo();
  }).then(function(result) {
    console.log(result);
  }).catch(function(error) {
    console.log(error);
  });
```

## List All Services and Variables

Get the info from both protocols.

```javascript
var Fritzbox = require("./lib/Fritzbox");
var Promise = require("bluebird");

var options = {
  host: 'fritz.box',
  port: 49000,
  ssl: false,
  user: 'username',
  password: 'password'
}

var fritzbox = new Fritzbox.Fritzbox(options);

//Initialize Device
Promise.all([fritzbox.initTR064Device(), fritzbox.initIGDDevice()])
//Print information about available services
  .then(function() {
    for (var serviceName in box.services) {
      console.log("=== "+serviceName+" ===");
      for (var actionName in box.services[serviceName].actionsInfo) {
        console.log("   # " + actionName + "()");
        box.services[serviceName].actionsInfo[actionName].inArgs.forEach(function(arg) {
          console.log("     IN : " + arg);
        });
        box.services[serviceName].actionsInfo[actionName].outArgs.forEach(function(arg) {
          console.log("     OUT : " + arg);
        });
      }
    }
  })
```

## Methods

### fritzbox.initTR064Device()

Initialize the TR - 064 UPnP controller and adds the TR-064 services to the services array.

Returns
* `Promise`

### fritzbox.initIGDDevice()

Initialize the TR - 064 IGD controller and adds the IGD services to the services array.

Returns
* `Promise`

---
_Source: https://npm.io/package/fritzbox · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
