Giter Club home page Giter Club logo

Comments (23)

mnuxx avatar mnuxx commented on May 27, 2024 2

Sorry being away, wrote to support, lets see what they figure out.

from huawei-sun2000-api-cli.

BlazejosP avatar BlazejosP commented on May 27, 2024

From this what I read in your previous post you have:

  • String Inverter
  • PowerMeter
  • Smart Logger

First question this error appears when you ask about getDevRealKpi from which device?
Can you upload screenshot when this error appears (of course please remove some data like inverter serial number etc)

BTW that is strange because when we ask about realtime data date is not sended into this particular function

getDevRealKpi ${device_Id_array[0]} ${device_TypeId_array[0]}

Device Id number and Device type number

from huawei-sun2000-api-cli.

mnuxx avatar mnuxx commented on May 27, 2024

Please wait connecting!
Connection to API

API login to server OK
Username & Password accepted by Huawei Server
Normal Status

API getStationList connection OK
Normal Status
Time of your Request to API: R 20 aug 2021 17:10:43 EEST

    Plant 1: NE=somenr
    Plant Name: myplant
    Address of the plant: myaddress
    Installed capacity: 0 MWp
    Plant contact: Encrypted
    Contact phone number: Encrypted
    Poverty alleviation plant: Unknown

API getDevList connection OK
Normal Status
Time of your Request to API: R 20 aug 2021 17:10:44 EEST

Plant 1: NE=somenr
Number of devices: 3

    Device 1: logg
    Distributed SmartLogger Model: Smart Logger
    Device Name: logg
    Device SN: 
    Software version: V300R001C00SPC050
    longitude: 
    latitude:

    Device 2: meter
    Grid meter      Model: PowerMeter
    Device Name: meter
    Device SN: 
    Software version: V100R001C01AM001
    longitude: 
    latitude: 

    Device 3: inveter
    String Inverter Model: SUN2000-30KTL-M3
    Device Name: inveter
    Device SN: sn
    Software version: V100R001C20SPC107
    longitude: 
    latitude:

API getDevRealKpi connection OK
Normal Status
date: invalid date ‘@’
Time of your Request to API:

Please wait disconnecting!
Disconnection from API

API logout from server OK
Logout accepted by Huawei Server
Normal Status

from huawei-sun2000-api-cli.

BlazejosP avatar BlazejosP commented on May 27, 2024

From this what I see on your account finding Plant and then devices working correctly.

Problem starts when you ask devices about real-time data

first some observations
from code of functions.sh line 165 Device_type_ID ()
your first device is with

  • ID:63 Distributed SmartLogger
  • ID:17 Grid meter
  • ID:1 String Inverter

So if we go to function getDevRealKpi() in functions.sh line 3001 you can ask about realtime data only Grid meter and String inverter that is from documentation of Huawei devices and is implemented in code look to line 3030 in functions.sh they are

#we have inverter
if [[ $2 == 1  ]];

only for that two devices. Distributed SmartLogger simply haven't possibility to be asked about real-time data. My mistake I should write code which will inform user that such operation is not permitted.

So now probably you have not modified fusionsolarapp.sh like described ##12

in your case line 188

# Devices data precisious all voltages etc real-time
getDevRealKpi  ${device_Id_array[0]} ${device_TypeId_array[0]}	

should be different than 0 because in array under 0 is Distributed SmartLogger which can't working with this function under 1 Grid meter and under 2 String Inverter so you can insert there such code

# Devices data precisious all voltages etc real-time
# ask Grid meter
getDevRealKpi  ${device_Id_array[1]} ${device_TypeId_array[1]}	
# ask String Inverter
getDevRealKpi  ${device_Id_array[2]} ${device_TypeId_array[2]}	

Hope that will help and solve your problem if not we can start search for problem much deeper. Tell me what is behavior of fusionsolarapp.sh now?

from huawei-sun2000-api-cli.

mnuxx avatar mnuxx commented on May 27, 2024

Now i get
Device 3:
String Inverter Model: SUN2000-30KTL-M3
Device Name:
Device SN:
Software version: V100R001C20SPC107
longitude:
latitude:

