Spark Alarm Router


#1

There is no reference in the docs on how to use the Spark Alarm Router so appreciate some guidance

  1. no matter what we do, we’re always getting this error “axon::EvalErr: Unknown symbol ‘sparks’ [eval:1]” our version of SkySpark is 3.0.18

  2. how can we filter the sparks to split between different sites, i.e. split a rule to send to different Niagara Alarm classes based on the associated site

our current sample configuration
image


#2
  1. The filter parameters is fed into a findAll axon method so it will need to conform to proper syntax there. I just validated the failure you are seeing using that filter pattern and confirmed it needs to be written as follows.

v=>v[“siteRef”]==@p:bureau:r:Bureau-6f6e0

  1. I will use the demo database to describe this scenario. Making a connection to the SkySpark database and adding a single rule from it for testing, Zone air temp exceeds threshold. If I leave all the defaults and poll for today, I get this result in my default alarm class in Niagara.

One rule, multiple sites in the default alarm class.
image

Now I will create an alarm class for Carrytown and assign the alarm class on the HaystackSparkAlarmRouter and poll again.

One rule, multiple sites in the Carrytown alarm class.
image

But what we really want is only Carrytown alarms for this class. So now I cleared out my alarm database. Applied the filter pattern as described above for Carrytown and polled again.

image

One rule, one site in the Carrytown alarm class.
image

To summarize how to control sparks to alarms for a site:

  1. Create the alarm class you want to route to.
  2. Create a HaystackSparkAlarmRouter for each site.
  3. Apply the site filter at the AlarmRouter level.
  4. Discover rules you want to generate alarms for that class and site
  5. Start polling.

#3

thanks @kodaroJonathan I’m now receiving this error though

org.projecthaystack.client.CallErrException: axon::SyntaxErr: Unexpected symbol: “ (0x201c) [eval:1]
 at org.projecthaystack.client.HClient.call(HClient.java:551)
 at org.projecthaystack.client.HClient.eval(HClient.java:206)
 at com.kodaro.haystack.BHaystackDevice.eval(BHaystackDevice.java:592)
 at com.kodaro.haystack.alarm.folio.BHaystackSparkRule.performPoll(BHaystackSparkRule.java:416)
 at com.kodaro.haystack.alarm.folio.BHaystackSparkAlarmRouter.performPoll(BHaystackSparkAlarmRouter.java:413)
 at com.kodaro.haystack.message.SparkPollMessage.execute(SparkPollMessage.java:42)
 at com.kodaro.haystack.message.SparkPollMessage.run(SparkPollMessage.java:34)
 at javax.baja.util.ThreadPoolWorker$WorkerThread.run(ThreadPoolWorker.java:279)

perhaps something to do with UTF encoding


#4

Can you provide a screen shot of the new configuration? Extracting the filter for inspection would also be helpful in determining the cause of this error as this appears to be another invalid axon syntax issue.


#5

here is screenshot

image

filter
v=>v[“siteRef”]==@p:bureau:r:Bureau-b8c6f


#6

It’s a subtle difference to notice but if you look closely at those quotation marks, you can see they have some sort of formatting information in them. This is likely due to copy pasting from a more advanced text editor, this forum perhaps?

Here’s what I suggest.

  1. Copy out the filter into a dumb text editor such as note pad that strips complex formatting and characters out.
  2. Paste it back into Niagara from notepad.
  3. Do a visual inspection for characters that look to have formatting still present.
  4. If they don’t, it should work now.
  5. If you see formatting still present, I would attempt to re-ype the first part of the query directly into Niagara up until the ID and then just copy the ID directly out of SkySpark. This should eliminate any special character formatting causing issues.

#7

thanks @kodaroJonathan that fixed that issue, but now its back to nullpointerexceptions

