cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Subscribe to a stream

byutz
1-Newbie

Subscribe to a stream

Does anyone know of a way that you can trigger a subscription for a "thing" when data has been added to a stream?  I can add the stream entity that I want to monitor, but I can't see where I can select the fields from the datatable associated with the stream.  The only options for data change monitoring given are name, description, tags, and thing template, which I cant see doing me any good. 

 

What I am trying to achieve is trigger an alarm notification when the stream gets an entry that has a value out of spec, sending an email or a text message.

 

Thank you!

5 REPLIES 5
Aanjan
9-Granite
(To:byutz)

Brian, you would need to add the subscription directly on the Thing itself instead of adding it on the Stream/ StreamThing. A Stream, just by itself, has nothing attached to it. You can subscribe to an Alert Event on the Thing you want to monitor for the property( or properties) you have set to logged.

byutz
1-Newbie
(To:Aanjan)

I am not sure that will work in my case.  The stream is not being logged from a thing, I am using it to simulate data coming in from a device. Maybe I should rethink how I set it up though. Should data coming in not go directly to a stream? Thank you for the quick reply!

Aanjan
9-Granite
(To:byutz)

Brian, sorry, I thought you were using Value Streams. Please do take a look at Value Streams, as you'd be able query individual property columns. Then again, using Value Streams would depend on how your model is set, how many different Things you would want to log data etc.

byutz
1-Newbie
(To:Aanjan)

Value streams were definitely the way to go. Built in querys and its very easy to set up the alerts.  Thanks you so much!

rad1
9-Granite
(To:byutz)

I would like to subscribe to an event for a thing template when an instance of a template finishes updating

properties from a remote virtual thing so I can check changed properties including all other existing properties on a thing and use a logical expression to check if I need to do an action: eg. me.temp >27 && me.pressure >100 or me.state === "fault"   do something.

 

I also want to send that all thing's property data (including changed and old once) to a third party sql db for historical and analytical purposes.

 

So how to subscribe to an event on the server side that correspond to one call to updateSubscribedProperties method on the agent side. It should only be run if there is at least a change in one property.

Thanks,

Rad

Top Tags