Skip to content

Commit 96944d6

Browse files
committed
refactoring
1 parent 6bc6ad9 commit 96944d6

File tree

6 files changed

+33
-50
lines changed

6 files changed

+33
-50
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ __pycache__
66
*.egg-info
77
build
88
dist
9-
local_test.py
109
venv
10+
.pytest_cache
11+
testing.ipynb

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,6 @@ except FritzAdvancedThermostatError as err:
7979
print(err)
8080
```
8181

82-
## Contribute
82+
## Credits
8383

84-
Contributions are always welcome, just open a PR, specially if you find a way to obtain the thermostat data without selenium!
84+
Thanks to [Argelbargel](https://github.com/Argelbargel) from the openHab community for [showing me a way](https://community.openhab.org/t/groovy-script-rule-to-update-temperature-offsets-of-avm-fritz-dect-301-302-based-on-external-temperature-sensors/139917) to obtain the thermostat data without selenium.

fritz_advanced_thermostat/fritz_advanced_thermostat.py fritz_advanced_thermostat.py

+19-6
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,25 @@
5050
import urllib3
5151
from packaging import version
5252

53-
from .errors import (
54-
FritzAdvancedThermostatCompatibilityError,
55-
FritzAdvancedThermostatConnectionError,
56-
FritzAdvancedThermostatExecutionError,
57-
FritzAdvancedThermostatKeyError,
58-
)
53+
54+
class FritzAdvancedThermostatExecutionError(Exception):
55+
"""Unknown error while executing"""
56+
57+
58+
class FritzAdvancedThermostatCompatibilityError(Exception):
59+
"""Fritz!BOX is not compatible with this module"""
60+
61+
62+
class FritzAdvancedThermostatKeyError(KeyError):
63+
"""Error while obtaining a key from the Fritz!BOX"""
64+
65+
66+
class FritzAdvancedThermostatConnectionError(ConnectionError):
67+
"""Error while connecting to the Fritz!BOX"""
68+
69+
70+
FritzAdvancedThermostatError = (FritzAdvancedThermostatExecutionError, FritzAdvancedThermostatCompatibilityError, FritzAdvancedThermostatKeyError, FritzAdvancedThermostatConnectionError)
71+
5972

6073
# Silence annoying urllib3 Unverified HTTPS warnings, even so if we have checked verify ssl false in requests
6174
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

fritz_advanced_thermostat/__init__.py

-19
This file was deleted.

fritz_advanced_thermostat/errors.py

-13
This file was deleted.

setup.py

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import sys
2+
from os import environ, path
3+
24
from setuptools import setup
3-
from os import path, environ
45

56
setup_file_dir = path.abspath(path.dirname(__file__))
67

@@ -20,23 +21,23 @@
2021

2122
setup(
2223
name="fritz-advanced-thermostat",
23-
version=environ.get('VERSION'),
24+
version=environ.get("VERSION"),
2425
description="A library for setting FRITZ!DECT thermostat values (e.g. offset, holidays, timer), that can't be set via AHA requests.",
2526
long_description=long_description,
26-
long_description_content_type='text/markdown',
27+
long_description_content_type="text/markdown",
2728
url="https://github.com/mietzen/python-fritz-advanced-thermostat",
2829
author="Nils Stein",
2930
author_email="github.nstein@mailbox.org",
3031
license="MIT",
3132
classifiers=[
32-
'Development Status :: 4 - Beta',
33-
'License :: OSI Approved :: MIT License',
34-
'Programming Language :: Python :: 3.9',
35-
'Programming Language :: Python :: 3.10',
36-
'Programming Language :: Python :: 3.11',
33+
"Development Status :: 4 - Beta",
34+
"License :: OSI Approved :: MIT License",
35+
"Programming Language :: Python :: 3.9",
36+
"Programming Language :: Python :: 3.10",
37+
"Programming Language :: Python :: 3.11",
3738
"Operating System :: OS Independent",
3839
],
3940
keywords="fritzbox smarthome avm thermostat",
4041
packages=["fritz_advanced_thermostat"],
41-
install_requires=requirements.split('\n')
42+
install_requires=requirements.split("\n"),
4243
)

0 commit comments

Comments
 (0)