23 行
556 B
Python
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'])
|
|
]
|
|
|