Giter Club home page Giter Club logo

Comments (54)

januweness avatar januweness commented on May 27, 2024 2

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?

from huawei-sun2000-api-cli.

bhaezlr avatar bhaezlr commented on May 27, 2024 2

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
}

from huawei-sun2000-api-cli.

igerlster avatar igerlster commented on May 27, 2024 2

I have question to @igerlster what type of battery do you have Luna 2000 or LG?

i have the Luna 2000, yes Huawei hat so set some permissions and now its working fine .-)

from huawei-sun2000-api-cli.

januweness avatar januweness commented on May 27, 2024 1

from huawei-sun2000-api-cli.

januweness avatar januweness commented on May 27, 2024 1

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

from huawei-sun2000-api-cli.

BlazejosP avatar BlazejosP commented on May 27, 2024 1

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.

from huawei-sun2000-api-cli.

bhaezlr avatar bhaezlr commented on May 27, 2024 1

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.

from huawei-sun2000-api-cli.

BlazejosP avatar BlazejosP commented on May 27, 2024 1

Hurray!! so now we can implement using of battery in software

from huawei-sun2000-api-cli.

januweness avatar januweness commented on May 27, 2024

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?

from huawei-sun2000-api-cli.

BlazejosP avatar BlazejosP commented on May 27, 2024

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

from huawei-sun2000-api-cli.

mnuxx avatar mnuxx commented on May 27, 2024

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.

from huawei-sun2000-api-cli.

BlazejosP avatar BlazejosP commented on May 27, 2024

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?

from huawei-sun2000-api-cli.

mnuxx avatar mnuxx commented on May 27, 2024

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

image

from huawei-sun2000-api-cli.

BlazejosP avatar BlazejosP commented on May 27, 2024

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?

from huawei-sun2000-api-cli.

januweness avatar januweness commented on May 27, 2024

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

from huawei-sun2000-api-cli.

BlazejosP avatar BlazejosP commented on May 27, 2024

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?

from huawei-sun2000-api-cli.

BlazejosP avatar BlazejosP commented on May 27, 2024

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.

from huawei-sun2000-api-cli.

januweness avatar januweness commented on May 27, 2024

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" ];

from huawei-sun2000-api-cli.

BlazejosP avatar BlazejosP commented on May 27, 2024

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

from huawei-sun2000-api-cli.

januweness avatar januweness commented on May 27, 2024

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!

from huawei-sun2000-api-cli.

BlazejosP avatar BlazejosP commented on May 27, 2024

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.

from huawei-sun2000-api-cli.

BlazejosP avatar BlazejosP commented on May 27, 2024

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/

from huawei-sun2000-api-cli.

BlazejosP avatar BlazejosP commented on May 27, 2024

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.

from huawei-sun2000-api-cli.

januweness avatar januweness commented on May 27, 2024

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.

from huawei-sun2000-api-cli.

BlazejosP avatar BlazejosP commented on May 27, 2024

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

from huawei-sun2000-api-cli.

bhaezlr avatar bhaezlr commented on May 27, 2024

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": ,
"longitude": ,
"softwareVersion": "V100R001C00SPC118",
"stationCode": "NE="
},
{
"devName": "XXXXXXXXXXX",
"devTypeId": 38,
"esnCode": "XXXXXXXXXXX",
"id": XXXXXXXXXXX,XXXXXXXXXXX
"invType": "SUN2000-4.6KTL-L1",
"latitude": ,
"longitude": ,
"softwareVersion": "V200R001C00SPC112",
"stationCode": "NE="
},
{
"devName": "Battery",
"devTypeId": 23032,
"esnCode": null,
"id": XXXXXXXXXXX,
"invType": null,
"latitude": ,
"longitude": ,
"softwareVersion": null,
"stationCode": "NE="
},
{
"devName": "Power Sensor",
"devTypeId": 47,
"esnCode": null,
"id": XXXXXXXXXXX,
"invType": null,
"latitude": ,
"longitude": ,
"softwareVersion": null,
"stationCode": "NE="
}
],
"failCode": 0,
"message": null,
"params": {
"currentTime": 1634238575755,
"stationCodes": "NE="
},
"success": true
}
"XXXXXXXXXXX"
"XXXXXXXXXXX"
"Battery"
"Power Sensor"

from huawei-sun2000-api-cli.

BlazejosP avatar BlazejosP commented on May 27, 2024

anonymisation of your data just reminder 👍

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 👎 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

  • Residential inverter (should show data like ordinary inverter not so big difference)
  • Power Sensor (programmed without device testing may work but also may existing some errors)
  • Dongle (has no additional data tested by me :) )
  • 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 👎 )

from huawei-sun2000-api-cli.

bhaezlr avatar bhaezlr commented on May 27, 2024

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'

from huawei-sun2000-api-cli.

BlazejosP avatar BlazejosP commented on May 27, 2024

