Ver código fonte

[heatpump] add default value for last_update

Maxime Alves LIRMM@home 3 anos atrás
pai
commit
472937a09f
2 arquivos alterados com 3 adições e 3 exclusões
  1. 2
    2
      pyheatpump/cli.py
  2. 1
    1
      pyheatpump/models/heatpump.py

+ 2
- 2
pyheatpump/cli.py Ver arquivo

227
 
227
 
228
     get_path = '/'.join((
228
     get_path = '/'.join((
229
         config.get('supervisor', 'get_path'),
229
         config.get('supervisor', 'get_path'),
230
-        Heatpump(mac_address, 0).macformat
230
+        Heatpump(mac_address).macformat
231
     ))
231
     ))
232
     get_url = {
232
     get_url = {
233
         **base_url,
233
         **base_url,
240
     )
240
     )
241
 
241
 
242
     control_data = get_resp.json()
242
     control_data = get_resp.json()
243
-    if Heatpump(mac_addres, 0).control(control_data):
243
+    if Heatpump(mac_addres).control(control_data):
244
         logger.info('GET to supervisor succeded : updated values')
244
         logger.info('GET to supervisor succeded : updated values')
245
         set_last_update(int(datetime.now().strftime('%s')))
245
         set_last_update(int(datetime.now().strftime('%s')))
246
     else:
246
     else:

+ 1
- 1
pyheatpump/models/heatpump.py Ver arquivo

14
     var_types: Dict
14
     var_types: Dict
15
     last_update: int = None
15
     last_update: int = None
16
 
16
 
17
-    def __init__(self, mac_address, last_update, types=[]):
17
+    def __init__(self, mac_address, last_update=0, types=[]):
18
         self.mac_address = mac_address
18
         self.mac_address = mac_address
19
         self.last_update = last_update
19
         self.last_update = last_update
20
         if len(types):
20
         if len(types):

Carregando…
Cancelar
Salvar