date: invalid date ‘+%s’
functions.sh: line 2315: -3: substring expression < 0
functions.sh: line 2316: 1629633725- : syntax error: operand expected (error token is "- ")

from huawei-sun2000-api-cli.

januweness avatar januweness commented on May 27, 2024

from huawei-sun2000-api-cli.

mnuxx avatar mnuxx commented on May 27, 2024

Not for me unfortunately, throw me that invalid date error.
Same error came with or without adding date to script.

from huawei-sun2000-api-cli.

januweness avatar januweness commented on May 27, 2024

from huawei-sun2000-api-cli.

mnuxx avatar mnuxx commented on May 27, 2024

PI getKpiStationHour connection OK
Normal Status
Time of your Request to API: L 21 aug 2021 00:00:00 EEST
Response time: 167408 s

API getDevRealKpi connection OK
Normal Status
date: invalid date ‘@’
Time of your Request to API:

Please wait disconnecting!
Disconnection from API

from huawei-sun2000-api-cli.

januweness avatar januweness commented on May 27, 2024

from huawei-sun2000-api-cli.

mnuxx avatar mnuxx commented on May 27, 2024

API getKpiStationHour connection OK
Normal Status
Time of your Request to API: P 22 aug 2021 00:00:00 EEST
Response time: 86029 s

API getDevRealKpi connection OK
Normal Status
date: invalid date ‘@’
Time of your Request to API:

Please wait disconnecting!
Disconnection from API

API logout from server OK
Logout accepted by Huawei Server
Normal Status

from huawei-sun2000-api-cli.

mnuxx avatar mnuxx commented on May 27, 2024

Withoud date in shell script parameter:
API getKpiStationHour connection OK
Normal Status
Time of your Request to API: K 26 mai 2021 01:18:56 EEST
Response time: 7720254 s
date: invalid date ‘@’

paste: tempu9PJZr.dates: No such file or directory

API getDevRealKpi connection OK
Normal Status
date: invalid date ‘@’
Time of your Request to API:

Please wait disconnecting!
Disconnection from API

and With date:
API getKpiStationHour connection OK
Normal Status
Time of your Request to API: E 23 aug 2021 00:00:00 EEST
Response time: 35475 s

API getDevRealKpi connection OK
Normal Status
date: invalid date ‘@’
Time of your Request to API:

Please wait disconnecting!
Disconnection from API

from huawei-sun2000-api-cli.

BlazejosP avatar BlazejosP commented on May 27, 2024

Now i get
Device 3:
String Inverter Model: SUN2000-30KTL-M3
Device Name:
Device SN:
Software version: V100R001C20SPC107
longitude:
latitude:

date: invalid date ‘+%s’
functions.sh: line 2315: -3: substring expression < 0
functions.sh: line 2316: 1629633725- : syntax error: operand expected (error token is "- ")

I just looking for your case and I think that error in your case happens because problems with calculation of time which is used to show difference between question to API and answer in seconds. Is possible that answer happens before question and that is why time with minus "-" what is impossibility.

Lines 2315 and 3216

local curent_time_of_request=$(echo ${collectTime::-3})
local difference_in_secounds=$(( $curent_time_actually-$curent_time_of_request ))

As you see we first calculate curent_time_of_request and then local difference_in_secounds and my feeling is that in your case this time is something like -5s what is impossibility! Why meaby time zone is incorrect on your computer. I also don't know why this error happens in getKpiStationHour() function if you try use getDevRealKpi().

My proposition is in fussionsolarapp.sh use only functions

login_to_API
getStationList
getDevList ${stations_Code_array[0]} $number_of_plants
getDevRealKpi  ${device_Id_array[2]} ${device_TypeId_array[2]}	
logout_from_API

To use only getDevRealKpi number in your case 2 because that is String inverter which is third in your power plant based on #19 your data

Then you have negative response time try for test comment this part of code in this function getDevRealKpi() file function.sh
lines 3792 to 3804

