Explorar el Código

[heatpump] add argument to filter by variable type , (debug) only send analog variables to servers

Maxime Alves LIRMM@home hace 4 años
padre
commit
acecf97582
Se han modificado 2 ficheros con 10 adiciones y 3 borrados
  1. 1
    1
      pyheatpump/cli.py
  2. 9
    2
      pyheatpump/models/heatpump.py

+ 1
- 1
pyheatpump/cli.py Ver fichero

172
     else:
172
     else:
173
         last_update = get_last_update()
173
         last_update = get_last_update()
174
 
174
 
175
-    h = Heatpump(mac_address, last_update)
175
+    h = Heatpump(mac_address, last_update, ['Analog'])
176
 
176
 
177
     base_url = {
177
     base_url = {
178
         'scheme':config.get('supervisor', 'scheme'),
178
         'scheme':config.get('supervisor', 'scheme'),

+ 9
- 2
pyheatpump/models/heatpump.py Ver fichero

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):
17
+    def __init__(self, mac_address, last_update, 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
-        self.var_types = VariableType.getall()
20
+        if len(types):
21
+            self.var_types = {
22
+                key: val
23
+                for key,val in VariableType.getall().items()
24
+                if key in types
25
+            }
26
+        else:
27
+            self.var_types = VariableType.getall()
21
 
28
 
22
     def __str__(self):
29
     def __str__(self):
23
         return str(self.__dict__())
30
         return str(self.__dict__())

Loading…
Cancelar
Guardar