Skip to content

Commit

Permalink
Hotfix-Release 0.7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
gasperphoenix committed Apr 3, 2021
2 parents 6dca290 + f203cbb commit f80c251
Show file tree
Hide file tree
Showing 17 changed files with 1,070 additions and 3 deletions.
16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/release-template.md
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"
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ __pycache__/
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
Expand Down Expand Up @@ -102,3 +101,6 @@ venv.bak/

# mypy
.mypy_cache/
/.project
/.pydevproject
/.DS_Store
1 change: 1 addition & 0 deletions .settings/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/org.eclipse.core.resources.prefs
67 changes: 65 additions & 2 deletions README.md
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
```
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
theme: jekyll-theme-architect
2 changes: 2 additions & 0 deletions create_dist.sh
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 added dist/fritzbox-0.7.1.tar.gz
Binary file not shown.
Binary file added dist/fritzbox-0.7.1.zip
Binary file not shown.
1 change: 1 addition & 0 deletions doc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.DS_Store
Binary file added doc/AHA-HTTP-Interface.pdf
Binary file not shown.
83 changes: 83 additions & 0 deletions execute_unit_test.sh
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"
Loading

0 comments on commit f80c251

Please sign in to comment.