Change deviceid to id

This commit is contained in:
DingZQ
2023-03-21 20:44:19 +08:00
parent 64521182ca
commit 3a8a6d0ea3

View File

@@ -1411,8 +1411,8 @@ async def fastapi_get_scada_device_data_schema(network: str) -> dict[str, dict[s
return get_scada_device_data_schema(network) return get_scada_device_data_schema(network)
@app.get('/getscadadevicedata/') @app.get('/getscadadevicedata/')
async def fastapi_get_scada_device_data(network: str, device_id: str) -> dict[str, Any]: async def fastapi_get_scada_device_data(network: str, id: str) -> dict[str, Any]:
return get_scada_device_data(network, device_id) return get_scada_device_data(network, id)
# example: set_scada_device_data(p, ChangeSet({'device_id': 'sm_device', 'data': [{ 'time': '2023-02-10 00:02:22', 'value': 100.0 }, { 'time': '2023-02-10 00:03:22', 'value': 200.0 }]})) # example: set_scada_device_data(p, ChangeSet({'device_id': 'sm_device', 'data': [{ 'time': '2023-02-10 00:02:22', 'value': 100.0 }, { 'time': '2023-02-10 00:03:22', 'value': 200.0 }]}))
# time format must be 'YYYY-MM-DD HH:MM:SS' # time format must be 'YYYY-MM-DD HH:MM:SS'
@@ -1468,6 +1468,7 @@ async def fastapi_delete_scada_element(network: str, req: Request) -> ChangeSet:
async def fastapi_clean_scada_element(network: str) -> ChangeSet: async def fastapi_clean_scada_element(network: str) -> ChangeSet:
return clean_scada_element(network) return clean_scada_element(network)
# inp file # inp file
@app.post("/uploadinp/", status_code=status.HTTP_200_OK) @app.post("/uploadinp/", status_code=status.HTTP_200_OK)
async def upload_inp(file: bytes = File(), name: str = None): async def upload_inp(file: bytes = File(), name: str = None):