Class RainPointMonitor
- Namespace
- RainPointClient
- Assembly
- RainPointClient.dll
Monitors one discovered hub using MQTT push plus REST polling. Never sends watering commands.
public sealed class RainPointMonitor
- Inheritance
-
RainPointMonitor
- Inherited Members
Remarks
Sign in before starting. Events run on background threads; marshal UI updates and keep handlers nonblocking. Stop and await this monitor before changing accounts, logging out, or disposing the client. One monitor may run per client. Separate clients sharing an account can still displace each other's observer.
Constructors
RainPointMonitor(RainPointCloudClient, RainPointHub, RainPointMonitorOptions?)
Creates an unstarted observer for a discovered hub; the caller retains ownership of the cloud client.
public RainPointMonitor(RainPointCloudClient client, RainPointHub hub, RainPointMonitorOptions? options = null)
Parameters
clientRainPointCloudClientThe caller-owned cloud client; this helper does not dispose it.
hubRainPointHubA hub discovered through its home in the current account; its child list identifies valid RF addresses and models.
optionsRainPointMonitorOptionsMonitor settings; null selects defaults where allowed.
Properties
AcceptedPushCount
Gets the count of accepted status pushes, not a count of physical valve transitions.
public long AcceptedPushCount { get; }
Property Value
Current
Gets the latest merged observation, or null before a successful observation is accepted.
public RainPointStatusUpdate? Current { get; }
Property Value
LiveUpdatesAvailable
True after a successful catch-up read on the current MQTT connection and authenticated session. This is observer availability, not a physical-device heartbeat.
public bool LiveUpdatesAvailable { get; }
Property Value
RejectedPushCount
Gets the count of status pushes rejected by scope, decoding or ordering checks.
public long RejectedPushCount { get; }
Property Value
State
Gets the monitor's current connection lifecycle state.
public RainPointMonitorState State { get; }
Property Value
Methods
RefreshAsync(CancellationToken)
Requests a read now. Polls are serialized; watering commands are never issued or retried.
public Task RefreshAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenCancellation for this operation; cancelling after submission does not prove that a cloud write was undone.
Returns
- Task
A task representing the operation lifetime.
Exceptions
- InvalidOperationException
Start the monitor before refreshing it.
RunAsync(CancellationToken)
Runs until cancelled or stopped. A monitor instance can be started once.
public Task RunAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenCancellation for this operation; cancelling after submission does not prove that a cloud write was undone.
Returns
- Task
A task representing the operation lifetime.
Exceptions
- InvalidOperationException
This monitor has already been started. This client already has a running monitor.
StopAsync()
Cancels observation and waits for the running monitor to finish; does not dispose the caller's client.
public Task StopAsync()
Returns
- Task
A task representing the operation lifetime.
Events
ConfigurationChanged
Raised for a newer configuration revision of this hub's home. Requires an identified login profile. Does not refresh configuration or mark status fresh.
public event EventHandler<RainPointConfigurationChange>? ConfigurationChanged
Event Type
StateChanged
Occurs on a background thread when the monitor's connection lifecycle state changes.
public event EventHandler<RainPointMonitorStateChangedEventArgs>? StateChanged
Event Type
StatusReceived
Occurs on a background thread after accepting and merging a hub or timer observation.
public event EventHandler<RainPointStatusUpdate>? StatusReceived