-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
1,070 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
name: Release template | ||
about: Checklist to perform a release | ||
title: Release ... | ||
labels: '' | ||
assignees: '' | ||
|
||
--- | ||
|
||
## Release preparation | ||
- [ ] Create distribution files | ||
|
||
## Release testing | ||
- [ ] Execute module tests | ||
- [ ] Execute module "FBPresence.py" | ||
- [ ] Execute module "FBHomeAuto.py" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/org.eclipse.core.resources.prefs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,65 @@ | ||
# FritzBox | ||
Collection of modules for interaction with an AVM FritzBox | ||
## Welcome to the FritzBox project | ||
|
||
This project is derived from my former project [FritzBoxPresenceDetection](https://github.com/gasperphoenix/FritzBoxPresenceDetection) which provided the functionality to connect to an AVM FritzBox to check the presence of WLAN devices. While adding more features and the ability to interact with the FritzBox Home Automation actors (like switch plugs) using HTTP requests I decided to setup a complete new project with a new structure that encapsules the features for presence detection and home automation in separate modules. Furthermore I moved all the FritzBox communication related methods like authentication and lua-page loading to a new core module. | ||
|
||
## Package structure | ||
|
||
### FBCore | ||
This module provides the class *FBCore* that encapsules all methods for communication with the FritzBox like authentication and loading of lua-pages. | ||
|
||
### FBPresence | ||
This module provides the class *FBPresence* that encapsules all methods for determination of the WLAN device connection status on the FritzBox. | ||
|
||
### FBHomeAuto | ||
This module provides the class *FBHomeAuto* that encapsules all methods for interacting with the AVM home automation actors connected to a FritzBox. | ||
|
||
## Using the distribution files | ||
First you need to download a source distribution file from the *dist* subfolder. | ||
|
||
Afterwards you can easily install it on your environment by invoking the following command. As the package name may differ, please adapt it before executing the command. | ||
```bash | ||
pip3 install fritzbox-0.1.tar.gz | ||
``` | ||
|
||
Once successfully installed you can use the package inside your scripts. Please find an example below. | ||
```python | ||
from fritzbox.FBHomeAuto import FBHomeAuto | ||
|
||
fbHA = FBHomeAuto(ip="192.168.0.1", password="pass1234") | ||
|
||
print(fbHA.getSwitchPlugs()) | ||
``` | ||
|
||
## Create source distribution | ||
First you need to install all required dependencies. | ||
``` | ||
pip3 install setuptools | ||
``` | ||
|
||
Before creating the source distribution make sure to adapt the following attributes in the file setup.py to your needs. | ||
``` | ||
name = "fritzbox", | ||
version = "0.2", | ||
``` | ||
|
||
To create the source distribution go to the root folder of the archive and execute the following command | ||
``` | ||
sh create_dist.sh | ||
``` | ||
|
||
This creates a source distribution in both *.zip* and *.tar.gz* format in the subfolder *dist* with the following naming using above attributes: | ||
``` | ||
<name>-<version>.zip | ||
<name>-<version>.tar.gz | ||
``` | ||
|
||
## Execute module tests | ||
First you need to install all required dependencies. | ||
``` | ||
pip3 install openpyxl pytest pytest-cov | ||
``` | ||
|
||
A shell script module has been added to execute all included module tests. To execute the module tests execute the following command in the root folder of the source code: | ||
``` | ||
sh execute_unit_test.sh | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
theme: jekyll-theme-architect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
python3 src/fritzbox/setup.py sdist --formats=zip,gztar | ||
rm -rf src/fritzbox.egg-info |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/.DS_Store |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#!/bin/bash | ||
|
||
#Short description... | ||
|
||
#This module is used to execute the unit tests for this project | ||
|
||
#__author__ = "Dennis Jung" | ||
#__copyright__ = "Copyright 2019, Dennis Jung" | ||
#__credits__ = ["Dennis Jung"] | ||
#__license__ = "GPL Version 3" | ||
#__maintainer__ = "Dennis Jung" | ||
#__email__ = "[email protected]" | ||
|
||
|
||
#=============================================================================== | ||
# Constant declaration | ||
#=============================================================================== | ||
# SHELL_COLORS | ||
FORMAT_RED_NORMAL="\033[31;1m" | ||
FORMAT_BLUE_NORMAL="\033[34;1m" | ||
FORMAT_YELLOW_NORMAL="\033[33;1m" | ||
FORMAT_GREEN_NORMAL="\033[32;1m" | ||
|
||
FORMAT_DEFAULT="\033[0m" | ||
|
||
|
||
#=============================================================================== | ||
# Determine system type | ||
#=============================================================================== | ||
unameOut="$(uname -s)" | ||
|
||
case "${unameOut}" in | ||
Linux*) machine=Linux;; | ||
Darwin*) machine=Mac;; | ||
CYGWIN*) machine=Cygwin;; | ||
MINGW*) machine=MinGw;; | ||
*) machine="UNKNOWN:${unameOut}" | ||
esac | ||
|
||
|
||
#=============================================================================== | ||
# Adapt system commands to machine type | ||
#=============================================================================== | ||
case "${unameOut}" in | ||
Linux*) ESCAPED_ECHO=$(echo -e);; | ||
Mac*) ESCAPED_ECHO=$(echo);; | ||
esac | ||
|
||
|
||
#=============================================================================== | ||
# Function definitions | ||
#=============================================================================== | ||
# This functions writes a log message on the shell using | ||
# the following parameters | ||
# | ||
# log_message (color, tag, message) | ||
# color: Color from the list SHELL_COLORS | ||
# tag: Will be written in braces in front of the log message; | ||
# provided in quotes | ||
# message: Message to be written on the shell; provided in quotes | ||
log_message () { | ||
color=$1 | ||
tag=$2 | ||
message=$3 | ||
|
||
echo $ESCAPED_ECHO "[$color$tag$FORMAT_DEFAULT] $message" | ||
} | ||
|
||
|
||
#=============================================================================== | ||
# Start of script | ||
#=============================================================================== | ||
# Clear the shell screen | ||
clear | ||
|
||
# Write initial log message | ||
log_message $FORMAT_YELLOW_NORMAL "info" "Start execution of: $0" | ||
|
||
log_message $FORMAT_GREEN_NORMAL "info" "Start unit tests" | ||
|
||
py.test -v --cov-report term-missing --cov FBPresence | ||
|
||
log_message $FORMAT_GREEN_NORMAL "info" "Finalize unit tests" |
Oops, something went wrong.