#echo "Current Time: "$currentTime
#shorter time for read in unix
if [[ $success == "true"  ]];
	then	
		local curent_time_actually=$(echo ${currentTime::-3})
		local curent_time_of_request=$(date -d @$curent_time_actually)
		
		if [ ! -z "$DIALOG" ];
		then
				info_for_dialog_screen=$info_for_dialog_screen"\nTime of your Request to API: "$curent_time_of_request
		else
				echo "Time of your Request to API: "$curent_time_of_request
		fi

Hope that will help if not will be necessary to find reason of that or second solution made negative "-" time positive again + so your power plant stops to travel in time backward ;)

from huawei-sun2000-api-cli.

mnuxx avatar mnuxx commented on May 27, 2024

Now getting:
API getKpiStationHour connection OK
Normal Status
Time of your Request to API: K 26 mai 2021 01:18:56 EEST
Response time: 8001107 s
date: invalid date ‘@’

paste: templ6Ua3y.dates: No such file or directory

API getDevRealKpi connection OK
Normal Status
date: invalid date ‘@’
Time of your Request to API:

Please wait disconnecting!
Disconnection from API

I have ntp enabled and my timezone is Europe/Tallinn

from huawei-sun2000-api-cli.

BlazejosP avatar BlazejosP commented on May 27, 2024

Hello looks that I come to wall and haven't any another clue how helps you in this way. I have a proposition which work with other person last time look here #4 of course your problem is different but I may solve this in similar way. Is some possibility that you gave me an access temporary to your account lets said for 2/3 days in that time I try to found based on behaviour of code what is the reason and why you have invalid date ‘@’ and solve this problem after that upload patched version to repository and you change password on your account to the new one and I haven't after that access any more. So what is your opinion about this type of solution.? Will be great that for that operation before you will remove private data from eu5.fusionsolar.huawei.com (address, photo of solar panels) you can upload them again when you change password to private one.
If you will be interested we can arrange time which will be convenient for both of us.

from huawei-sun2000-api-cli.

januweness avatar januweness commented on May 27, 2024

from huawei-sun2000-api-cli.

BlazejosP avatar BlazejosP commented on May 27, 2024

I HAVE SOME IDEA WHAT THAT MAY BE!

After upgrade of server by Huawei in May on my account starts a strange behaviour simple for some question you receive no answer you can check this if you ask your account without use of this software for example with use of Postman program https://www.postman.com/ to be certain that problem is not related with code of this software.

API has this type of questions: (I checked this which are working for me)

For Power Plant:

  • getStationRealKpi
  • getKpiStationHour
  • getKpiStationHour
  • getKpiStationDay
  • getKpiStationMonth
  • getKpiStationYear

for Device

  • getDevRealKpi
  • getDevFiveMinutes
  • getDevKpiDay
  • getDevKpiMonth
  • getDevKpiYear

Additional questions:

  • getAlarmList
  • login_to_API
  • getStationList
  • getDevList
  • logout_from_API

So when I check how is working this question which is not working on my account I receive similar error to you with wrong date „@”

answer is like this

{
  "data": [],
  "failCode": 0,
  "message": null,
  "params": {
    "currentTime": 1630329033362,
    "collectTime": 1630328098623,
    "stationCodes": "XXXXXX"
  },
  "success": true
}

So what that means: answer is empty and the reason is on server side cased by error in Huawei API. If you test this

uncomment line in 1940 in functions.sh

 #echo $getStationRealKpi | jq

and check what is displayed . Then inPostman you receive similar answer for getStationRealKpi independent from this program that means that your account on fusionsolarapp server is affected and only what you can do is to explain this to [email protected] they may help and unblock this affected API questions. Looks like different persons have affected different questions there is no similar pattern in that so is possible that you have getStationRealKpi blocked by this huwei server error. Write me what happens on your account which functions are affected on your account I'm courious because I also d'like to explain to Huawei that this parts of API are not working on my account.

from huawei-sun2000-api-cli.

mnuxx avatar mnuxx commented on May 27, 2024

"failCode": 0,
"message": null,
"params": {
"currentTime": 1630352467352,
"stationCodes": "NE=somenumber"
},
"success": true
}

from huawei-sun2000-api-cli.

BlazejosP avatar BlazejosP commented on May 27, 2024

Exactly that is this type of problem. You must check either in postman or with use of of functions.sh every function like I done this and have answer which of them working and shows data and which are affected and show "success": true but without data. On beginning of each function is something like this with name of particular function

 #echo $getStationRealKpi | jq

simple uncomment this and uncomment function which you d'like to check in fusionsolarapp.sh

			#getStationRealKpi ${stations_Code_array[0]}	
			#getKpiStationHour ${stations_Code_array[0]} $curent_time
			#getKpiStationHour ${stations_Code_array[0]} 1630328098623
			#getKpiStationDay ${stations_Code_array[0]} $curent_time
			#getKpiStationMonth ${stations_Code_array[0]} $curent_time
			#getKpiStationYear ${stations_Code_array[0]} $curent_time
			
			
			# Statistical data about particular device/devices inside Power Plant
			
			# Devices data precisious all voltages etc real-time
			#getDevRealKpi  ${device_Id_array[0]} ${device_TypeId_array[0]}			
			#getDevFiveMinutes ${device_Id_array[0]} ${device_TypeId_array[0]} $curent_time
			#getDevKpiDay ${device_Id_array[0]} ${device_TypeId_array[0]} $curent_time
			#getDevKpiMonth ${device_Id_array[0]} ${device_TypeId_array[0]} $curent_time
			#Months in previous year
			#getDevKpiMonth ${device_Id_array[0]} ${device_TypeId_array[0]} $(expr $curent_time - 31622399000) # minus one year
			#getDevKpiYear ${device_Id_array[0]} ${device_TypeId_array[0]} $(expr $curent_time - 31622399000) # minus one year
			#getDevKpiYear ${device_Id_array[0]} ${device_TypeId_array[0]} $curent_time #actually year

you can see in terminal for every function API answer. Check everyone and notice which gave you this strange answer "success": true but without data and they must be mentioned in email to Huawei helpdesk. Only they can repair this because your account is affected and some functions have invalid behavior ant that is why this bash code can't handle them.
Write me when you finish test I'm courius which API questions/functions are affected on your account and how that looks like in comprasion to this affected on my account. I'm consider meaby I should add some code which in cases like this write on screen that you need to contact with helpdesk or in automatics way check which function are affected by this strange Huwei API error to fastrack someone straight to contact with helpdesk?

from huawei-sun2000-api-cli.

BlazejosP avatar BlazejosP commented on May 27, 2024

"failCode": 0,
"message": null,
"params": {
"currentTime": 1630352467352,
"stationCodes": "NE=somenumber"
},
"success": true
}

So how is with that did you have some answer from Huawei helpdesk and is this function working in your case?

from huawei-sun2000-api-cli.

mnuxx avatar mnuxx commented on May 27, 2024

I asked:
Hi, please open ticket again, it seems that my account dont have all API requests allowed.

Im trying to use:

getKpiStationHour

getDevRealKpi

and i dont get any data from there.

Huawei said:
The account has all the options , please make some screenshots from the interrogation way.

Did i asked correctly ?

from huawei-sun2000-api-cli.

BlazejosP avatar BlazejosP commented on May 27, 2024

The best will be if you send them screenshots with question and answer from postman they use this software as I found dealing with them and that may be indicator that problem is not related which any specific software but rather their API where something broken on random accounts. If you tested questions in postman and only this two are broken returning sucess:true but without any data you must now prove them that this is the issues and you need action from their side.

BTW. Before upgrade of API in May they wasn't such problems but after that don't know why sometimes on on random accounts by random pattern some questions stops to work. My account also is affected and I by use of Postman try to explain them that mentioned above questions to API don't work even if all looks correct on first look.

from huawei-sun2000-api-cli.

BlazejosP avatar BlazejosP commented on May 27, 2024

Is already a month since you asked Huawei support about this wrong answers of API on your account we are curious how goes dealing with them and If they repair this questions to API. So hope that now this software will working correctly? :)

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.