Tag Archives: acurite

Acurite Weather Station Monitoring PRTG

My weather station uploads to wunderground but I wanted a way to collect historical stats and monitor my indoor temp remotely. Since I already have PRTG running in a virtual machine, this is a good solution for me.

foto_no_exif

My Weather Station AcuRite 5 – in – 1 Color Weather Station – $80 from Costco

First you’ll need the Acurite software and hardware USB interface to start outputting a CSV to your PRTG host.

2016-10-20_0920

Acurite software config

2016-10-20_0826

Sample Output

Save the following powershell file into your PRTG Custom Sensors\EXEXML directory. Edit the first line to the path of your acurite CSV. Then open PRTG and add a new sensor with type of EXEXML, selecting the scrip  you just saved.

Essentially the script just parses the CSV, sets labels and limits. The CSV file will eventually grow very large, I’ll deal with that then. In my case I had to setup another script to transfer to the CSV to my PRTG box, but you can figure that out. I’m sure there are more efficient ways to do this, but it works well for my case.

$myFileName = "e:\temp\acuriteweather.CSV" 

# Get last one row of file into variable 
$lastDataRow = (Get-Content $myFileName)[-1]

#parse data
$dataArray = $lastDataRow.Split(",") 
$dataArray = $dataArray -replace '"', ""

$Timestamp = $dataArray[0] 
$OutdoorTemperature = $dataArray[1]
$OutdoorHumidity = $dataArray[2]
$DewPoint = $dataArray[3]
$HeatIndex = $dataArray[4]
$WindChill = $dataArray[5]
$BarometricPressure = [math]::Round($dataArray[6],2)
$Rain = $dataArray[7]
$WindSpeed = [math]::Round($dataArray[8],2)
$WindAverage = [math]::Round($dataArray[9],2)
$PeakWind = [math]::Round($dataArray[10],2)
$WindDirection = $dataArray[11]
$IndoorTemperature = $dataArray[12]
$IndoorHumidity = $dataArray[13]

#rainfall fix, resets counter every night at midnight
$yesterday = (Get-Date).AddDays(-1).ToString('MM/dd/yyyy')
$yesterday = $yesterday + " 11:48:00 PM"
$dayinput = Select-String -Path $myFileName -Pattern "$yesterday" | select line
$yesterdaysrainfall = $dayinput -split ','
$yesterdaysrainfall = $yesterdaysrainfall[7] -split '"'
$yesterdaysrainfall = [double]$yesterdaysrainfall[1]
$todaysrain = [math]::Round($rain -$yesterdaysrainfall,2)
write-host "<prtg>"
write-host "<result>"
write-host "<channel>Outdoor Temp</channel>"
write-host "<customUnit>F</customUnit>"
write-host "<float>1</float>"
write-host "<LimitMode>1</LimitMode>"
write-host "<LimitMaxWarning>95</LimitMaxWarning>"
write-host "<LimitMaxError>105</LimitMaxError>"
write-host "<LimitMinWarning>10</LimitMinWarning>"
write-host "<LimitMinError>0</LimitMinError>"
write-host "<LimitWarningMsg>Ourdoor Temp Warning</LimitWarningMsg>"
write-host "<LimitErrorMsg>Ourdoor Temp Error</LimitErrorMsg>"
write-host "<value>$OutdoorTemperature</value>"
write-host "</result>"

write-host "<result>"
write-host "<channel>Outdoor Humidity</channel>"
write-host "<customUnit>%</customUnit>"
write-host "<value>$OutdoorHumidity</value>"
write-host "</result>"

write-host "<result>"
write-host "<channel>Outdoor Dewpoint</channel>"
write-host "<value>$DewPoint</value>"
write-host "<customUnit>F</customUnit>"
write-host "</result>"

write-host "<result>"
write-host "<channel>Outdoor Heat Index</channel>"
write-host "<value>$HeatIndex</value>"
write-host "<customUnit>F</customUnit>"
write-host "</result>"

