martinville / solarsynkv2

Addon to integrate your Sunsynk account with home assistant.
MIT License
18 stars 10 forks source link

jq: error in log file #5

Closed themarktudor closed 5 months ago

themarktudor commented 8 months ago

@martinville Thanks for coding a really useful add on.

I am having a challenge though with the latest release (2.1.12) that I cannot seem to work out. The add on runs fine for about half the time and returns all the parameters of the inverter as expected. For the rest of the time it throws out an error in the log for all the staging .json files that it says it cannot open. There is no pattern to this that I can see other than it tends to come on and off relatively consistently throughout the day.

The refresh is set to 60 seconds that aligns to my SunSynk user settings.

Here is an excerpt from the log file.

/run.sh: line 110: [: ==: unary operator expected
jq: error: Could not open file batterydata.json: No such file or directory
/run.sh: line 111: [: ==: unary operator expected
jq: error: Could not open file batterydata.json: No such file or directory
/run.sh: line 112: [: ==: unary operator expected
jq: error: Could not open file batterydata.json: No such file or directory
/run.sh: line 113: [: ==: unary operator expected
jq: error: Could not open file batterydata.json: No such file or directory
/run.sh: line 114: [: ==: unary operator expected
jq: error: Could not open file batterydata.json: No such file or directory
/run.sh: line 115: [: ==: unary operator expected
jq: error: Could not open file batterydata.json: No such file or directory
/run.sh: line 117: [: ==: unary operator expected
jq: error: Could not open file batterydata.json: No such file or directory

It does this for all the json files like griddata.json, outputdata.json, loaddata.json, pvindata.json etc...

It carries on like this either working fine or writing out this error message.

Has this been seen before.

alz41 commented 8 months ago

Seeing the same thing here..

martinville commented 8 months ago

I have seen this issue before. Its because its trying to process data which it never received. Usually caused due to not being able to connect to the sunsynk server. In the last month Sunsynk had multiple downtimes. Which is highly frustrating.

This is how it works.

  1. It will connect and get data and then save to the various json files.
  2. Read the json files and extract the values.
  3. Publish values to home asisstant entities
  4. Delete the json files

If it fails at the first step it will continue to try and read files that do not exist. Further more it will try and process value that was not read from the json files and create more errors.

The solution is to the errors are to simply halt when files were not able to be generated in the first place. That will not solve the real problem however.

When I have more time I guess I could look at better error control.

martinville commented 8 months ago

For Piece of mind. Right now I also have the same problem. So does everyone else who use this addon aswell as anyone who is using the the sunsynk app.

If you log into the portal ,go to gateway and look at the last seen date stamp you will see that Sunsynk is down. My date stamp reads last seen 2024-03-25 23:53:06

jq: error: Could not open file batterydata.json: No such file or directory /run.sh: line 114: [: ==: unary operator expected jq: error: Could not open file batterydata.json: No such file or directory /run.sh: line 115: [: ==: unary operator expected jq: error: Could not open file batterydata.json: No such file or directory /run.sh: line 116: [: ==: unary operator expected jq: error: Could not open file batterydata.json: No such file or directory /run.sh: line 117: [: ==: unary operator expected jq: error: Could not open file batterydata.json: No such file or directory /run.sh: line 118: [: ==: unary operator expected jq: error: Could not open file batterydata.json: No such file or directory /run.sh: line 119: [: ==: unary operator expected jq: error: Could not open file batterydata.json: No such file or directory /run.sh: line 121: [: ==: unary operator expected jq: error: Could not open file batterydata.json: No such file or directory /run.sh: line 122: [: ==: unary operator expected jq: error: Could not open file batterydata.json: No such file or directory /run.sh: line 123: [: ==: unary operator expected jq: error: Could not open file batterydata.json: No such file or directory /run.sh: line 124: [: ==: unary operator expected jq: error: Could not open file batterydata.json: No such file or directory /run.sh: line 125: [: ==: unary operator expected jq: error: Could not open file batterydata.json: No such file or directory /run.sh: line 126: [: ==: unary operator expected jq: error: Could not open file batterydata.json: No such file or directory /run.sh: line 129: [: ==: unary operator expected jq: error: Could not open file batterydata.json: No such file or directory /run.sh: line 130: [: ==: unary operator expected jq: error: Could not open file griddata.json: No such file or directory /run.sh: line 131: [: ==: unary operator expected jq: error: Could not open file griddata.json: No such file or directory /run.sh: line 132: [: ==: unary operator

themarktudor commented 8 months ago

Would it be workable solution to insert an offset in seconds into the configuration that could be adjusted based on the reliability of the SunSynk service. The null values in the sensors is what causes the challenges for me. Clearly also the fact that the values would be slightly old is not ideal, but that is the nature of the service that they are currently providing. From what I understand a call to a slightly older timestamp would return a valid dataset.

ElectricMolehill commented 8 months ago

It also causes the input helper to be cleared without updating the inverter. If the cycle fails to connect, would it be possible to leave the helper populated so that the command can be executed next time?

martinville commented 7 months ago

I have now updated the script to exit to the end of the loop so that when there are any sort of connection errors it will not attempt to update any entities, neither will it clear the helper entity.

I also unfortunately had to add the -k option to curl so that it will ignore certificate errors. Since SunSynk changed certificates Curl cannot verify the validity of the certificate on a random basis.

If you update your add-on now it will resolve most if not all of the issues.

octotheoli commented 7 months ago

I have updated the add-on (v2.1.12?) and I still face the same issues.

martinville commented 7 months ago

Perhaps the update did not go through ? the latest version is 2.1.13