This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Goodwe
#1
Dear readers,

I am looking for the api of Goodwe inverters (Semsportal)
on Github I found the below but I don't know how to integrate this into the W4K.

Can someone help me with this?

thanks in advance


Code:
#####User details here#####
##Givenergy Portal API Key Goes Below between " "


email = "username@email.com"
password = "password_here"
Powerstation_Id = "Portal_ID_here"


########end user input#############


##Login to SEMS API ##
headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
headers.Add("sec-ch-ua", "`" Not A;Brand`";v=`"99`", `"Chromium`";v=`"99`", `"Microsoft Edge`";v=`"99`"")
headers.Add("Accept", "application/json, text/javascript, */*; q=0.01")
headers.Add("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8")
headers.Add("X-Requested-With", "XMLHttpRequest")
headers.Add("sec-ch-ua-mobile", "?0")
headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36 Edg/99.0.1150.39")
headers.Add("sec-ch-ua-platform", "`"Windows`"")
headers.Add("Origin", "https://eu.semsportal.com")
headers.Add("Sec-Fetch-Site", "same-origin")
headers.Add("Sec-Fetch-Mode", "cors")
headers.Add("Sec-Fetch-Dest", "empty")
headers.Add("Referer", "https://eu.semsportal.com/home/login")
headers.Add("Accept-Language", "en-GB,en;q=0.9,en-US;q=0.8")

body = "account=$email&pwd=$password&code="

response = Invoke-WebRequest 'https://eu.semsportal.com/Home/Login' -Method 'POST' -Headers $headers -Body $body -SessionVariable session
response.Content | Out-File -FilePath.\Login.txt
session | Out-File -FilePath.\Session.txt
Write-Output "Login Response Saved to: Login.txt"


headers2 = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
headers2.Add("sec-ch-ua", "`" Not A;Brand`";v=`"99`", `"Chromium`";v=`"99`", `"Microsoft Edge`";v=`"99`"")
headers2.Add("Accept", "*/*")
headers2.Add("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8")
headers2.Add("X-Requested-With", "XMLHttpRequest")
headers2.Add("sec-ch-ua-mobile", "?0")
headers2.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36 Edg/99.0.1150.39")
headers2.Add("sec-ch-ua-platform", "`"Windows`"")
headers2.Add("Origin", "https://eu.semsportal.com")
headers2.Add("Sec-Fetch-Site", "same-origin")
headers2.Add("Sec-Fetch-Mode", "cors")
headers2.Add("Sec-Fetch-Dest", "empty")
headers2.Add("Referer", "https://eu.semsportal.com/PowerStation/PowerStatusSnMin/$Powerstation_Id")
headers2.Add("Accept-Language", "en-GB,en;q=0.9,en-US;q=0.8")

body2 = "str=%7B%22api%22%3A%22v1%2FPowerStation%2FGetMonitorDetailByPowerstationId%22%2C%22param%22%3A%7B%22powerStationId%22%3A%22$Powerstation_Id%22%7D%7D"

response2 = Invoke-RestMethod 'https://eu.semsportal.com/GopsApi/Post?s=v1/PowerStation/GetMonitorDetailByPowerstationId' -Method 'POST' -Headers $headers2 -Body $body2 -WebSession $session
response2.data.inverter[0].invert_full | ConvertTo-Json -Depth 10 | Out-File -FilePath .\Data\GoodweData.txt -Encoding ASCII

Write-Output "Data Saved to: GoodweData.txt"
Write-Output "All done - Closing Powershell in 5...."
start-sleep -s 5

Exit
Reply


Messages In This Thread
Goodwe - by Danny - 06.10.2022, 13:34
RE: Goodwe - by admin - 07.10.2022, 06:36
RE: Goodwe - by Danny - 07.10.2022, 07:06
RE: Goodwe - by admin - 07.10.2022, 08:31
RE: Goodwe - by Danny - 07.10.2022, 10:33
RE: Goodwe - by admin - 07.10.2022, 10:44
RE: Goodwe - by admin - 10.10.2022, 10:07
RE: Goodwe - by Danny - 10.10.2022, 12:10
RE: Goodwe - by pioneersteffen - 07.01.2023, 19:35
RE: Goodwe - by pioneersteffen - 04.06.2023, 11:03
RE: Goodwe - by admin - 05.06.2023, 06:13
RE: Goodwe - by pioneersteffen - 10.06.2023, 07:53
RE: Goodwe - by Amelie - 13.06.2023, 18:28
RE: Goodwe - by admin - 14.06.2023, 07:02
RE: Goodwe - by Amelie - 17.06.2023, 13:48
RE: Goodwe - by admin - 19.06.2023, 08:04
RE: Goodwe - by Amelie - 19.06.2023, 19:29
RE: Goodwe - by admin - 20.06.2023, 07:10
RE: Goodwe - by Amelie - 23.06.2023, 11:20
RE: Goodwe - by admin - 26.06.2023, 08:59

Forum Jump: