0

I have a webpage with data from our sun powerplant on webpage http://www.solar-cybro.com/p/alpod-plant/540/.

I am trying to get Output power value to Powershell once every hour with idea to send me email if powerplant doesn't output power during the day.

I tried with Invoke-WebRequest and ParsedHtml.body.getElementsByTagName but didn't get far. I just can't get the number out.

Ideas?

2
  • 1
    that is a live page with what looks like a very great deal of javascript running constantly. i suspect you will need to use something more advanced than the I-WR cmdlet. ///// is there an API that you can call? Commented Jul 7, 2021 at 12:39
  • I would use UiPath for this. Commented Jul 7, 2021 at 12:46

1 Answer 1

1

For powershell v5, I think your best option is to request the historical timeplot data (basically just hitting the download link on one of the graphs):

$DataNames   = 'c11356.plant_dc_power','c11356.plant_ac_power' -join '+'
$UnitType    = 'day'         
$Units       = 1
$StartDate   = '2021:7:7:15' 
$RequestID   = [long]([double](Get-Date (Get-Date).ToUniversalTime() -UFormat %s)*1000)
$TimeplotURL = "http://www.solar-cybro.com/service/download_timeplot_data/t=$DataNames,p=$UnitType,s=$StartDate,sc=$Units,cum=0,res=24,dec=1,page=540/?rand=$RequestID"

# Get Data
$csv = Invoke-WebRequest -Uri $TimeplotURL -ContentType text/csv | 
    ConvertFrom-Csv -Delimiter ';'

# Optionally save to file
$csv | Export-Csv C:\temp\test.csv

# Display data
$csv

And it nicely outputs the data:

date       time     c11356.plant_dc_power c11356.plant_ac_power
----       ----     --------------------- ---------------------
2021-07-07 08:00:01 906                   887                  
2021-07-07 08:10:01 1002                  983                  
2021-07-07 08:20:01 1084                  1062                 

You'll have to find the specific names/IDs for the data you want, but it should be pretty simple.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.