pyHeatpump/pyheatpump/heatpump.py
Maxime Alves LIRMM@home 30c1b66c41 [routes] update routes
2020-07-31 22:51:55 +02:00

23 行
556 B
Python

#!/usr/bin/env python3
from modbus.client.serial import rtu
from starlette.routing import Router
from starlette.responses import JSONResponse
from conf import config
from db.db import sql
from pyheatpump.models import *
def get_variable_values(request):
res = {}
for var_type_id, var_type in VariableType.getall():
res[var_type_id] = {}
for address, value in var_type.get_variables_values():
res[address] = value
return JSONResponse(res)
heatpump = [
Route('/', get_all_variable_values, methods=['GET'])
]