set_monitoring_mode
Each MonitoredItem has 3 monitoring modes (Part 4 §5.12.4):
| Mode | Server-Side Sampling | Server-Side Push | Uses |
|---|---|---|---|
| Disabled (0) | × | × | Fully stopped (neither sampling nor push) |
| Sampling (1) | ✓ | × | Sample but Do Not Push (Log History / Dead Zone Calculation) |
| Reporting (2, Default) | ✓ | ✓ | Operating Normally |
Prerequisite Reading
- To cancel your entire subscription (rather than individual issues MI), see below
set_publishing_enabled. - To modify the sampling parameters, see Modify.
Batch Cut
def set_monitoring_mode(self,
mode: MonitoringMode,
mi_handles: List[int]) -> List[StatusCode]: ...
from darra_opcua import MonitoringMode
# Temporarily suspend all data collection (e.g., during equipment maintenance)
statuses = sub.set_monitoring_mode(MonitoringMode.Disabled, all_handles)
Returns List[StatusCode], in the same mi_handles order as .mi_handles If is passed None ValueError, it is discarded []; if an empty list is passed, it returns immediately. Good When the result is a single item, the mode of MI that item is remembered and restored according to that mode when the subscription is rebuilt.
Single MI Cut
def set_mode(self,
monitored_item_handle: int,
mode: MonitoringMode) -> StatusCode: ...
sub.set_mode(handle, MonitoringMode.Disabled) # Pause a certain MI
sub.set_mode(handle, MonitoringMode.Reporting) # Restore
Subscribe or Unsubscribe to the Entire Series
def set_publishing_enabled(self, enabled: bool) -> StatusCode: ...
sub.set_publishing_enabled(False) # Stop posting to the entire subscription
sub.set_publishing_enabled(True) # Restore
Comparison of Three Particle Sizes
| Particle size | API | Applicable |
|---|---|---|
| Subscribe to the entire series | sub.set_publishing_enabled(bool) | Temporary Service Suspension (Maintenance) |
| A batch of MI | sub.set_monitoring_mode(mode, handles) | Some modules are down |
| Single MI | sub.set_mode(handle, mode) | Precise Control |
| Delete Completely | sub.remove(handle) / sub.dispose() | I don't want it anymore—ever. |