org.projecthaystack.client.CallErrException: axon::EvalErr: Unknown symbol 'sparks' [eval:1]
 at org.projecthaystack.client.HClient.call(HClient.java:551)
 at org.projecthaystack.client.HClient.eval(HClient.java:206)
 at com.kodaro.haystack.BHaystackDevice.eval(BHaystackDevice.java:592)
 at com.kodaro.haystack.alarm.folio.BHaystackSparkRule.performPoll(BHaystackSparkRule.java:416)
 at com.kodaro.haystack.alarm.folio.BHaystackSparkAlarmRouter.performPoll(BHaystackSparkAlarmRouter.java:413)
 at com.kodaro.haystack.message.SparkPollMessage.execute(SparkPollMessage.java:42)
 at com.kodaro.haystack.message.SparkPollMessage.run(SparkPollMessage.java:34)
 at javax.baja.util.ThreadPoolWorker$WorkerThread.run(ThreadPoolWorker.java:279)
org.projecthaystack.client.CallErrException: axon::EvalErr: Unknown symbol 'sparks' [eval:1]
 at org.projecthaystack.client.HClient.call(HClient.java:551)
 at org.projecthaystack.client.HClient.eval(HClient.java:206)
 at com.kodaro.haystack.BHaystackDevice.eval(BHaystackDevice.java:592)
 at com.kodaro.haystack.alarm.folio.BHaystackSparkRule.performPoll(BHaystackSparkRule.java:416)
 at com.kodaro.haystack.alarm.folio.BHaystackSparkAlarmRouter.performPoll(BHaystackSparkAlarmRouter.java:413)
 at com.kodaro.haystack.message.SparkPollMessage.execute(SparkPollMessage.java:42)
 at com.kodaro.haystack.message.SparkPollMessage.run(SparkPollMessage.java:34)
 at javax.baja.util.ThreadPoolWorker$WorkerThread.run(ThreadPoolWorker.java:279)
java.lang.NullPointerException
 at com.kodaro.haystack.alarm.folio.BHaystackSparkAlarmRouter.performPoll(BHaystackSparkAlarmRouter.java:482)
 at com.kodaro.haystack.message.SparkPollMessage.execute(SparkPollMessage.java:42)
 at com.kodaro.haystack.message.SparkPollMessage.run(SparkPollMessage.java:34)
 at javax.baja.util.ThreadPoolWorker$WorkerThread.run(ThreadPoolWorker.java:279)

#8

hi @kodaroJonathan any assistance on this please


#9

I think the best way for you to resolve this issue is to use the full query being used when you enter that filter. Open up the folio app in SkySpark you are connecting too and first run the query for the rule you are interested in.

Example for querying a rule from the demo database with no filter:

navFilter(“sparkTarget”,null).sparks(today).findAll(v=>v[“ruleRef”]==@p:demo:r:22862c9c-a7c40e1c).findAll().sparkHis()

Assuming this is succeeds, now attempt to put in your filter into the last .findAll() section just before the .sparkHis() section:

navFilter(“sparkTarget”,null).sparks(today).findAll(v=>v[“ruleRef”]==@p:demo:r:22862c9c-a7c40e1c).findAll(v=>v[“siteRef”]==@p:demo:r:22348b69-20f70672).sparkHis()

If this request succeeds, then copy paste the filter portion directly out of SkySpark and paste it into the filter portion of Niagara. If it still fails, then there is a syntax issue with the filter component you have provided and will need to refer to SkySpark/axon documentation to resolve those types of syntax issues.


#10

hi @kodaroJonathan did some further investigation to find the reason is because

navFilter("sparkTarget", null) 

is deprecated as of v3 of SkySpark (https://skyfoundry.com/forum/topic/3757) and we’re using 3.0.18

will you be providing an update to support the latest SkySpark?

also note that I did try calling the above axon function with ‘.sparks(lastWeek)’ in both the demo and our own project but both returned the same ‘unknown symbol sparks’ error


#11

** update **

I enabled the spark extension on SkySpark and everything started working. I suppose this allows the legacy API to be used, not sure? It comes disabled on default installation.


#12

The information provided for this post was against an installation of 3.0.15 which was setup to utilize the legacy Spark Engine. Utilizing the newer Rule Engine will require an update to the driver. I do not have a timeline for this update and so the legacy sparks engine/app will be required to use this feature at this time.