Browse Source

Fixed algorithm /config/last_update

Maxime Alves LIRMM@home 3 years ago
parent
commit
17c1443bfc
1 changed files with 2 additions and 6 deletions
  1. 2
    6
      pyheatpump/config.py

+ 2
- 6
pyheatpump/config.py View File

@@ -158,15 +158,11 @@ async def last_update_route(request, *args, **kwargs):
158 158
     elif request['method'] == 'POST':
159 159
         body = await request.body()
160 160
         last_update = int(body.decode() or 0)
161
-        print(f'Last update set : {last_update}')
162 161
         if last_update == 0:
163
-            print('Reset last update to current time')
162
+            print(f'Reset last update to current time')
164 163
             last_update = int(datetime.now().strftime('%s'))
165
-        elif last_update <= 0:
166
-            print('Forward of {last_update} seconds')
167
-            last_update = int(datetime.now().strftime('%s')) + last_update
168 164
         else:
169
-            print('Rewind of {last_update} seconds')
165
+            print(f'{"Forward" if last_update < 0 else "Rewind"} of {last_update} seconds')
170 166
             last_update = int(datetime.now().strftime('%s')) - last_update
171 167
 
172 168
 

Loading…
Cancel
Save