Hi greet that you look at this
So as I understand now we have this situation file fusionsolarapp_interface.sh

  • Residential inverter is now recognised correctly by function which show devices in menu getDeviceKPI_menu () and is working correctly shows realtime-data to my understanding? Thanks for your improvement in code. 👍
  • Power Sensors need our attention because should also show realtime data look in line 555 in file file fusionsolarapp_interface.sh so as for now something goes wrong that program exits. 👎
  • Dongle is working correctly as programed has no any data to show. 👍
  • Luna battery I think that is success for now is recognizable now by function getDeviceKPI_menu () even if you haven't any data to show time for that will be letter when you made experiments with your battery 👍

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
#not documented based on users contribution 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.

from huawei-sun2000-api-cli.

bhaezlr avatar bhaezlr commented on May 27, 2024

Problems solved:

  • line 555 : $3 does not exist ! Use $2 => script gets the options
  • line 443 : must be the same as 451

** Adaptation for Huawei LUNA2000 Battery **

  • In function 'Devices_list_menu'
    #not documented based on users contribution
    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")" )
  • In function 'getDeviceKPI_menu'
    In first if-statement add the condition '|| [ "$2" == "Huawei_LUNA2000_Battery" ]'

** 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 ??

from huawei-sun2000-api-cli.

BlazejosP avatar BlazejosP commented on May 27, 2024

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.

from huawei-sun2000-api-cli.

bhaezlr avatar bhaezlr commented on May 27, 2024

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

from huawei-sun2000-api-cli.

BlazejosP avatar BlazejosP commented on May 27, 2024

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?

from huawei-sun2000-api-cli.

bhaezlr avatar bhaezlr commented on May 27, 2024

from huawei-sun2000-api-cli.

bhaezlr avatar bhaezlr commented on May 27, 2024

@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.

from huawei-sun2000-api-cli.

BlazejosP avatar BlazejosP commented on May 27, 2024

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

screenshot

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?

from huawei-sun2000-api-cli.

bhaezlr avatar bhaezlr commented on May 27, 2024

The last query gave a negative result:
{
"data": null,
"failCode": 20006,
"message": null,
"params": {
"currentTime": 1636443370390,
"devIds": "",
"devTypeId": 23032
},
"success": false
}

I cross checked it with other devices and they gave a positive result.

from huawei-sun2000-api-cli.

BlazejosP avatar BlazejosP commented on May 27, 2024

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.

from huawei-sun2000-api-cli.

bhaezlr avatar bhaezlr commented on May 27, 2024

All the requests returns the same negative result:
{
"data": null,
"failCode": 20006,
"message": null,
"params": {
"currentTime": 1636489592610,
"collectTime": 1636395918000,
"devIds": "",
"devTypeId": 23032
},
"success": false
}

It looks the parameters of the battery aren't available with API, but are available within the website

from huawei-sun2000-api-cli.

BlazejosP avatar BlazejosP commented on May 27, 2024

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?

from huawei-sun2000-api-cli.

BlazejosP avatar BlazejosP commented on May 27, 2024

So you have some success? or Luna battery is still not responding?

from huawei-sun2000-api-cli.

bhaezlr avatar bhaezlr commented on May 27, 2024

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

from huawei-sun2000-api-cli.

BlazejosP avatar BlazejosP commented on May 27, 2024

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 [email protected]

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?

from huawei-sun2000-api-cli.

bhaezlr avatar bhaezlr commented on May 27, 2024

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

from huawei-sun2000-api-cli.

BlazejosP avatar BlazejosP commented on May 27, 2024

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.

from huawei-sun2000-api-cli.

bhaezlr avatar bhaezlr commented on May 27, 2024

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.

from huawei-sun2000-api-cli.

bhaezlr avatar bhaezlr commented on May 27, 2024

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

from huawei-sun2000-api-cli.

BlazejosP avatar BlazejosP commented on May 27, 2024

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.

  1. Can you check last time how Luna2000 is looking in CLI and graphical interface my question is all the data are displayed correctly and if you can export them to files.
  2. I know that you have also Power Sensors in your installation if you can also check this and tell me if all is working correctly?
  3. 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?.

from huawei-sun2000-api-cli.

BlazejosP avatar BlazejosP commented on May 27, 2024

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?

from huawei-sun2000-api-cli.

igerlster avatar igerlster commented on May 27, 2024

@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. :-(

from huawei-sun2000-api-cli.

bhaezlr avatar bhaezlr commented on May 27, 2024

@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

from huawei-sun2000-api-cli.

igerlster avatar igerlster commented on May 27, 2024

dataItemMap

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

Yes i have the openAPI account, but dataItemMap for the getDevRealKpi call ist empty for me i can list alle the devices including battery

from huawei-sun2000-api-cli.

igerlster avatar igerlster commented on May 27, 2024

Ok fixed.. the Support Team helped me, some permissions hat to be set and now it's working :-)

from huawei-sun2000-api-cli.

BlazejosP avatar BlazejosP commented on May 27, 2024

Hello As I understand # @igerlster has the same problem to @bhaezlr that some part of data from his account was blocked on Huawei server when you use this software and as I understand Huawei unblock this and now especially when login working again you can check status of your batteries inside this software if I think correct?
I have question to @igerlster what type of battery do you have Luna 2000 or LG?
And question to @bhaezlr if real time status of battery really disappear or is only blocked on your account or there were changes in API and meaby they need adjustment in code of this software?

from huawei-sun2000-api-cli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.