send console data to gotify

This commit is contained in:
Ryan Peters 2023-05-20 22:06:16 -04:00
parent e014128ddc
commit 41811ef2c0
2 changed files with 11 additions and 4 deletions

View File

@ -27,7 +27,13 @@ var httpClientFactory = app.Services.GetService<IHttpClientFactory>();
var httpClient = httpClientFactory.CreateClient();
var apiUrl = configuration["ApiUrl"];
var gotifyUrl = configuration["GotifyUrl"];
var weatherSet = await httpClient.GetFromJsonAsync<WeatherSet>(apiUrl);
Console.WriteLine(weatherSet.Current.ConditionName);
var notificationResponse = await httpClient.PostAsJsonAsync(gotifyUrl, new
{
title = "Weather Conditions",
message = $"{weatherSet.Current.ConditionName} and {weatherSet.Current.Temperature} degrees",
priority = 5
});

View File

@ -1,3 +1,4 @@
{
"ApiUrl": "https://weather.binarydad.com/api"
"ApiUrl": "https://weather.binarydad.com/api",
"GotifyUrl": "https://push.binarydad.com/message?token=AaYB_oOYlFz1nnp"
}