[2020-09-24 13:22:24,830][ERROR][uvicorn.error][run_asgi](l.393) Exception in ASGI application
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/uvicorn/protocols/http/httptools_impl.py", line 390, in run_asgi
result = await app(self.scope, self.receive, self.send)
File "/usr/local/lib/python3.7/dist-packages/uvicorn/middleware/proxy_headers.py", line 45, in __call__
return await self.app(scope, receive, send)
File "/usr/local/lib/python3.7/dist-packages/starlette/routing.py", line 566, in __call__
await route.handle(scope, receive, send)
File "/usr/local/lib/python3.7/dist-packages/starlette/routing.py", line 376, in handle
await self.app(scope, receive, send)
File "/usr/local/lib/python3.7/dist-packages/starlette/routing.py", line 566, in __call__
await route.handle(scope, receive, send)
File "/usr/local/lib/python3.7/dist-packages/starlette/routing.py", line 227, in handle
await self.app(scope, receive, send)
File "/usr/local/lib/python3.7/dist-packages/starlette/routing.py", line 43, in app
response = await run_in_threadpool(func, request)
File "/usr/local/lib/python3.7/dist-packages/starlette/concurrency.py", line 34, in run_in_threadpool
return await loop.run_in_executor(None, func, *args)
File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.7/dist-packages/pyheatpump/heatpump.py", line 17, in get_variable_values
return JSONResponse(h.__dict__())
File "/usr/local/lib/python3.7/dist-packages/pyheatpump/models/heatpump.py", line 28, in __dict__
return { **r, **self.get_var_values() }
File "/usr/local/lib/python3.7/dist-packages/pyheatpump/models/heatpump.py", line 38, in get_var_values
r[label] = var_type.get_variables_values()
File "/usr/local/lib/python3.7/dist-packages/pyheatpump/models/variable_type.py", line 59, in get_variables_values
return Variable.getall_values_of_type(self)
File "/usr/local/lib/python3.7/dist-packages/pyheatpump/models/variable.py", line 69, in getall_values_of_type
return Variable.getall_values_of_type_since(type, 0)
File "/usr/local/lib/python3.7/dist-packages/pyheatpump/models/variable.py", line 92, in getall_values_of_type_since
type.__dict__)
File "/usr/local/lib/python3.7/dist-packages/pyheatpump/models/variable.py", line 80, in <dictcomp>
for row in DB.sql(
File "/usr/local/lib/python3.7/dist-packages/pyheatpump/models/variable.py", line 74, in <lambda>
floatcast = lambda x: round(float(x) / 10, 2)
TypeError: float() argument must be a string or a number, not 'NoneType'
SELECT * FROM var_type
{}
SELECT var.address as address, val.value
FROM variable var
LEFT JOIN var_value val ON
var.type = val.type
AND var.address = val.address
AND var.last_update = val.time
WHERE
var.type = :slabel
AND var.address >= :start_address
AND var.address <= :end_address
AND var.last_update > :since
{'slabel': 'A', 'label': 'Analog', 'type': 'float', 'start_address': 1, 'end_address': 5000, 'since': 0}
INFO: 127.0.0.1:59930 - "GET /heatpump/ HTTP/1.1" 500 Internal Server Error
```
[2020-09-24 13:22:24,830][ERROR][uvicorn.error][run_asgi](l.393) Exception in ASGI application
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/uvicorn/protocols/http/httptools_impl.py", line 390, in run_asgi
result = await app(self.scope, self.receive, self.send)
File "/usr/local/lib/python3.7/dist-packages/uvicorn/middleware/proxy_headers.py", line 45, in __call__
return await self.app(scope, receive, send)
File "/usr/local/lib/python3.7/dist-packages/starlette/routing.py", line 566, in __call__
await route.handle(scope, receive, send)
File "/usr/local/lib/python3.7/dist-packages/starlette/routing.py", line 376, in handle
await self.app(scope, receive, send)
File "/usr/local/lib/python3.7/dist-packages/starlette/routing.py", line 566, in __call__
await route.handle(scope, receive, send)
File "/usr/local/lib/python3.7/dist-packages/starlette/routing.py", line 227, in handle
await self.app(scope, receive, send)
File "/usr/local/lib/python3.7/dist-packages/starlette/routing.py", line 43, in app
response = await run_in_threadpool(func, request)
File "/usr/local/lib/python3.7/dist-packages/starlette/concurrency.py", line 34, in run_in_threadpool
return await loop.run_in_executor(None, func, *args)
File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.7/dist-packages/pyheatpump/heatpump.py", line 17, in get_variable_values
return JSONResponse(h.__dict__())
File "/usr/local/lib/python3.7/dist-packages/pyheatpump/models/heatpump.py", line 28, in __dict__
return { **r, **self.get_var_values() }
File "/usr/local/lib/python3.7/dist-packages/pyheatpump/models/heatpump.py", line 38, in get_var_values
r[label] = var_type.get_variables_values()
File "/usr/local/lib/python3.7/dist-packages/pyheatpump/models/variable_type.py", line 59, in get_variables_values
return Variable.getall_values_of_type(self)
File "/usr/local/lib/python3.7/dist-packages/pyheatpump/models/variable.py", line 69, in getall_values_of_type
return Variable.getall_values_of_type_since(type, 0)
File "/usr/local/lib/python3.7/dist-packages/pyheatpump/models/variable.py", line 92, in getall_values_of_type_since
type.__dict__)
File "/usr/local/lib/python3.7/dist-packages/pyheatpump/models/variable.py", line 80, in <dictcomp>
for row in DB.sql(
File "/usr/local/lib/python3.7/dist-packages/pyheatpump/models/variable.py", line 74, in <lambda>
floatcast = lambda x: round(float(x) / 10, 2)
TypeError: float() argument must be a string or a number, not 'NoneType'
SELECT * FROM var_type
{}
SELECT var.address as address, val.value
FROM variable var
LEFT JOIN var_value val ON
var.type = val.type
AND var.address = val.address
AND var.last_update = val.time
WHERE
var.type = :slabel
AND var.address >= :start_address
AND var.address <= :end_address
AND var.last_update > :since
{'slabel': 'A', 'label': 'Analog', 'type': 'float', 'start_address': 1, 'end_address': 5000, 'since': 0}
INFO: 127.0.0.1:59930 - "GET /heatpump/ HTTP/1.1" 500 Internal Server Error
```
maxime-alves
mudou título de Conversion en flaot lorsque la variable est vide para Conversion en float lorsque la variable est vide4 anos atrás
Le problème semble résolu.