Projet de remplacement du "RPiPasserelle" d'Otec.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

heatpump.py 556B

1234567891011121314151617181920212223
  1. #!/usr/bin/env python3
  2. from modbus.client.serial import rtu
  3. from starlette.routing import Router
  4. from starlette.responses import JSONResponse
  5. from conf import config
  6. from db.db import sql
  7. from pyheatpump.models import *
  8. def get_variable_values(request):
  9. res = {}
  10. for var_type_id, var_type in VariableType.getall():
  11. res[var_type_id] = {}
  12. for address, value in var_type.get_variables_values():
  13. res[address] = value
  14. return JSONResponse(res)
  15. heatpump = [
  16. Route('/', get_all_variable_values, methods=['GET'])
  17. ]