Open BlazejosP opened 3 years ago
Hello, thanks so much for keeping this alive. I can serve with two inverters on a single account and can do some testing. However, I have not done anything lately because I really only need one rather simple thing the tools does and have not managed to modify it for my purposes. Maybe this is the opportunity to work together on that as this may be quite easy for you: What I would like is to produce a csv file with the columns: Date/Time (hour intervals) Yield (kWh) Export (kWh) Self-consumption (kWh) Import (kWh) thus the data behind the curves one can see on the App. I think that would be quite a common use case - do you think that would be easy to do?
There is already export option to csv in fusionsolarapp_interface.sh for plant and for device. As for now you can export only realtime datata because that is what I done now for TUI. In a while will be also ready possibility to export hourly/daily/monthly/yearly data. If you d'like a little bit different schema of exported data will be great to accommodate this in code simple push your code to repository. I forgot to add this export option to txt version of interface fusionsolarapp.sh propably also will add this in a while.
Now questions to you can you check in both interfaces fusionsolarapp_interface.sh & fusionsolarapp.sh how this software handle two power plants and if everything is ok? or is necessary to repair something? will be great and tick box that is checked with two
I have String Inverter Model: SUN2000-30KTL-M3 Grid meter Model: PowerMeter Distributed SmartLogger Model: Smart Logger Happy to help , currently i cant see getDevRealKpi, opened another ticket for that.
Hello mnuxx Can you describe which devices in graphical interface TUI are working fine and with wich you have problem so I will be able to mark this which are working fine and help you with the rest?
in GUI PowerMeter Optsions exit gui ./fusionsolarapp_interface.sh: line 501: [: ==: unary operator expected ./fusionsolarapp_interface.sh: line 501: [: =: unary operator expected ./fusionsolarapp_interface.sh: line 501: [: =: unary operator expected ./fusionsolarapp_interface.sh: line 555: [: ==: unary operator expected ./fusionsolarapp_interface.sh: line 555: [: =: unary operator expected ./fusionsolarapp_interface.sh: line 555: [: =: unary operator expected
StringINverter is 3th item on list,when open options, it shows device1 (in my case SmartLogger) information
I think that I found this error in ./fusionsolarapp_interface.sh line 501
if [ $3 == "String_Inverter" ] || [ $3 = "Residential_inverter" ] || [ $3 = "Battery" ];
to
if [ $3 == "String_Inverter" ] || [ $3 == "Residential_inverter" ] || [ $3 == "Battery" ];
line 558
elif [ $3 == "EMI" ] || [ $3 = "Grid_meter" ] || [ $3 = "Power_Sensor" ];
to
elif [ $3 == "EMI" ] || [ $3 == "Grid_meter" ] || [ $3 == "Power_Sensor" ];
So now you should be able to check first device Distributed smart meter and will be communicate that there are no any data to see and for Grid meter and String Inverter you should be able to see them under Options. I will upload this modified file and ask to your raport about TUI if is working OK or need deeper analysis?
After fixing these two lines, I still get the same issue, but but seems to work if also put $3 into quotes, thus: if [ "$3" == "String_Inverter" ] || [ "$3" == "Residential_inverter" ] || [ "$3" == "Battery" ]; elif [ "$3" == "EMI" ] || [ "$3" == "Grid_meter" ] || [ "$3" == "Power_Sensor" ];
I think that I found this error in ./fusionsolarapp_interface.sh line 501
if [ $3 == "String_Inverter" ] || [ $3 = "Residential_inverter" ] || [ $3 = "Battery" ];
to
if [ $3 == "String_Inverter" ] || [ $3 == "Residential_inverter" ] || [ $3 == "Battery" ];
line 558
elif [ $3 == "EMI" ] || [ $3 = "Grid_meter" ] || [ $3 = "Power_Sensor" ];
to
elif [ $3 == "EMI" ] || [ $3 == "Grid_meter" ] || [ $3 == "Power_Sensor" ];
So now you should be able to check first device Distributed smart meter and will be communicate that there are no any data to see and for Grid meter and String Inverter you should be able to see them under Options. I will upload this modified file and ask to your raport about TUI if is working OK or need deeper analysis?
Hi, I have two power plants, and with fusionsolarapp.sh I can see both of them while with the interface only one.
Now questions to you can you check in both interfaces fusionsolarapp_interface.sh & fusionsolarapp.sh how this software handle two power plants and if everything is ok? or is necessary to repair something? will be great and tick box that is checked with two
After fixing these two lines, I still get the same issue, but but seems to work if also put $3 into quotes
Can you add this as your modification to fusionsolarapp_interface.sh was great and really nice that you found this error I have no way to verify this myself because I have only one power plant with just boring inverter&dongle. I d'like to ask so now you can access to TUI and check every device without any unexpected issues?
Hi, I have two power plants, and with fusionsolarapp.sh I can see both of them while with the interface only one.
If i look on the code of fusionsolarapp.sh I think that I not implemented working with two power plants probably because I have only one and is hard to test this without API where you can test behavior of the code. Just only theoretically.
As you mentioned function getStationList found both powerplants without problem but then we have code of our station in variable ${stations_Code_array[0]} here first then in ${stations_Code_array[1]} second etc. line 1468 in functions.sh
This station code is used then by function getDevList to print all the devices inside particular power plant in fusionsolarapp.sh line 174
getDevList ${stations_Code_array[0]} $number_of_plants
Meaby try also add you second powerplant
getDevList ${stations_Code_array[0]} $number_of_plants
getDevList ${stations_Code_array[1]} $number_of_plants
Or in other way different experiment according to Huawei API manual
getDevList ${stations_Code_array[0]}","${stations_Code_array[1]} $number_of_plants
Tell me what will be the result of this experiment if goes well you should have txt with devices displayed from both powerplants? If that will work we can try to found way to display getStationRealKpi & getDevRealKpi from both plants together.
Hi, I have fixed this now in the code.
After fixing these two lines, I still get the same issue, but but seems to work if also put $3 into quotes, thus: if [ "$3" == "String_Inverter" ] || [ "$3" == "Residential_inverter" ] || [ "$3" == "Battery" ]; elif [ "$3" == "EMI" ] || [ "$3" == "Grid_meter" ] || [ "$3" == "Power_Sensor" ];
Hi,
great job, I can access both plants with the fusionsolarapp.sh. I have now activated your function to getKpiStationHour to get my hourly production which works very well, and as an improvement I am piping the output into a temporary file:
0) Generate a variable for temporary files that will be deleted after the script ends:
out=mktemp tempXXXXXX
|| exit 1
trap "rm -f $out*" 0 1 2 3 5
1) Create station list data for plant 1 and pipe into a temporary file getDevList ${stations_Code_array[0]} $number_of_plants getKpiStationHour ${stations_Code_array[0]} $curent_time > ${out}.json
There are a few non-json lines in this output file because the function getKpiStationHour is a bit too chatty in lines 2330-2358 in functions.sh, I have in my local copy commented them out, perhaps a chatter flag could be introduced that controls what kind of screen output is being produced. Or, we could write all the screenoutput we see right now into a log file rather than on screen?
My suggestion how to create the type of file I have in mind, thus date | produced power
1) Extract the inverter power and pipe into temporary file: less ${out}.json | jq '.data[].dataItemMap.inverterPower' > ${out}.power
2) Extract date from the json output: less ${out}.json | jq '.data[].collectTime' > ${out}.time
3) Convert the cryptic date (nanoseconds from 1970-01-01T00:00:00) to Calendar date: while read d; do d3=$(echo ${d::-3}) date -d@${d3} +%Y-%m-%dT%H:%M:%S >> ${out}.dates done < ${out}.time
4) Merge the temporary files into a final permanent file: paste -d'|' ${out}.dates ${out}.power > device1.stats
Same works for my second plant with getDevList ${stations_Code_array[0]} $number_of_plants getKpiStationHour ${stations_Code_array[0]} $curent_time > ${out}.json [.....] paste -d'|' ${out}.dates ${out}.power > device2.stats
If you want, I can add this into the public tool.
==============================
Another suggestion is to allow the user to provide a date: if test x${1} = x; then mydate=0 else mydate=$1 fi
[....]
if test "$mydate" != "0"; then echo Extracting hourly data for date=$mydate curent_time=$(date -d$mydate +%s)000 echo corresponding to $curent_time nonoseconds since 1970 01 01 else curent_time=1621981136530 fi
With this change, the tool could be called with ./fusionsolarapp.sh 20210801 for August 1st
If you like these changes I can also implement them in the official version.
Cheers, Jan
From: "BlazejosP" @.> To: "BlazejosP/huawei-sun2000-API-CLI" @.> Cc: "Jan-Uwe Ness" @.>, "Comment" @.> Sent: Saturday, August 21, 2021 11:54:02 AM Subject: Re: [BlazejosP/huawei-sun2000-API-CLI] TUI implemended but need feedback about other devices in plant (#19)
Hi, I have two power plants, and with fusionsolarapp.sh I can see both of them while with the interface only one.
If i look on the code of fusionsolarapp.sh I think that I not implemented working with two power plants probably because I have only one and is hard to test this without API where you can test behavior of the code. Just only theoretically.
As you mentioned function getStationList found both powerplants without problem but then we have code of our station in variable ${stations_Code_array[0]} here first then in ${stations_Code_array[1]} second etc. line 1468 in functions.sh
This station code is used then by function getDevList to print all the devices inside particular power plant in fusionsolarapp.sh line 174 getDevList ${stations_Code_array[0]} $number_of_plants
Meaby try also add you second powerplant getDevList ${stations_Code_array[0]} $number_of_plants getDevList ${stations_Code_array[1]} $number_of_plants
Tell me what will be the result of this experiment if goes well you should have txt with devices displayed from both powerplants?
— You are receiving this because you commented. Reply to this email directly, [ https://github.com/BlazejosP/huawei-sun2000-API-CLI/issues/19#issuecomment-903092185 | view it on GitHub ] , or [ https://github.com/notifications/unsubscribe-auth/ABTM3ACYANU3LJVMHY4JKZLT55ZTVANCNFSM5CDE6TTA | unsubscribe ] . Triage notifications on the go with GitHub Mobile for [ https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 | iOS ] or [ https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email | Android ] .
This message is intended only for the recipient(s) named above. It may contain proprietary information and/or protected content. Any unauthorised disclosure, use, retention or dissemination is prohibited. If you have received this e-mail in error, please notify the sender immediately. ESA applies appropriate organisational measures to protect personal data, in case of data privacy queries, please contact the ESA Data Protection Officer @.***).
If you like these changes I can implement them in the official version.
That will be great if you can add this piping to josn and date argument to functions.sh especially if that will be modular don't forgot to add some examples of using piping function in fusionsolarapp.sh and also how you extract data from two power plant to the same file
Hi, ok, date argument is implemented and statistical data examples for second plant with comments in code.
The json parsing I will do later. Are you ok that the screen output in the statistical data functions are removed? I could try to pipe them into a master log file if you like.
Btw, I have for now only worked with the function getKpiStationHour, will check the others later.
If you like these changes I can implement them in the official version.
That will be great if you can add this piping to josn and date argument to functions.sh especially if that will be modular don't forgot to add some examples of using piping function in fusionsolarapp.sh and also how you extract data from two power plant to the same file
So far I have tested offline and implemented my changes in the web page. I am trying now to move to git pull/push but don't get this right (sorry, not experienced with git). I tried: git pull huawei-sun2000-API-CLI fatal: not a git repository (or any of the parent directories): .git
Can someone help me how to pull this correctly? Thanks!
Now if you d'like to commit some changes to repository you need use personal token so this is how final push command will looks like
git push https://<your token>@github.com/BlazejosP/huawei-sun2000-API-CLI.git
but from where you can take this token? https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ https://webkul.com/blog/github-push-with-two-factor-authentication/ so this problem is since 13th ;) of August
but for me after generation of this token and using in CLI is now working.
I made this modifications in separate folder lets named them Github
cd Github
ls
then I download data from github page
git clone https://github.com/BlazejosP/huawei-sun2000-API-CLI.git
then I go inside folder
cd huawei-sun2000-API-CLI
Made my changes in files
add comment to changes
git commit -m "small changes in order in fusionsolarapp.sh"
if all OK
git push https://github.com/BlazejosP/huawei-sun2000-API-CLI.git
asking about username and password And all should working OK like before but there is error with this communicate:
"remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead. remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information."
So looks like best solution is to enable two-factor authentication https://docs.github.com/en/github/authenticating-to-github/securing-your-account-with-two-factor-authentication-2fa/configuring-two-factor-authentication https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/
So far I have tested offline and implemented my changes in the web page. I am trying now to move to git pull/push but don't get this right (sorry, not experienced with git). I tried: git pull huawei-sun2000-API-CLI fatal: not a git repository (or any of the parent directories): .git
Can someone help me how to pull this correctly? Thanks!
I done this with token and now is working again inside CLI hope that you also will be able to generate this and use in your case.
Hi, I have generated a token and also two factor authentication. I can clone the code but when trying to push, I just get: Everything up-to-date
I have added two new functions to dump data to a file and would like to publish this.
if you have actual repository try add your changes and add comment
git commit -m "small changes in order in fusionsolarapp.sh"
then add token to CLI git application only one time
git remote add origin https://token to account: <--Your token-->@github.com/BlazejosP/huawei-sun2000-API-CLI.git
And now you can send data to repository
git push https://<--Your token-->@github.com/BlazejosP/huawei-sun2000-API-CLI.git
I checked settings and you are added as collaborator so here from server side looks that all is OK
As requested some info about my situation. Invert : SUN2000-4.6KTL-L1 Battery : HUAWEI-LUNA2000
I activated the lines 1658 and 1679 1658 : echo $getDevList | jq 1679 : echo $device_Name | jq
Output
{
"data": [
{
"devName": "XXXXXXXXXXX",
"devTypeId": 62,
"esnCode": "XXXXXXXXXXX",
"id": XXXXXXXXXXX,
"invType": "SDongleA-05",
"latitude":
anonymisation of your data just reminder :+1:
Thanks that you are sharing this based on your contribution I can add new device
not documented based on users contribution
elif [ $1 == "23032" ]; then printf "Huawei LUNA2000 Battery"
to function Device_type_ID () in functions.sh looks that this number is never mentioned in official Huawei manuals related how to deal with API. Meaby that is why they mentioned that only LG batteries are supported :-1: This will be uploaded in a few days to github with bigger update of other sort
Also based an your data we can marking Residential inverter& Power Sensor as working inside program what I done now on the beginning of this post.
Can you check also how your devices behave in TUI when you check devices and options
Luna Battery (because number is not know for program should even not show correct name in devices menu you can repair this by adding this code mentioned in post to functions.sh function Device_type_ID () then can not show correct data probably will show communicate that device has no additional data or crash.
So will be necessary to see what API returns for luna battery from fusionsolarapp.sh by looking inside function getDevRealKpi
line 3024 #echo $getDevRealKpi | jq
uncomenting this and starts code fusionsolarapp.sh
based on answer is then possible to add for getDevRealKpi possibility to show realtime data from your Luna Huawei 2000 battery in both fusionsolarapp.sh and fusionsolarapp_interface.sh . That all must be based on experiments thanks that you have this equipment and if you are intrested in contribution because I don't know about any documentation from Huawei side they even mentioned in API manual (No only LG batteries suported :-1: )
Residential inverter Getting the options crashes the script at line 501 Changed $3 by $2 (no parameter $3) format parameter $2 : Residential_inverter[10000000XXXXXXXX]" To test I putted my devicenumber between the brackets and got the menu
Power Sensor Script just stopped, no error
Dongle Result 'This device Dongle has no any additional data'
Battery On lines 428,432,436,440,444 and 448 : Error 'too many arguments' Probably also "=" used instead of "==" Result 'This device Huawei LUNA2000 Battery has no any additional data'
Hi greet that you look at this So as I understand now we have this situation file fusionsolarapp_interface.sh
So for now you added to functions.sh this device Device_type_ID ()
#not documented based on users contribution elif [ $1 == "23032" ]; then printf "Huawei LUNA2000 Battery"
And also to variant without spaces in the same function
`
elif [ $1 == "23032" ];
then
printf "Huawei_LUNA2000_Battery"
`
Can you upload your changes for fusionsolarapp_interface.sh && functions.sh which will made Residential inverter and Luna battery working for everyone (even if Luna just partially). After that we will have two tasks found what is wrong with Power Sensors and then add code to extract real-time data from Luna Battery.
Problems solved:
Adaptation for Huawei LUNA2000 Battery
elif [ $(echo "$( Device_type_ID ${device_TypeId_array[$(( $Our_menu_devices_list-1 ))]} "no_whitespace")" ) == "Huawei_LUNA2000_Battery" ] then getDeviceKPI_menu ${devices_number_array_for_dialog[$(( $Our_menu_devices_list-1 ))]} $(echo "$( Device_type_ID ${device_TypeId_array[$(( $Our_menu_devices_list-1 ))]} "no_whitespace")" )
Next problem It looks if the result of 'get-options' operation is not correct ? select device 1 (Dongle) on screen : info is complete get options => This device Dongle has no any additional data (correct)
select device 2 (Residential_Inverter)
on screen : info of device 2 (correct)
get options/Real-time Data => getDevRealKpi => on screen data of 'Device 1' (Dongle)
saving to file : wrong data in file
select device 3 (Huawei_LUNA2000_Battery)
on screen partial filled in
get options/Real-time Data => getDevRealKpi => on screen data of 'Device 1' (Dongle)
saving to file : wrong data in file
select device 4 (Power_Sensor)
on screen partial filled in
get options/Real-time Data => getDevRealKpi => on screen data of 'Device 1' (Dongle)
saving to file : wrong data in file
Cause in getDeviceKPI_entry : variable $count not set.
$count used at different places but never initialized ??
I have feeling that I know why you have always Dongle data in fusionsolarapp.sh ?
lets see on example you d'like to see real-time data for particular device and you uncomment this
getDevRealKpi ${device_Id_array[0]} ${device_TypeId_array[0]}
0 means that you see data for first device. So everything depending from order of your devices on your account on. You can check this in TUI when you see devices inside plant or in fusionsolarapp.sh in function getDevList
In my case looks like this that is why I chose 0 to take data from inverter in your case maybe different order
` API getDevList connection OK Normal Status Time of your Request to API: XXXXXX
Plant 1: XXXXXXXXXX Number of devices: 2
Device 1: XXXXXXXXXX
String Inverter Model: SUN2000-5KTL-M0
Device Name: XXXXXXXXXX
Device SN: XXXXXXXXXX
Software version: V100R001C00SPC120
longitude: Not existing
latitude: Not existing
Device 2: XXXXXXXXXX
Dongle Model: SDongleA-05
Device Name: XXXXXXXXXX
Device SN: XXXXXXXXXX
Software version: V100R001C00SPC111
longitude: Not existing
latitude: Not existing
` In case of fusionsolarapp_interface.sh things are more complicated again I have feeling that this $3 is needed by interface to take data from array for different devices if you mess with this and replace with $2 is possible that all the devices are recognised as this first one with 0 number and you always try to see Dongle internal data even If you chosen different devices from list.
I didn't change anything in the file fusionsolarapp.sh The line was already uncommented in the download. Saved a copy of the original download
Sorry I assumed that this errors are not only in TUI but also in fusionsolarapp.sh
great that you solved some problems with showing your Luna2000 battery in menu but there is problem with data from particular devices as I understand. Look inside Devices_list_menu () in fusionsolarapp_interface.sh line 431 to 451 isnecessary to create entry for your luna battery which will execute function getDeviceKPI_menu to show something from inside of your battery. Next thing in the same file lines inside function getDeviceKPI_menu line 501
if [ "$3" == "String_Inverter" ] || [ "$3" == "Residential_inverter" ] || [ "$3"== "Battery" ];
will be necessary to create something for Lune2000 like
if [ "$3" == "String_Inverter" ] || [ "$3" == "Residential_inverter" ] || [ "$3"== "Battery" ] || [ "$3"== "Huawei_LUNA2000_Battery" ];
whothever string you named your battery in functionDevice_type_ID () in functions.sh
then in functions.sh is necessary to create code which will deal with your Luna for getDevRealKpi() line 3002
can you uncomment this #echo $getDevRealKpi | jq in line 3024 and then execute fusionsolarapp.sh with getDevRealKpi ${device_Id_array[0]} ${device_TypeId_array[0]}
with number of your Luna battery probably different than 0 and show results in josn then we can see what is answer of your battery in API and plan what should be coded in functions.sh to made your device working in TUI?
Hello @bhaezlr after this update I have now really time and willingness to implement your Luna2000 battery. I will need some help from your side especially answers on different questions from side of Luna2000. You can also push to repository your modifications but now I hope I can really help you to made this working.
I'm surely want to help. Currently I'm on holiday till the 7th november
Op za 30 okt. 2021 21:09 schreef BlazejosP @.***>:
Hello @bhaezlr https://github.com/bhaezlr after this update I have now really time and willingness to implement your Luna2000 battery. I will need some help from your side especially answers on different questions from side of Luna2000. You can also push to repository your modifications but now I hope I can really help you to made this working.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/BlazejosP/huawei-sun2000-API-CLI/issues/19#issuecomment-955578797, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE2AN7OXVE2VVNQCUSRYXNDUJRGG7ANCNFSM5CDE6TTA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
@BlazejosP : I'm back from holiday, with what can I help ? I cloned the latest version In the website the battery is visilble. I haved installed postman in case of.
So your battery is visible because we added Sun 2000 based on your data which you provided earlier. But that is just a mock-up because like from a dongle you can't see any thing from inside data. I don't know what type of data are available from your battery because is no any documentation about Luna2000 so all will be build based on your experiments with postman.
So first in Postman try to login with your username and password
by POST try this
https://eu5.fusionsolar.huawei.com/thirdData/login
in Body
{ "userName": "<yourusername>", "systemCode": "<yourpassword>" }
from answer window if "success": true,
check
Cookies in menu where is Body and copy from there value of XSRF-TOKEN will be necessary to have that for others questions
Next question station list insert into Headers your XSRF-TOKEN and perform question by POST
https://eu5.fusionsolar.huawei.com/thirdData/getStationList
{ }
You have code of your station
{ "data": [ { "aidType": 1, "buildState": null, "capacity": 12, "combineType": null, "linkmanPho": "XXXXXX", "stationAddr": "XXXXXXXXXXXXXXXX", "stationCode": "<here station code>", "stationLinkman": "XXXXXXXXXXXX", "stationName": "XXXXXXXXXX" } ], "failCode": 0, "message": null, "params": { "currentTime": 1636405920176 }, "success": true }
Then devices inside your station
also copy XSRF-TOKEN and perform this question by POST
https://eu5.fusionsolar.huawei.com/thirdData/getDevList
{ "stationCodes": "<Here station code from previous question" }
Answer will be like this
{ "data": [ { "devName": "XXXXXXX", "devTypeId": 1, "esnCode": "XXXXXXX", "id": <here id of device>, "invType": "SUN2000-5KTL-M0", "latitude": 1.0, "longitude": 1.0, "softwareVersion": "V100R001C00SPC120", "stationCode": "XXXXXXXXXXXXXXX" }, { "devName": "XXXXXXX", "devTypeId": 62, "esnCode": "XXXXXXXXX", "id": <here id of device>, "invType": "SDongleA-05", "latitude": 1.0, "longitude": 1.0, "softwareVersion": "V100R001C00SPC111", "stationCode": "XXXXXXXXXXXXXX" } ],23032 "failCode": 0, "message": null, "params": { "currentTime": 1636406083367, "stationCodes": "XXXXXXXXXXX" }, "success": true }
So now when you copy id of your Luna 2000 battery you are ready to ask this questions to API which we really need.
First if you can perform this real-time performance question for Luna 2000 don't forgot insert XSRF-TOKEN
https://eu5.fusionsolar.huawei.com/thirdData/getDevRealKpi
inside Body {"devIds": "<here id of device from previous question>", "devTypeId": "23032"}
So if you can show how looks answer for this Luna2000 in postman of course after anonymisation of some data. based on that answer we can prepare addition in function to show real time data from your battery. About next question I ask you letter when we both figured out how Luna2000 battery answer for this Real time API question meaby similarly to LG battery who now?
The last query gave a negative result:
{
"data": null,
"failCode": 20006,
"message": null,
"params": {
"currentTime": 1636443370390,
"devIds": "
I cross checked it with other devices and they gave a positive result.
So looks like manual said true Luna2000 like a dongle has no any internal/historical data and is only possible to have this device on list and nothing more. Or meaby only real-time question is not working and historical data is still possible to extract. Before we close this subject can you check rest of historical data extraction questions to be certain? Here they are:
https://eu5.fusionsolar.huawei.com/thirdData/getDevRealKpi Not Working!
https://eu5.fusionsolar.huawei.com/thirdData/getDevFiveMinutes
Question:
{ "devIds" : "<here your device id>", "devTypeId": 23032, "collectTime" : "1636395918000" }
https://eu5.fusionsolar.huawei.com/thirdData/getDevKpiDay
Question:
{ "devIds" : "<here your device id>", "devTypeId": 23032, "collectTime" : "1636395918000" }
https://eu5.fusionsolar.huawei.com/thirdData/getDevKpiMonth
Question:
{ "devIds" : "<here your device id>", "devTypeId": 23032, "collectTime" : "1636395918000" }
https://eu5.fusionsolar.huawei.com/thirdData/getDevKpiYear
Question:
{ "devIds" : "<here your device id>", "devTypeId": 23032, "collectTime" : "1636395918000" }
Let's see if will be any answer from Luna2000 to be certain that all is working correctly you can also perform this question also on your inverter in my case devIds number is with minus "-XXXXXX" and "devTypeId": 1 you can take this from question https://eu5.fusionsolar.huawei.com/thirdData/getDevList answer so hope that one of them my work with your battery.
For now that all looks that your Battery is different that this of LG and API can't take from them any data like manual said. But if you use TUI graphical interface can you see base data about battery like device name, software version etc? I have them for dongle even if options button can't show anything.
All the requests returns the same negative result:
{
"data": null,
"failCode": 20006,
"message": null,
"params": {
"currentTime": 1636489592610,
"collectTime": 1636395918000,
"devIds": "
It looks the parameters of the battery aren't available with API, but are available within the website
I checked your fail code 20006 what mean "Some devices do not match the device type" can you check one of the questions. For example
https://eu5.fusionsolar.huawei.com/thirdData/getDevKpiDay
Question:
{ "devIds" : "<here your device id>", "devTypeId": 39, "collectTime" : "1636395918000" }
but with device type 39 Battery even if manual said that only LG batteries supported. Meaby that helps?
So you have some success? or Luna battery is still not responding?
Same negative result. getDevKpiDay et the other functions does not accept devtypeid 23032 Tried them also with 39 as devtypeid I fear that I will need a webscrapper to get the percentage of the battery
We have still two/three options some peoples asked on official forum of Huawei API subject here but as I can see without answer from Huawei employees: https://forum.huawei.com/enterprise/en/communicate-with-fusionsolar-through-an-openapi-account/thread/591478-100027?page=4
diarmuid Created May 24, 2021 08:39:29
Posted by maartenva at 2021-05-16 13:01 Hi is there an updated version of the API request that also include the status of the LUNA2000 batt ...
I have the same question. I am choosing between a Huawei SUN200L + 3x LUNA500 vs an AlphaESS system for which I will do a custom integration with NEST. The most important information for that integration if the SOC (state of charge) of the battery ... I have not been able to find anything from Huawei re the battery.
Second option ask about API interface to Luna2000 official help-desk eu_inverter_support@huawei.com
Third option There existing other than fusion solar API interface from https://eu5.fusionsolar.huawei.com to access to data from inverter is called Modbus TCP and you can access data directly on device without use of any servers on internet. Simple inverter brodcast wifi network when you login inside this network you can ask some registers about data which are interesting for you. That for sure working with inverter I don't know that battery also brodcast some wifi you must check. Here is a long subject with software to connect to this Modbus interface. https://community.home-assistant.io/t/integration-solar-inverter-huawei-2000l/132350/804
That is all option which you have in this moment I will be interested what support will answer meby existing some "secret" call to API to grab this data or meaby that is possible only with use of Modbus acess?
BTW. Even if we have a stalemate with Luna 2000 may I ask you how now is working Power Sensors from your installation are still there any errors when you try check this device?
I go for the second option. I have sent an email. We'll wait & see if there will be any response A no go for the third option , I can't switch all the time my wifi connection
Lets see what they said. I'm also curious?
And in case of Modbus TCP you don't must reconnect each time easier solution is install second Wi-Fi interface in your monitoring computer just for that.
Lets see what they said. I'm also curious?
And in case of Modbus TCP you don't must reconnect each time easier solution is install second Wi-Fi interface in your monitoring computer just for that.
Message was sorted as spam :-( The raspberry Pi that is used serves already my Domoticz system. Second WIFI is option. Currently I'm in contact with Huawei support.
The Luna-battery is solved! I don't know what they changed, but first the helpdesk asked my API-account to check something. I got a message that there was an upgrade planned on the Fusionsolar server from 22:00:00 November 19 to 06:00:00 November 20 < UTC+02:00 >. I accidently saw the message on the website Retried my queries that were saved in Postman and now the battery is recognized as devtypeid 39 instead of 23032
I dump the data later.
The data map: getDevList { "devName": "Battery", "devTypeId": 39, "esnCode": null, "id": xxxxxxxxxxxxxxxxx, "invType": null, "latitude": xxxxxxxx, "longitude": xxxxxxxxx, "optimizerNumber": null, "softwareVersion": null, "stationCode": "NE=xxxxxxxxx" }
getDevRealKpi { "data": [ { "devId": xxxxxxxxxxxxxxxx, "dataItemMap": { "max_discharge_power": 5000.0, "max_charge_power": 5000.0, "battery_soh": 0.0, "busbar_u": 423.8, "discharge_cap": 0.14, "ch_discharge_power": 24.0, "run_state": 1, "battery_soc": 1.0, "ch_discharge_model": 4.0, "charge_cap": 0.24, "battery_status": 2.0 } } ], "failCode": 0, "message": null, "params": { "currentTime": 1637430222772, "devIds": "xxxxxxxxxxxxxxxx", "devTypeId": 39 }, "success": true }
getDevFiveMinutes { "data": [ { "devId": xxxxxxxxxxxxxxxx, "collectTime": 1636326000000, "dataItemMap": { "max_discharge_power": null, "max_charge_power": null, "battery_soh": null, "busbar_u": 423.9, "discharge_cap": 0.0, "ch_discharge_power": 24.0, "battery_soc": 1.0, "charge_cap": 0.0, "ch_discharge_model": null, "battery_status": null } }, ... ], "failCode": 0, "message": null, "params": { "currentTime": 1637430383806, "collectTime": 1636395918000, "devIds": "xxxxxxxxxxxxxxxx", "devTypeId": 39 }, "success": true }
getDevKpiDay getDevKpiMonth getDevKpiYear { "data": [ { "devId": xxxxxxxxxxxxxxxx, "collectTime": 1635721200000, "dataItemMap": { "discharge_cap": 3.03, "charge_cap": 3.15, "charge_time": 15.0, "discharge_time": 8.75 } }, ... ], "failCode": 0, "message": null, "params": { "currentTime": 1637430357951, "collectTime": 1636395918000, "devIds": "xxxxxxxxxxxxxxxx", "devTypeId": 39 }, "success": true }
Hurray!! so now we can implement using of battery in software
Hurray!! so now we can implement using of battery in software
Let me know if I have to test something. My mission succeeded. I have my battery charging status in Domoticz via MQTT/nodered
Thanks for that that you share your data that helps improve this program a little bit and hopefully helps also add your battery to supported device. I just uploaded new version which also working with yearly data period.
I have my battery charging status in Domoticz via MQTT/nodered
That sound interesting for this project I just now planed to start implementing MQTT and InfluxDB exporting if you have already working solution and d'like to share to implement in this project will be really great and my speed-up development so If you will be interested in contribution let me know especially part which export to NodeRED&MQTT?.
Hurray!! so now we can implement using of battery in software
Let me know if I have to test something. My mission succeeded. I have my battery charging status in Domoticz via MQTT/nodered
So and how that look like are you happy from that as is working now?
@bhaezlr i have the same Problem like you had with empty response from getDevRealKpi, can you tell me who you contacted for this ? Today Huawei Support told me i can not use the API for this at all. :-(
@bhaezlr i have the same Problem like you had with empty response from getDevRealKpi, can you tell me who you contacted for this ? Today Huawei Support told me i can not use the API for this at all. :-(
Did you request an openAPI account ? I can still read my batterystatus, but since the upgrade not every 5min the data comes through. I read the batterystatus with a script based on fusionsolarapp.sh
Now in TUI in real-time function are implemented parts of code which are able to work with various devices which can be connected to plant. I implemented also other devices which can be inside plant but without testing and verification. If is someone who have them can mention how they work I will be very happy. The are:
Also will be great if someone who have 2 or more plants related with his account can said how this software handle them because that was also implemented without way for checking this.