Browse Source

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

Maxime Alves LIRMM@home 3 years ago
parent
commit
acecf97582
2 changed files with 10 additions and 3 deletions
  1. 1
    1
      pyheatpump/cli.py
  2. 9
    2
      pyheatpump/models/heatpump.py

+ 1
- 1
pyheatpump/cli.py View File

@@ -172,7 +172,7 @@ def supervise(since):
172 172
     else:
173 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 177
     base_url = {
178 178
         'scheme':config.get('supervisor', 'scheme'),

+ 9
- 2
pyheatpump/models/heatpump.py View File

@@ -14,10 +14,17 @@ class Heatpump:
14 14
     var_types: Dict
15 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 18
         self.mac_address = mac_address
19 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 29
     def __str__(self):
23 30
         return str(self.__dict__())

Loading…
Cancel
Save