From d57206ee82f307e92d66fbca0c1c0b7e19972e17 Mon Sep 17 00:00:00 2001 From: Linus Dietz Date: Fri, 29 Jan 2021 08:36:04 +0100 Subject: [PATCH] Fix UTF8 Chars --- Get-TeamsStatus.ps1 | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Get-TeamsStatus.ps1 b/Get-TeamsStatus.ps1 index e72d58c..475f9a7 100644 --- a/Get-TeamsStatus.ps1 +++ b/Get-TeamsStatus.ps1 @@ -57,7 +57,10 @@ If($null -ne $SetStatus){ "icon"="mdi:microsoft-teams"; } } - Invoke-RestMethod -Uri "$HAUrl/api/states/sensor.teams_status" -Method POST -Headers $headers -Body ($params|ConvertTo-Json) -ContentType "application/json" + + $params = $params | ConvertTo-Json + Invoke-RestMethod -Uri "$HAUrl/api/states/sensor.teams_status" -Method POST -Headers $headers -Body ([System.Text.Encoding]::UTF8.GetBytes($params)) -ContentType "application/json" + break } @@ -146,7 +149,9 @@ If ($CurrentStatus -ne $Status) { "icon"="mdi:microsoft-teams"; } } - Invoke-RestMethod -Uri "$HAUrl/api/states/sensor.teams_status" -Method POST -Headers $headers -Body ($params|ConvertTo-Json) -ContentType "application/json" + + $params = $params | ConvertTo-Json + Invoke-RestMethod -Uri "$HAUrl/api/states/sensor.teams_status" -Method POST -Headers $headers -Body ([System.Text.Encoding]::UTF8.GetBytes($params)) -ContentType "application/json" } If ($CurrentActivity -ne $Activity) { @@ -159,7 +164,8 @@ If ($CurrentActivity -ne $Activity) { "icon"="$ActivityIcon"; } } - Invoke-RestMethod -Uri "$HAUrl/api/states/sensor.teams_activity" -Method POST -Headers $headers -Body ($params|ConvertTo-Json) -ContentType "application/json" + $params = $params | ConvertTo-Json + Invoke-RestMethod -Uri "$HAUrl/api/states/sensor.teams_activity" -Method POST -Headers $headers -Body ([System.Text.Encoding]::UTF8.GetBytes($params)) -ContentType "application/json" } Start-Sleep 1 } Until ($Enable -eq 0)