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);
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);
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);