Anyway if the data is online somewhere it can be captured so that is what I set out to do. It didn't take much work in the end. I poked around on the website for a little while and looked for any clues that may indicate an API of some description but these searches turned up very little.
What I did find was that GoodWe have their own android app (com.goodwe.EzManage.apk) for monitoring the generation data. I managed to download the .apk, extract it a and began to poke around inside. Within that apk I managed to find a list of strings;
http://goodwe-power.com
http://www.goodwe-power.com
http://www.goodwe-power.com/goodwe/Mobile
http://www.goodwe-power.com/goodwe/Mobile/GetAddress
http://www.goodwe-power.com/goodwe/Mobile/GetInventerDetail?inventerSN=
http://www.goodwe-power.com/goodwe/Mobile/GetMyPowerStationById?stationId=
http://www.goodwe-power.com/goodwe/Mobile/GetMyPowerStationByUser?userName=
http://www.goodwe-power.com/goodwe/Mobile/GetMyPowerStationByUserForES?username=
http://www.goodwe-power.com/goodwe/Mobile/GetPacLineChart?stationId=
http://www.goodwe-power.com/goodwe/Mobile/GetPowerBarChart?stationId=
http://www.goodwe-power.com/goodwe/Mobile/GetPowerBarChartForES?stationId=
http://www.goodwe-power.com/goodwe/Mobile/GetSOCLineChart?stationId=
http://www.goodwe-power.com/goodwe/Mobile/Login?username=
These strings were instantly recognisable as REST endpoints so I logged into the portal and grabbed my station ID from the url and gave the GetMyPowerStationById endpoint a try using the following format.
www.goodwe-power.com/Mobile/GetMyPowerStationById?stationID=63cd46b8--9999-99aa-188b5690238b
This is what I got back;
{
"curpower": "0.000kW",
"capacity": "3.000kW",
"percent": "0",
"status": "Offline",
"createdate": "2015-05-28",
"eday": "0.0kWh",
"etotal": "26.6kWh",
"income": "£0.00",
"totalincome": "£3.46",
"co2reduce": "0.000",
"totalco2reduce": "0.010",
"treesaved": "0.000",
"totaltreesaved": "0.080"
}
Now those people that know me will know I am no Java programmer but even I recognised that as a JSON object. Just to check I fed it into the JSON validator at http://jsonlint.com/ and my suspicion was confirmed.
Now I was a little disconcerted that I was able to pull the information so easily without even having to authenticate in any way with the GoodWe portal but at least it would make this a lot easier. I now had a way of getting the data I needed from the portal. Now I just needed to get it into my Domoticz system.
Domoticz has an events system that is powered by Lua scripts. I won't go into the pains I worked through learning how to put together my first Lua script. Lua is fairly well documented elsewhere but what it boiled down to was this.
1. I needed to make a call to the URL and capture the string returned.
2. I then needed to cast this string into a JSON object for easier access.
3. Next I need to pull the information I want to capture from the JSON object.
4. Finally I needed to put that information into Domoticz.
Suffice it to say that every step was painful for the inexperienced Lua scriptwriter that I am. However with the help of my good friend google. This is what I came up with I hope it is of some help to someone else out there.
-- Script to pull GoodWe power generation data into Domoticz
-- Written by M Grimwade 2015
-- Function to update a Domoticz sensor object
function update(device, id, power, energy)
commandArray[1] = {['UpdateDevice'] = id .. "|0|" .. energy}
return
end
-- Command array to populate with Domoticz instructions
commandArray = {}
-- The switch ID of my device in Domoticz
switchIdx = 50
-- Load the JSON Lua module
JSON = (loadfile "/home/pi/domoticz/scripts/lua/JSON.lua")()
-- Reference the HTTP module enabling web calls
http = require 'socket.http'
-- Perform an HTTP request to get the raw string from the REST endpoint
html = http.request 'http://www.goodwe-power.com/Mobile/GetMyPowerStationByUser?username=mGrimwade'
-- Decode the JSON formatted string to a Lua table
local t = JSON:decode(html)
-- Pull out the sub table containing the data from the main table
local t2 = t[1]
-- Get the currentPower value from the sub table into a string
local currentPowerStr = t2.currentPower
-- Check the length of that string
local currentPowerLen = string.len(currentPowerStr)
-- Trim off the Kwh from the string and cast it to an integer
local currentPowerKwVal = tonumber(string.sub(currentPowerStr,1,currentPowerLen-2))
-- Multiply the Kwh value to get the wh value
local currentPowerWVal = currentPowerKwVal * 1000
-- Call the update function to add the data to Domoticz
update("Usage", switchIdx, currentPowerWVal, currentPowerWVal)
return commandArray
Excellent work! I have been trying to wireshark the packets inverter is sending to goodwe but ended up doing it this way as well. Are your daily and accumulated kWh values updating correctly in domoticz?
ReplyDeleteThank you. Yeah they're updating just fine with that script. Hope it was of use to you.
ReplyDeleteThanx Mike,
ReplyDeleteI'm new to script editing. I also have a goodwe transformer and would like to add its output to domoticz.
What I dont understand is which data in the script above is a variable. Is it possible to mark the parts in the script which wil be different for my transformer. I succeeded in getting the rest endpoint. Thank you. Han
Is the JSON.lua a file?
ReplyDeleteThanks for the info.
ReplyDeleteI have also been trying to obtain historic data.
The following is a linux bash script to obtain all data from a given date range.
#!/bin/bash
# Kire Pudsje, march 2016
USERNAME=xxx
PASSWORD=xxx
STATIONID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
OUTFILE=out.csv
# Note: end date not inclusive
STARTDATE=2016-01-01
ENDDATE=2016-03-11
echo -n ",00:00" > ${OUTFILE}
TIME="00:10"
while [ "${TIME}" != "00:00" ]; do
echo -n ",$TIME" >> ${OUTFILE}
TIME=$(date -ud "${TIME} UTC + 10 min" "+%R")
done
echo ",24:00" >> ${OUTFILE}
wget -q --save-cookies goodwe_cookies.txt --keep-session-cookies --post-data "user=${USERNAME}&password=${PASSWORD}" http://www.goodwe-power.com/PowerStationPlatform/PowerStationReport/Index?ID=${STATIONID} -O /dev/null
DATE=${STARTDATE}
while [ "${DATE}" != "${ENDDATE}" ]; do
echo Obtaining data from ${DATE}
wget -q --load-cookies goodwe_cookies.txt --keep-session-cookies --referer "http://www.goodwe-power.com/PowerStationPlatform/PowerStationReport/Index?ID=${STATIONID}" --post-data "PowerStationID=${STATIONID}&PacDateType=0&PacDateStart=${DATE}" http://www.goodwe-power.com/PowerStationPlatform/PowerStationReport/PacQueryTypeChanged -O goodwe_data
echo -n ${DATE}, >> ${OUTFILE}
grep -o -E '"PacYAxis":"[^"]*"' goodwe_data | sed -e 's/"PacYAxis":"\(.*\)"/\1/' >> ${OUTFILE}
DATE=$(date -I -d "${DATE} + 1 day")
done
rm goodwe_data goodwe_cookies.txt
I modified the script to make it work on Mac (date-function is different). Pls find below the modified script:
Delete#!/bin/bash
# Kire Pudsje, march 2016
# Heini Withagen, Mac compatible march 2016
USERNAME=xxxxxxx
PASSWORD=xxxxxxx
STATIONID=xxxxxxxxx
OUTFILE=out.csv
# Note: end date not inclusive
STARTDATE=2016-03-01
ENDDATE=2016-03-15
echo -n ",00:00" > ${OUTFILE}
TIME="00:10"
while [ "${TIME}" != "00:00" ]; do
echo -n ",$TIME" >> ${OUTFILE}
TIME=$(date -j -f %R -v+10M ${TIME} "+%R")
done
echo ",24:00" >> ${OUTFILE}
wget -q --save-cookies goodwe_cookies.txt --keep-session-cookies --post-data "user=${USERNAME}&password=${PASSWORD}" http://www.goodwe-power.com/PowerStationPlatform/PowerStationReport/Index?ID=${STATIONID} -O /dev/null
DATE=${STARTDATE}
while [ "${DATE}" != "${ENDDATE}" ]; do
echo Obtaining data from ${DATE}
wget -q --load-cookies goodwe_cookies.txt --keep-session-cookies --referer "http://www.goodwe-power.com/PowerStationPlatform/PowerStationReport/Index?ID=${STATIONID}" --post-data "PowerStationID=${STATIONID}&PacDateType=0&PacDateStart=${DATE}" http://www.goodwe-power.com/PowerStationPlatform/PowerStationReport/PacQueryTypeChanged -O goodwe_data
echo -n ${DATE}, >> ${OUTFILE}
grep -o -E '"PacYAxis":"[^"]*"' goodwe_data | sed -e 's/"PacYAxis":"\(.*\)"/\1/' >> ${OUTFILE}
DATE=$(date -j -f %Y-%m-%d -v+1d ${DATE} +%Y-%m-%d)
done
rm goodwe_data goodwe_cookies.txt
Hi! I got a goodwe installation since a few days and I tried this on my Synology NAS with Domoticz installed. I have no idea where i can get the socket.http module files for getting this to work.
ReplyDeletehttp://w3.impa.br/~diego/software/luasocket/http.html
DeleteHi! Did you first create virtual devices voor the Goodwe?
ReplyDeleteI miss that part. You say that:
-- The switch ID of my device in Domoticz
switchIdx = 50
But I cannot see where this comes from.
Could you please explain this tot me?
I made a dummy with a virtual switch. The IDX of the newly created virtual switch needs to put in the script mentioned above.
DeleteHi, I setup a goodwe inverter in Domoticz on my Pi Zero with the built-in GoodWe hardware. It just gets data at 1.57 a.m, 2 days in a row. No real time data. Any idea?
ReplyDeleteLooks nice. Was looking for something like this, because the api isn't working anymore in Domoticz.
ReplyDeleteDo you have the script working with the new portal? I don't think the url is enough. Do you know is there a way to read it directly from the inverter?
Buy solar systems & led lights for residential & commercial areas top brand company at affordable prices. Choose from solar panels, solar inverters, solar batteries, solar charge controllers, solar street light to solar installation kit. branded products, lowest price, assured delivery with in 3 to 5 days. Reduce your Electricity Bill and Save Money with
ReplyDeleteadityasolars.com HURRY :) You can order online at leduncle.com Contact:- customer@leduncle.com | +91 78275 91463
Tül Perde Modelleri
ReplyDeletesms onay
mobil ödeme bozdurma
NFTNASİLALİNİR
Ankara Evden Eve Nakliyat
TRAFİK SİGORTASI
Dedektor
web sitesi kurma
aşk kitapları
çekmeköy alarko carrier klima servisi
ReplyDeleteataşehir alarko carrier klima servisi
kadıköy toshiba klima servisi
maltepe beko klima servisi
kadıköy beko klima servisi
kartal lg klima servisi
ümraniye alarko carrier klima servisi
kartal daikin klima servisi
ümraniye daikin klima servisi
Good content. You write beautiful things.
ReplyDeletetaksi
hacklink
sportsbet
korsan taksi
hacklink
mrbahis
sportsbet
mrbahis
vbet
hatay
ReplyDeletekars
mardin
samsun
urfa
VO2GOT
elazığ
ReplyDeletegümüşhane
kilis
siirt
sakarya
7NZVO
https://istanbulolala.biz/
ReplyDelete80Kİ4
tekirdağ evden eve nakliyat
ReplyDeletekocaeli evden eve nakliyat
yozgat evden eve nakliyat
osmaniye evden eve nakliyat
amasya evden eve nakliyat
MYGTQ
urfa evden eve nakliyat
ReplyDeletemalatya evden eve nakliyat
burdur evden eve nakliyat
kırıkkale evden eve nakliyat
kars evden eve nakliyat
56GGK
9929A
ReplyDeleteGiresun Şehirler Arası Nakliyat
Kayseri Şehir İçi Nakliyat
Düzce Evden Eve Nakliyat
Aydın Evden Eve Nakliyat
Zonguldak Evden Eve Nakliyat
Kilis Lojistik
Ünye Boya Ustası
Kastamonu Evden Eve Nakliyat
Bitmart Güvenilir mi
4C1FE
ReplyDeleteGiresun Lojistik
Ünye Petek Temizleme
Karabük Parça Eşya Taşıma
Kocaeli Evden Eve Nakliyat
Kırıkkale Şehir İçi Nakliyat
Bursa Parça Eşya Taşıma
Silivri Parke Ustası
Bitcoin Nasıl Alınır
Sakarya Evden Eve Nakliyat
11627
ReplyDeleteAnkara Boya Ustası
Rize Lojistik
Afyon Parça Eşya Taşıma
Mardin Lojistik
Tekirdağ Parça Eşya Taşıma
Siirt Lojistik
Trabzon Evden Eve Nakliyat
Afyon Lojistik
Maraş Evden Eve Nakliyat
AF890
ReplyDeleteUşak Şehirler Arası Nakliyat
Kırıkkale Parça Eşya Taşıma
Urfa Parça Eşya Taşıma
Van Şehirler Arası Nakliyat
Şırnak Şehirler Arası Nakliyat
Afyon Evden Eve Nakliyat
Kırşehir Parça Eşya Taşıma
Urfa Şehir İçi Nakliyat
Sincan Boya Ustası
A40C9
ReplyDeleteUşak Evden Eve Nakliyat
Hatay Evden Eve Nakliyat
Silivri Fayans Ustası
Burdur Evden Eve Nakliyat
Kastamonu Evden Eve Nakliyat
Kalıcı Makyaj
Çerkezköy Boya Ustası
order steroid cycles
Muğla Evden Eve Nakliyat
BBBC6
ReplyDeletereferanskodunedir.com.tr
4E57F
ReplyDeletebinance referans kodu
resimli magnet
referans kimliği nedir
binance referans kodu
resimli magnet
4C878
ReplyDeletereferans kimliği nedir
binance referans kodu
resimli magnet
binance referans kodu
resimli magnet
binance referans kodu
resimli magnet
referans kimliği nedir
binance referans kodu
4E1C8
ReplyDeletegümüşhane rastgele sohbet uygulaması
hatay canlı görüntülü sohbet siteleri
aydın canlı görüntülü sohbet
tekirdağ görüntülü sohbet uygulama
adana telefonda görüntülü sohbet
eskişehir sesli mobil sohbet
karabük kadınlarla görüntülü sohbet
ığdır en iyi sesli sohbet uygulamaları
osmaniye sesli sohbet uygulamaları
80E86
ReplyDeletevan mobil sohbet bedava
muş rastgele sohbet uygulaması
aksaray nanytoo sohbet
ısparta canlı sohbet et
karaman ücretsiz sohbet
kütahya canlı sohbet sitesi
tunceli rastgele görüntülü sohbet
muğla rastgele sohbet
denizli mobil sohbet sitesi
314C9
ReplyDeleteaydın sesli sohbet uygulamaları
ücretsiz sohbet uygulaması
tunceli telefonda rastgele sohbet
igdir canlı sohbet uygulamaları
edirne random görüntülü sohbet
hakkari canlı sohbet odaları
kırşehir sohbet siteleri
aydın kadınlarla görüntülü sohbet
hakkari sesli görüntülü sohbet
44587
ReplyDeleteeskişehir en iyi ücretsiz sohbet siteleri
Amasya Ucretsiz Sohbet
Denizli Yabancı Görüntülü Sohbet Uygulamaları
canli sohbet
parasız sohbet siteleri
Bilecik Mobil Sohbet Chat
yalova rastgele görüntülü sohbet uygulaması
Kilis Rastgele Görüntülü Sohbet Uygulaması
rize ücretsiz sohbet uygulamaları
DED57
ReplyDeleteyozgat kızlarla canlı sohbet
tamamen ücretsiz sohbet siteleri
aksaray kızlarla rastgele sohbet
sesli sohbet siteler
mersin canlı sohbet ücretsiz
edirne sohbet chat
sohbet sitesi
Trabzon Görüntülü Sohbet Kadınlarla
canlı ücretsiz sohbet
FCD70
ReplyDeletePinterest Takipçi Hilesi
Threads Beğeni Satın Al
Discord Sunucu Üyesi Satın Al
Parasız Görüntülü Sohbet
Mexc Borsası Kimin
Azero Coin Hangi Borsada
Parasız Görüntülü Sohbet
Arg Coin Hangi Borsada
Twitch İzlenme Satın Al
DBA92
ReplyDeleteyearn
ellipal
poocoin
solflare
dextools
chainlist
shiba
metamask
looksrare
BD5C7
ReplyDeletekucoin
bitcoin nasıl oynanır
bitget
4g proxy
mobil 4g proxy
telegram kripto para
bitcoin ne zaman çıktı
en düşük komisyonlu kripto borsası
btcturk
F5C7E
ReplyDeletekraken
referans kimligi nedir
btcturk
bitexen
canli sohbet
güvenilir kripto para siteleri
coin nereden alınır
filtre kağıdı
telegram türk kripto kanalları
01449
ReplyDeletevite coin yorum
sosyal medya uzmanı
seo nedir
benzinli jeneratör fiyatları
silkroad
güneş paneli sistemi
youtube abone
fet coin yorum
wordpress seo
692F8
ReplyDelete----
----
----
----
----
----
----
matadorbet
----
This comment has been removed by the author.
ReplyDelete5DEDFAECDF
ReplyDeletetakipçi satın al gerçek
D759ECF07B
ReplyDeletedüşmeyen takipçi satın al
82258762C7
ReplyDeletetürk bot takipçi
begeni satin al
telafili takipçi
tiktok takipçi
tiktok takipçi