Get all scada devices
This commit is contained in:
@@ -121,12 +121,12 @@ from .s26_labels import get_label_schema, get_label, set_label, add_label, delet
|
||||
from .s27_backdrop import get_backdrop_schema, get_backdrop, set_backdrop
|
||||
|
||||
from .s29_scada_device import SCADA_DEVICE_TYPE_PRESSURE, SCADA_DEVICE_TYPE_DEMAND, SCADA_DEVICE_TYPE_QUALITY, SCADA_DEVICE_TYPE_LEVEL, SCADA_DEVICE_TYPE_FLOW
|
||||
from .s29_scada_device import get_scada_device_schema, get_scada_device, set_scada_device, add_scada_device, delete_scada_device
|
||||
from .s29_scada_device import get_scada_device_schema, get_scada_devices, get_scada_device, set_scada_device, add_scada_device, delete_scada_device
|
||||
from .del_cmd import clean_scada_device
|
||||
|
||||
from .s30_scada_device_data import get_scada_device_data_schema, get_scada_device_data, set_scada_device_data, add_scada_device_data, delete_scada_device_data
|
||||
from .del_cmd import clean_scada_device_data
|
||||
|
||||
from .s31_scada_element import SCADA_ELEMENT_STATUS_OFFLINE, SCADA_ELEMENT_STATUS_ONLINE
|
||||
from .s31_scada_element import get_scada_element_schema, get_scada_element, set_scada_element, add_scada_element, delete_scada_element, get_scada_elements
|
||||
from .s31_scada_element import get_scada_element_schema, get_scada_elements, get_scada_element, set_scada_element, add_scada_element, delete_scada_element
|
||||
from .del_cmd import clean_scada_element
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user