32 lines
1000 B
Plaintext
32 lines
1000 B
Plaintext
def get_alarms_to_shelve(self):
|
|
"""This function is used to perform the shelving function on
|
|
single or multiple alarms. It receives an alarm data dictionary
|
|
from a row in the alarm table and generates a shelving dict to trigger
|
|
a tag change script on the gateway.
|
|
|
|
Args:
|
|
self: Reference to the component that is calling this function
|
|
|
|
Returns:
|
|
Executes the shelving function. Does not return any results.
|
|
|
|
Raises:
|
|
KeyError: Raises an exception.
|
|
"""
|
|
|
|
selected_rows = self.custom.alarms_to_shelve
|
|
shelve_time = self.props.value
|
|
alarms_to_shelve = []
|
|
messages_to_shelve = []
|
|
for i in selected_rows:
|
|
# alarm_id = i.get("AlarmId")
|
|
alarm_id = i.get("value",{}).get("SourceId",{}).get("value")
|
|
alarm_id = alarm_id.replace(" ", "")
|
|
message = i.get("value",{}).get("Alarm_id",{}).get("value")
|
|
alarms_to_shelve.append(alarm_id)
|
|
messages_to_shelve.append(message)
|
|
duration = shelve_time
|
|
self.props.value = ""
|
|
return alarms_to_shelve ,messages_to_shelve, duration
|
|
|