system.alarm.queryStatus与数据库中的记录不同步

大家好!

我用system.alarm.queryStatus 这条指令获取激活未确认的报警记录,显示有7条报警记录, 但是我在数据库中找不到与之对应的EventID. 如何才能实现报警信息的同步呢?


Google translate says:

I use the command system.alarm.queryStatus to get activated unconfirmed alarm records, and it shows that there are 7 alarm records, but I can’t find the corresponding EventID in the database. How can I realize the synchronization of alarm information?

The alarm_events table gets a separate row for every change that happens to the status of an alarm. You should use the UUID in your SQL WHERE clause to get the rows that apply to a specific alarm. You may also need to JOIN with the alarm_event_data table for additional information. See this part of the documentation:

https://docs.inductiveautomation.com/display/DOC81/Alarm+Journal#AlarmJournal-TableDefinitions

{Side note: This forum is largely english-speaking. You may get quicker responses if you include a translation of your question. I generally use Google for such, but if you know even a little english, you might be able to adjust the translation to best reflect your meaning.}

quertStatus returns an list of alarms, so to get the IDs, you will need to iterate through the list and get them:

state = ['ActiveUnacked']
alarms = system.alarm.queryStatus(state = state)
for alarm in alarms:
	print alarm.id

Here is a tutorial that details how to get the other alarm properties in this manner as well: