chore: send message to discord

This commit is contained in:
willem.serruys
2025-12-29 06:45:42 +01:00
parent fc6bdab674
commit a2057255d4

View File

@@ -20,16 +20,24 @@ app.MapPost(
switch (body.Status) switch (body.Status)
{ {
case "firing": case "firing":
Console.WriteLine("Peak too high. Shutting down heat pump.");
await client.GetAsync( await client.GetAsync(
"http://192.168.1.121/control?cmd=heatpump&set_power_mode=off" "http://192.168.1.121/control?cmd=heatpump&set_power_mode=off"
); );
Console.WriteLine("Peak too high. Shutting down heat pump."); await client.PostAsJsonAsync<DiscordMessage>(
"https://discord.com/api/webhooks/1455072237207158981/C9qvSIGMZVc60VwpZizxqKigyzvA182RDSdt9k8qtWTq-fBgzlJHh53wAYIqYkGNkBM3",
new DiscordMessage("Peak too high. Shutting down heat pump.", "willemBot")
);
break; break;
case "resolved": case "resolved":
Console.WriteLine("Peak acceptable. Re enabling heat pump.");
await client.GetAsync( await client.GetAsync(
"http://192.168.1.121/control?cmd=heatpump&set_power_mode=on" "http://192.168.1.121/control?cmd=heatpump&set_power_mode=on"
); );
Console.WriteLine("Peak acceptable. Re enabling heat pump."); await client.PostAsJsonAsync<DiscordMessage>(
"https://discord.com/api/webhooks/1455072237207158981/C9qvSIGMZVc60VwpZizxqKigyzvA182RDSdt9k8qtWTq-fBgzlJHh53wAYIqYkGNkBM3",
new DiscordMessage("Peak is acceptable. Re enabling heat pump.", "willemBot")
);
break; break;
default: default:
Console.WriteLine("Unknown body type"); Console.WriteLine("Unknown body type");
@@ -53,3 +61,5 @@ app.MapPost(
app.Run(); app.Run();
record AlertBody(string Status); record AlertBody(string Status);
record DiscordMessage(string content, string userName);