public static IAsyncEnumerable <EventMessage <StateChangePayload <TState> > > GetStateChangesAsync <TState>(
     this IHomeAssistantWebSocketsClient client,
     Func <EventMessage <StateChangePayload <TState> >, bool> predicate = null,
     CancellationToken cancellationToken = default
     )
     where TState : EntityState
 => client.Subscribe(EventTypes.Instance.StateChanged(), predicate, cancellationToken);
コード例 #2
0
 public HomeAssistantContext(IHomeAssistantRestClient restClient, IHomeAssistantWebSocketsClient webSocketsClient)
 {
     RestClient       = restClient;
     WebSocketsClient = webSocketsClient;
     Entities         = new HomeAssistantEntitiesContext(this);
     Services         = new HomeAssistantServicesContext(this);
 }
 public static IRootServiceSet Services(this IHomeAssistantWebSocketsClient client)
 => new RootServiceSet(client);
 // TODO: Broken?
 public static IAsyncEnumerable <EventMessage <TimeChangedPayload> > GetTimeChangesAsync(
     this IHomeAssistantWebSocketsClient client,
     Func <EventMessage <TimeChangedPayload>, bool> predicate = null,
     CancellationToken cancellationToken = default
     )
 => client.Subscribe(EventTypes.Instance.TimeChanged(), predicate, cancellationToken);
コード例 #5
0
 public RootServiceSet(IHomeAssistantWebSocketsClient client)
 {
     Client = client;
 }
 public static IAsyncEnumerable <EventMessage <StateChangePayload <SensorEntityState> > > GetSensorStateChangesAsync(
     this IHomeAssistantWebSocketsClient client,
     Func <EventMessage <StateChangePayload <SensorEntityState> >, bool> predicate = null,
     CancellationToken cancellationToken = default
     )
 => client.GetStateChangesAsync(predicate, cancellationToken);