Beispiel #1
0
        private async void GetWeather()
        {
            var forecast = await _darkSkyService.GetForecast(_config.Latitude, _config.Longitude,
                                                             new DarkSkyService.OptionalParameters
            {
                ExtendHourly        = true,
                DataBlocksToExclude = new List <ExclusionBlock> {
                    ExclusionBlock.Flags
                },
                LanguageCode     = "x-pig-latin",
                MeasurementUnits = "si"
            });

            _logger.LogInformation(
                $"{forecast.Response.Currently.Icon} Temperature {forecast.Response.Currently.Temperature} - Humidity {forecast.Response.Currently.Humidity * 100}%");


            var entity = new WeatherEd
            {
                EntityName    = "Weather",
                EventDateTime = DateTime.Now,
                Humidity      = forecast.Response.Currently.Humidity.Value,
                Temperature   = forecast.Response.Currently.Temperature.Value,
                Pressure      = forecast.Response.Currently.Pressure.Value,
                WindBearing   = forecast.Response.Currently.WindBearing.Value,
                UvIndex       = forecast.Response.Currently.UvIndex.Value,
                WindGust      = forecast.Response.Currently.WindGust.Value,
                WindSpeed     = forecast.Response.Currently.WindSpeed.Value,
                Status        = forecast.Response.Currently.Icon.ToString()
            };

            _ioTService.InsertEvent(entity);
        }
Beispiel #2
0
 public void RiseCommand(WeatherEd entity, string commandName, params object[] args)
 {
     _logger.LogInformation("This is RISE command name");
 }