Skip to content

Commit f878876

Browse files
authored
Merge pull request #45 from cclauss/patch-1
GitHub Action to lint Python code Many thanks Christian for your help in reviewing the code !!
2 parents 41448e9 + 5d54fff commit f878876

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

.github/workflows/lint_python.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: lint_python
2+
on: [pull_request, push]
3+
jobs:
4+
lint_python:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v2
8+
- uses: actions/setup-python@v2
9+
- run: pip install black codespell flake8 isort pytest pyupgrade
10+
- run: black --check . || true
11+
- run: codespell --quiet-level=2 || true # --ignore-words-list="" --skip=""
12+
- run: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
13+
- run: isort --profile black . || true
14+
- run: pip install -r requirements.txt || true
15+
- run: pytest . || true
16+
- run: shopt -s globstar && pyupgrade --py36-plus **/*.py || true

lnetatmo.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def getParameter(key, default):
102102

103103
#TODO# Undocumented (but would be very usefull) API : Access currently forbidden (403)
104104

105-
# _POST_UPDATE_HOME_REQ = _BASE_URL + "/api/updatehome"
105+
_POST_UPDATE_HOME_REQ = _BASE_URL + "/api/updatehome"
106106

107107
# For presence setting (POST BODY):
108108
# _PRES_BODY_REC_SET = "home_id=%s&presence_settings[presence_record_%s]=%s" # (HomeId, DetectionKind, DetectionSetup.index)
@@ -275,7 +275,7 @@ def __init__(self, authData, home=None):
275275
resp = postRequest(_GETTHERMOSTATDATA_REQ, postParams)
276276
self.rawData = resp['body']['devices']
277277
if not self.rawData : raise NoDevice("No thermostat available")
278-
self.thermostatData = filter_home_data(rawData, home)
278+
self.thermostatData = filter_home_data(self.rawData, home)
279279
if not self.thermostatData : raise NoHome("No home %s found" % home)
280280
self.thermostatData['name'] = self.thermostatData['home_name']
281281
for m in self.thermostatData['modules']:
@@ -824,7 +824,7 @@ def getStationMinMaxTH(station=None, module=None, home=None):
824824
r = devList.MinMaxTH(module=m)
825825
result[m] = (r[0], lastD[m]['Temperature'], r[1])
826826
else:
827-
if time.time()-lastD[mname]['When'] > 3600 : result = ["-", "-"]
827+
if time.time()-lastD[module]['When'] > 3600 : result = ["-", "-"]
828828
else :
829829
result = [lastD[module]['Temperature'], lastD[module]['Humidity']]
830830
result.extend(devList.MinMaxTH(module))

0 commit comments

Comments
 (0)