Exemple #1
0
        public async Task <(bool, bool)> GetState()
        {
            await ReadConfiguration();

            AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);
            var channel  = GrpcChannel.ForAddress(_url);
            var client   = new SaunaService.SaunaServiceClient(channel);
            var request  = new GetStateRequest();
            var response = await client.GetStateAsync(request);

            return(response.IsSaunaOn, response.IsInfraredOn);
        }
Exemple #2
0
        public async Task <int> GetTemperature()
        {
            await ReadConfiguration();

            AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);
            var channel  = GrpcChannel.ForAddress(_url);
            var client   = new SaunaService.SaunaServiceClient(channel);
            var request  = new GetTemperatureRequest();
            var response = await client.GetTemperatureAsync(request);

            return(response.Temperature);
        }