Create a user to use for updating if you do not already have one
Create a virtual device in Homeseer similar to this
Note -1 is set by script if it encounters and error getting data for the virtual
10.10.1.45 with your Homeseer IP address
wmi with the user you created
wmiPass with the password for the above user.
4570 with the ref ID of the virtual device you created
function Get-Temperature {
$t = @( Get-WmiObject MSAcpi_ThermalZoneTemperature -Namespace "root/wmi" )
$cores = 0
$tempTotal=0
foreach ($temp in $t)
{
$CORES += 1
$currentTempKelvin = $temp.CurrentTemperature / 10
$currentTempCelsius = $currentTempKelvin - 273.15
$tempTotal += $currentTempCelsius
$currentTempFahrenheit = (9/5) * $currentTempCelsius + 32
#write ($currentTempCelsius.ToString() + " C : " + $currentTempFahrenheit.ToString() + " F : " + $currentTempKelvin + "K")
}
return $tempTotal / $cores
}
$avgTemp=Get-Temperature
$url="http://10.10.1.45/JSON?user=wmi&pass=wmiPass&request=controldevicebyvalue&ref=4570&value=" + $avgTemp
#write ("avgTemp="+$avgTemp)
#write ("url="+$url)
(New-Object System.Net.WebClient).DownloadString($url);
My script is called cpuTemp.ps1 and is in C:\diags so I set up an task to run every hour (you can make it as often as every 5 minutes) like this.
Plus you probably want to set these
For more of a rounder picture with logging, here is a fuller script.
Which looks like this
When I deployed to my second PC I found not even the Administrator could run scripts and had to set its policy to RemoteSigned and unblock the file.
PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
PS C:\> Unblock-File -Path "C:\diags\cpuTemp.ps1"
See this Microsoft doc for more info on that.
Also the temperature readings are the same and unchanging on both PCs I've deployed to so far so they might not be useful despite all the posts out there claiming they are.