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

@@ -22,14 +22,6 @@ def _check_model_id(name: str, cs: ChangeSet) -> bool:
return is_node(name, model_id) or is_link(name, model_id)
def get_scada_elements(name: str) -> list[str]:
result : list[str] = []
rows = read_all(name, 'select id from scada_element order by id')
for row in rows:
result.append(str(row['id']))
return result
def get_scada_element_schema(name: str) -> dict[str, dict[str, Any]]:
return { 'id' : {'type': 'str' , 'optional': False , 'readonly': True },
'x' : {'type': 'float' , 'optional': False , 'readonly': False},
@@ -39,6 +31,14 @@ def get_scada_element_schema(name: str) -> dict[str, dict[str, Any]]:
'status' : {'type': 'str' , 'optional': True , 'readonly': False} }
def get_scada_elements(name: str) -> list[str]:
result : list[str] = []
rows = read_all(name, 'select id from scada_element order by id')
for row in rows:
result.append(str(row['id']))
return result
def get_scada_element(name: str, id: str) -> dict[str, Any]:
sm = try_read(name, f"select * from scada_element where id = '{id}'")
if sm == None: