Skip to content

Commit

Permalink
daily timer rules added
Browse files Browse the repository at this point in the history
see timer.txt
  • Loading branch information
E-t0m committed Apr 5, 2024
1 parent f265ed0 commit 8c2359e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions zeroinput.py
Expand Up @@ -114,19 +114,21 @@ def avg(inlist): # return the average of a list variable

class discharge_times():
def __init__(self):
self.interval = 60 # seconds
self.stamp = datetime.now() - timedelta(seconds = self.interval)
self.interval = 60 # seconds
self.stamp = datetime.now() - timedelta(seconds = self.interval)
self.active = False
self.discharge = True
self.update()

def update(self):
if self.stamp + timedelta(seconds = self.interval) < datetime.now():
self.stamp = datetime.now()
self.stamp = datetime.now()
times = []; states = []
try:
with open(discharge_t_file,'r') as fi:
for i in fi:
if i == '\n': continue # ignore empty lines
if i[:10] == '0000-00-00': i = datetime.now().strftime('%Y-%m-%d') + i[10:] # set to today
times.append(datetime.strptime(i[:19], '%Y-%m-%d %H:%M:%S'))
states.append(str(i[19:]))

Expand Down

0 comments on commit 8c2359e

Please sign in to comment.