SmartConnector Forum
Schneider Electric support forum about SmartConnector applications for integration of other building management systems (BMS) into EcoStruxure Building Operation.
Link copied. Please paste this link to share this article on your social media post.
Dear:
When I create a function to subscribe the data of ES, I doubt whether this could possible be done in some way:
If I wanna get notification of an analog value only when the value is out of range(pre-setted in somewhere).
For example:
An analog value "Test" in ES, the high limit would be 35 while the low limit is 15, only when the value is higher then 35 or lower then 15, I can use the getNotification() function to receive value.
Is It possible?
currently, I can only use the getNotification() function to listen to Digital value since anytime the anolog value changed, it will also receive data that is meaningless in actual usage.
Cheers
---Austen Yin
Link copied. Please paste this link to share this article on your social media post.
Hi Austen,
GetNotification is an EWS Method, and it does not support getting a notification on only a range of values.
Your best bet is to simply filter the response after you get it:
try
{
var getNotificationResponse = _ewsClient.GetNotification("MySubscriptionId", "MyNotificationId");
// Also need to handle paging, renew, error cases etc...
var filteredChangeEvents = getNotificationResponse.Events.ValueChangedEvents.Where(a => Convert.ToDecimal(a.Value) >= 15 && Convert.ToDecimal(a.Value) <= 35);
}
catch (Exception ex)
{
Logger.LogError(LogCategory.Processor, ex);
return _prompts;
}
That said, if you are making GetNotification calls directly then you are most likely not using the SubscriptionReader. There are a bunch of complexities when getting subscriptions, (e.g. NotificationId, paging etc.., failures, Renew, Unsubscribe etc..) that we have wrapped in the SubscriptionReader class so you won't need to handle all the edge cases yourself in your own logic.
In the case of the SubscriptionReader, you would filter the same way, but on the DataRead after you call ReadData:
var filteredResults = results.DataRead.Where(a => Convert.ToDecimal(a.ValueItemChangeEvent.Value)>= 15 && Convert.ToDecimal(a.ValueItemChangeEvent.Value) <= 35);
-Jeff
Link copied. Please paste this link to share this article on your social media post.
Hi Austen,
GetNotification is an EWS Method, and it does not support getting a notification on only a range of values.
Your best bet is to simply filter the response after you get it:
try
{
var getNotificationResponse = _ewsClient.GetNotification("MySubscriptionId", "MyNotificationId");
// Also need to handle paging, renew, error cases etc...
var filteredChangeEvents = getNotificationResponse.Events.ValueChangedEvents.Where(a => Convert.ToDecimal(a.Value) >= 15 && Convert.ToDecimal(a.Value) <= 35);
}
catch (Exception ex)
{
Logger.LogError(LogCategory.Processor, ex);
return _prompts;
}
That said, if you are making GetNotification calls directly then you are most likely not using the SubscriptionReader. There are a bunch of complexities when getting subscriptions, (e.g. NotificationId, paging etc.., failures, Renew, Unsubscribe etc..) that we have wrapped in the SubscriptionReader class so you won't need to handle all the edge cases yourself in your own logic.
In the case of the SubscriptionReader, you would filter the same way, but on the DataRead after you call ReadData:
var filteredResults = results.DataRead.Where(a => Convert.ToDecimal(a.ValueItemChangeEvent.Value)>= 15 && Convert.ToDecimal(a.ValueItemChangeEvent.Value) <= 35);
-Jeff
Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.