Procházet zdrojové kódy

[api] fix variable_valuesand variables (passes test)

Maxime Alves LIRMM@home před 3 roky
rodič
revize
8caf9145df
2 změnil soubory, kde provedl 4 přidání a 4 odebrání
  1. 2
    2
      pyheatpump/variable_values.py
  2. 2
    2
      pyheatpump/variables.py

+ 2
- 2
pyheatpump/variable_values.py Zobrazit soubor

26
 async def get_variable_value(var_type: str, address: int, time: str=None):
26
 async def get_variable_value(var_type: str, address: int, time: str=None):
27
     try:
27
     try:
28
         args = {
28
         args = {
29
-            'type': var_type,
29
+            'var_type': var_type,
30
             'address': address,
30
             'address': address,
31
             'time': time
31
             'time': time
32
         }
32
         }
37
 
37
 
38
         row = VariableValue.get(**args)
38
         row = VariableValue.get(**args)
39
 
39
 
40
-        return PlainTextResponse(str(row.value))
40
+        return PlainTextResponse(str(row.get_value()))
41
     except StopIteration:
41
     except StopIteration:
42
         raise HTTPException(404)
42
         raise HTTPException(404)
43
 
43
 

+ 2
- 2
pyheatpump/variables.py Zobrazit soubor

20
     return JSONResponse({
20
     return JSONResponse({
21
         key: {
21
         key: {
22
             add: wo_type(var.__dict__)
22
             add: wo_type(var.__dict__)
23
-                for add, var in var_type.items()
23
+            for add, var in var_type.items()
24
         } for key, var_type in Variable.getall().items()
24
         } for key, var_type in Variable.getall().items()
25
     })
25
     })
26
 
26
 
47
         return await get_variables(request)
47
         return await get_variables(request)
48
     elif request['method'] == 'POST':
48
     elif request['method'] == 'POST':
49
         return await set_variables(request)
49
         return await set_variables(request)
50
-    raise NotImplementedError;
50
+    raise NotImplementedError
51
 
51
 
52
 
52
 
53
 ROUTES=[
53
 ROUTES=[

Loading…
Zrušit
Uložit