Skip to content

Commit

Permalink
SmartHome with FritzBox and nodejs
Browse files Browse the repository at this point in the history
SmartHome Lib for FritzBox and nodeJS
  • Loading branch information
nischelwitzer committed Jul 29, 2014
1 parent 6252b94 commit 2b5ed42
Show file tree
Hide file tree
Showing 4 changed files with 555 additions and 0 deletions.
20 changes: 20 additions & 0 deletions LICENSE
@@ -0,0 +1,20 @@
The MIT License (MIT)

Copyright (c) 2013 Rasix & 2014 Nischi

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
125 changes: 125 additions & 0 deletions README.md
@@ -0,0 +1,125 @@
# smartfritz

Node module to communicate with a AVM FritzBox and FRITZ!DECT 200 (smart home hardware) providing the following functions:

- Get the session ID (getSessionID)
- Get the switch (FRITZ!DECT 200) State (getSwitchState)
- Set the switch (FRITZ!DECT 200) ON (setSwitchOn)
- Set the switch (FRITZ!DECT 200) OFF (setSwitchOff)
- Get the switch (FRITZ!DECT 200) Power (getSwitchPower)
- Get the switch (FRITZ!DECT 200) Energy (getSwitchEnergy)
- Get the switch (FRITZ!DECT 200) List (getSwitchList)
- Get the phone list (getPhoneList)
- Set the guest wlan (setGuestWLan)
- Get the guest wlan settings (getGuestWLan)

correction of package.json with main for "out of the box" function.

For AVM FRITZ!DECT 200 control you need to know your Actuator identification number (AIN)

## Install

```bash
npm install smartfritz
```

## How to use

Get the session ID:
```js
var fritz = require('smartfritz');

fritz.getSessionID("user", "password", function(sid){
console.log(sid);
});
```

Get the switch Power (FRITZ!DECT 200):
```js
var fritz = require('smartfritz');

fritz.getSwitchPower(sid, aid, function(sid){
console.log(sid);
});
```

Get the switch Energy (FRITZ!DECT 200):
```js
var fritz = require('smartfritz');

fritz.getSwitchEnergy(sid, aid, function(sid){
console.log(sid);
});
```

Get the switch State (DECT200):
```js
var fritz = require('smartfritz');

fritz.getSwitchState(sid, aid, function(sid){
console.log(sid);
});
```

Set the switch State ON (DECT200):
```js
var fritz = require('smartfritz');

fritz.setSwitchOn(sid, aid, function(sid){
console.log(sid);
});
```

Set the switch State OFF (DECT200):
```js
var fritz = require('smartfritz');

fritz.setSwitchOff(sid, aid, function(sid){
console.log(sid);
});
```

Get the phone list:
```js
var fritz = require('smartfritz');

fritz.getPhoneList(sid,function(calls){
console.log(calls);
});

```

Enable or disable guest wlan:
```js
var fritz = require('smartfritz');

fritz.setGuestWLan(sid, true, function(enabled){
console.log("Guest WLan Enabled: "+enabled);
});
```

Get guest wlan settings:
```js
var fritz = require('smartfritz');

fritz.getGuestWLan(sid, function(settings){
console.log(settings);
});
```

## AHA-HTTP Interface

AHA - Avm Home Interface

https://fritz.box/webservices/homeautoswitch.lua?ain=<ain>&switchcmd=<cmd>&sid=<sid>

AHA-HTTP-Interface document
http://avm.de/fileadmin/user_upload/Global/Service/Schnittstellen/AHA-HTTP-Interface.pdf

## Thanks to and based on Code from:

steffen.timm for the basic communication function
thk4711 for the FRITZ!DECT 200
AVM for providing the good AHA-HTTP-Interface document


0 comments on commit 2b5ed42

Please sign in to comment.