write-host "<result>"
write-host "<channel>Outdoor Wind Chill</channel>"
write-host "<value>$WindChill</value>"
write-host "<customUnit>F</customUnit>"
write-host "</result>"

write-host "<result>"
write-host "<channel>Outdoor Barometric Pressure</channel>"
write-host "<float>1</float>"
write-host "<DecimalMode>2</DecimalMode>"
write-host "<value>$BarometricPressure</value>"
write-host "</result>"

write-host "<result>"
write-host "<channel>Rain</channel>"
write-host "<customUnit>inches</customUnit>"
write-host "<float>1</float>"
write-host "<value>$todaysrain</value>"
write-host "</result>"

write-host "<result>"
write-host "<channel>Wind Speed</channel>"
write-host "<customUnit>mph</customUnit>"
write-host "<float>1</float>"
write-host "<LimitMaxWarning>20</LimitMaxWarning>"
write-host "<LimitMaxError>30</LimitMaxError>"
write-host "<LimitWarningMsg>Wind Warning</LimitWarningMsg>"
write-host "<LimitErrorMsg>Wind very high</LimitErrorMsg>"
write-host "<value>$WindSpeed</value>"
write-host "</result>"

write-host "<result>"
write-host "<channel>Wind Speed Average</channel>"
write-host "<float>1</float>"
write-host "<customUnit>mph</customUnit>"
write-host "<DecimalMode>2</DecimalMode>"
write-host "<LimitMaxWarning>20</LimitMaxWarning>"
write-host "<LimitMaxError>30</LimitMaxError>"
write-host "<LimitWarningMsg>Wind Warning</LimitWarningMsg>"
write-host "<LimitErrorMsg>Wind very high</LimitErrorMsg>"
write-host "<value>$WindAverage</value>"
write-host "</result>"

write-host "<result>"
write-host "<channel>Peak Speed Wind</channel>"
write-host "<float>1</float>"
write-host "<DecimalMode>2</DecimalMode>"
write-host "<customUnit>mph</customUnit>"
write-host "<value>$PeakWind</value>"
write-host "</result>"

write-host "<result>"
write-host "<channel>Wind Direction</channel>"
write-host "<float>1</float>"
write-host "<customUnit>degrees</customUnit>"
write-host "<DecimalMode>2</DecimalMode>"
write-host "<value>$WindDirection</value>"
write-host "</result>"

write-host "<result>"
write-host "<channel>Indoor Temperature</channel>"
write-host "<float>1</float>"
write-host "<value>$IndoorTemperature</value>"
write-host "<customUnit>F</customUnit>"
write-host "<LimitMode>1</LimitMode>"
write-host "<LimitMaxWarning>81</LimitMaxWarning>"
write-host "<LimitMaxError>85</LimitMaxError>"
write-host "<LimitMinWarning>65</LimitMinWarning>"
write-host "<LimitMinError>62</LimitMinError>"
write-host "<LimitWarningMsg>Indoor Temp Warning</LimitWarningMsg>"
write-host "<LimitErrorMsg>Indoor Temp Error</LimitErrorMsg>"
write-host "</result>"

write-host "<result>"
write-host "<channel>Indoor Humidity</channel>"
write-host "<value>$IndoorHumidity</value>"
write-host "<customUnit>%</customUnit>"
write-host "<LimitMode>1</LimitMode>"
write-host "<LimitMaxWarning>90</LimitMaxWarning>"
write-host "<LimitMaxError>95</LimitMaxError>"
write-host "<LimitMinWarning>30</LimitMinWarning>"
write-host "<LimitMinError>35</LimitMinError>"
write-host "<LimitWarningMsg>Indoor Humidity Warning</LimitWarningMsg>"
write-host "<LimitErrorMsg>Indoor Humidity Error</LimitErrorMsg>"
write-host "</result>"
write-host "</prtg>"