Skip to content

Commit

Permalink
move fmt to class
Browse files Browse the repository at this point in the history
Signed-off-by: Frank Villaro-Dixon <[email protected]>
  • Loading branch information
Frankkkkk committed Oct 29, 2023
1 parent f7359ef commit 0fdac8a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
build/
dist/
*.egg-info
apk/
3 changes: 2 additions & 1 deletion daikin_altherma/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class DaikinAltherma:
UserAgent = "python-daikin-altherma"
DAYS = ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"]
_heating_value_parser = lambda x: float(x)/10
DATETIME_FMT = "%Y%m%dT%H%M%SZ"

def __init__(self, adapter_ip: str):
self.adapter_ip = adapter_ip
Expand Down Expand Up @@ -115,7 +116,7 @@ def adapter_model(self) -> str:
def unit_datetime(self) -> datetime.datetime:
"""Returns the current date of the unit. Takes time to refresh"""
d = self._requestValueHP("0/DateTime/la", "/m2m:rsp/pc/m2m:cin/con")
return datetime.datetime.strptime(d, "%Y%m%dT%H%M%SZ")
return datetime.datetime.strptime(d, self.DATETIME_FMT)

@property
def unit_model(self) -> str:
Expand Down
22 changes: 21 additions & 1 deletion example.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,27 @@
import datetime
import time
from daikin_altherma import DaikinAltherma
d = DaikinAltherma('192.168.11.100')

d.print_all_status()
now = datetime.datetime.utcnow() - datetime.timedelta(minutes=30)
d.set_unit_datetime(now)

while True:
dat = d.unit_datetime
now = datetime.datetime.utcnow()
print(f'NOW: {now}\nDAI: {dat}')
print(abs(datetime.datetime.utcnow() - dat))
time.sleep(1)

#print(f'BEF: {d.unit_datetime}')
#d.set_unit_datetime(now)
#print(f'AFT: {d.unit_datetime}')
#print(d.tank_schedule_state)
#print(d.heating_schedule_state)
#print(d.tank_schedule)

#d.print_all_status()
1/0

_present_day_schedule = {
'0000': 17,
Expand Down

0 comments on commit 0fdac8a

Please sign in to comment.