Get all scada devices

This commit is contained in:
WQY\qiong
2023-03-29 22:41:51 +08:00
parent 0f1d2d5435
commit 6287dcd1fe
5 changed files with 28 additions and 10 deletions

View File

@@ -15,6 +15,14 @@ def get_scada_device_schema(name: str) -> dict[str, dict[str, Any]]:
'sd_type': {'type': 'str', 'optional': True , 'readonly': False}}
def get_scada_devices(name: str) -> list[str]:
result : list[str] = []
rows = read_all(name, 'select id from scada_device order by id')
for row in rows:
result.append(str(row['id']))
return result
def get_scada_device(name: str, id: str) -> dict[str, Any]:
sm = try_read(name, f"select * from scada_device where id = '{id}'")
if sm == None: