Skip to content

Commit

Permalink
Fix MinMax Data
Browse files Browse the repository at this point in the history
  • Loading branch information
Khole Jones committed Mar 7, 2021
1 parent f00c55d commit 80cebc5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 34 deletions.
6 changes: 0 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,3 @@ repos:
- id: no-commit-to-branch
args:
- --branch=master
- repo: local
hooks:
- id: secretlint
name: Secretlint
language: docker_image
entry: secretlint/secretlint:latest secretlint
39 changes: 12 additions & 27 deletions pyhiveapi/apyhiveapi/heating.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,26 +89,17 @@ async def currentTemperature(self, device):
state = data["props"]["temperature"]

if device["hiveID"] in self.session.data.minMax:
if self.session.data.minMax[device["hiveID"]][
"TodayDate"
] != datetime.date(datetime.now()):
self.session.data.minMax[device["hiveID"]]["TodayMin"] = 1000
self.session.data.minMax[device["hiveID"]]["TodayMax"] = -1000
self.session.data.minMax[device["hiveID"]][
"TodayDate"
] = datetime.date(datetime.now())

if state < self.session.data.minMax[device["hiveID"]]["TodayMin"]:
self.session.data.minMax[device["hiveID"]]["TodayMin"] = state

if state > self.session.data.minMax[device["hiveID"]]["TodayMax"]:
self.session.data.minMax[device["hiveID"]]["TodayMax"] = state

if state < self.session.data.minMax[device["hiveID"]]["RestartMin"]:
self.session.data.minMax[device["hiveID"]]["RestartMin"] = state

if state > self.session.data.minMax[device["hiveID"]]["RestartMax"]:
self.session.data.minMax[device["hiveID"]]["RestartMax"] = state
if state < self.session.data.minMax[device["hiveID"]]["TodayMin"]:
self.session.data.minMax[device["hiveID"]]["TodayMin"] = state

if state > self.session.data.minMax[device["hiveID"]]["TodayMax"]:
self.session.data.minMax[device["hiveID"]]["TodayMax"] = state

if state < self.session.data.minMax[device["hiveID"]]["RestartMin"]:
self.session.data.minMax[device["hiveID"]]["RestartMin"] = state

if state > self.session.data.minMax[device["hiveID"]]["RestartMax"]:
self.session.data.minMax[device["hiveID"]]["RestartMax"] = state
else:
data = {
"TodayMin": state,
Expand All @@ -118,14 +109,8 @@ async def currentTemperature(self, device):
"RestartMax": state,
}
self.session.data.minMax[device["hiveID"]] = data
f_state = round(float(state), 1)
await self.session.log.log(
device["hiveID"],
self.heatingType + "_Extra",
"Current Temp is {0}",
info=[str(state)],
)

f_state = round(float(state), 1)
final = f_state
except KeyError as e:
await self.session.log.error(e)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def requirements_from_file(filename="requirements.txt"):


setup(
version="0.3.9",
version="0.3.10",
package_data={"data": ["*.json"]},
include_package_data=True,
cmdclass={
Expand Down

0 comments on commit 80cebc5

Please sign in to comment.