Solarlog Binding - "Invalid JSON when refreshing source" Error - PaperUI stays on "INITIALIZING"

Hello.
I have installed the solar-log binding today on a freshly updated OH 2.3.0 system.

I get the following Error message:
2018-07-31 14:45:37.031 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘Solar-log-Thing.things’
2018-07-31 14:45:37.466 [WARN ] [ing.solarlog.handler.SolarLogHandler] - Invalid JSON when refreshing source solarlog:meter:pv: {}
com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 12 path $
at com.google.gson.JsonParser.parse(JsonParser.java:65) ~[?:?]
at com.google.gson.JsonParser.parse(JsonParser.java:45) ~[?:?]
at org.openhab.binding.solarlog.handler.SolarLogHandler.refresh(SolarLogHandler.java:100) ~[?:?]
at org.openhab.binding.solarlog.handler.SolarLogHandler.lambda$0(SolarLogHandler.java:75) ~[?:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]
Caused by: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 12 path $
at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1559) ~[?:?]
at com.google.gson.stream.JsonReader.checkLenient(JsonReader.java:1401) ~[?:?]
at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:542) ~[?:?]
at com.google.gson.stream.JsonReader.peek(JsonReader.java:425) ~[?:?]
at com.google.gson.JsonParser.parse(JsonParser.java:60) ~[?:?]
… 10 more

PaperUI is the status “INITIALIZING”

Can somebody help me here, I am currently unable to fix it?

I created a thing following the manual using the text editor, and I got no syntax error message in the openhab.log file. I have pinged the solarlog with the url used in the things file and it works fine, I therefor assume that the connection is working.

I am running a solarlog1000 with the firmware 2.8.3., the solar log is not password protected.

Restart oH and use PaperUI.
PS: please use code fences.

I have stoped OH2 (sudo systemctl stop openhab2.service), removed the “.things”-file, restarted OH2 using systemctl start. I let the system stabilise after the startup and there were no solarlog related errors (the binding was still installed).

I went intp PaperUI and created the thing, and shortly after that the error message below appeared in the log (PaperUI still shows “INITIALIZING”):

<
2018-07-31 15:05:41.641 [WARN ] [ing.solarlog.handler.SolarLogHandler] - Invalid JSON when refreshing source solarlog:meter:332cbf54: {}
com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 12 path $
at com.google.gson.JsonParser.parse(JsonParser.java:65) ~[?:?]
at com.google.gson.JsonParser.parse(JsonParser.java:45) ~[?:?]
at org.openhab.binding.solarlog.handler.SolarLogHandler.refresh(SolarLogHandler.java:100) ~[?:?]
at org.openhab.binding.solarlog.handler.SolarLogHandler.lambda$0(SolarLogHandler.java:75) ~[?:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]
Caused by: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 12 path $
at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1559) ~[?:?]
at com.google.gson.stream.JsonReader.checkLenient(JsonReader.java:1401) ~[?:?]
at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:542) ~[?:?]
at com.google.gson.stream.JsonReader.peek(JsonReader.java:425) ~[?:?]
at com.google.gson.JsonParser.parse(JsonParser.java:60) ~[?:?]
… 10 more

What are fecs & how do I use them?

hc_376

I tried further steps:

  • changing the ID of the Thing in “things” file
    {
    Thing solarlog:meter:ed6e4575 “SolarLog 1000” @ “abc” [ url=“http://solarlog”, refreshInterval=15 ]
    }
  • creating an items fiel for the solarlog (it is also showing up in PaperUI)
  • Between each step I stoped and started OH2.3

The Warning Message stays the same. IN PaperUI the status of the things remains “initializing”

I look in the Internet for “Invalid JSON when refreshing source” and for “JsonSyntaxException”, but this way beyond my limited programming experience.

Does Anybody have any further ideas for things I could try?

I found this link

which is showing the below code lines:

Can anybody help me, what the “JsonSytnaxExeption” leading to the Warning Message could be?

You receive the error because the solarlog returns an empty response being {} technicaly this is valid JSON response but GSON (the json implementation we use) does not accept it by default.

Maybe you know why it would return an empty response, do you have no production? Or something else which could explain why it would return an empty response?

Thanks for the hint.

Maybe I need to have a look at the seetings of the solarlog. Maybe the API needs to be turned on.

I canot find any settings for the JSON in the solarlog configuration, although the manual says there should be settings.
Can anybody with a running solarlog let me know their firmware version. I will now update fro 2.8.3 to 2.8.4 on the solar log.

The firmware update didn’t help either. I tried every possibel option in the solar log menu without any success.It is starting to get frustrating …

If I find the time I might dig deeper into the json. Are there some simple test which I can start within Ubuntu or Windows to test the basic functionalities?

I’m trying to do something similar to you, Jasper. I have a LGate 101E that is running on my home network. I used the ip address of the device in place of the default http address. I do know that the device is using ModBus. I’m essentially bridged to the data that goes to my solar data logger company. I do know there is a API available on GitHub, but I’m trying to work on this first. I’m so new to openhab, that I know I’m not ready to create my own binding. I’ll show you what I’m getting in my log files:

2019-05-29 18:29:20.168 [WARN ] [log.internal.handler.SolarLogHandler] - Invalid JSON when refreshing source solarlog:meter:2371efea: {}

com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 25 path $

	at com.google.gson.JsonParser.parse(JsonParser.java:65) ~[?:?]

	at com.google.gson.JsonParser.parse(JsonParser.java:45) ~[?:?]

	at org.openhab.binding.solarlog.internal.handler.SolarLogHandler.refresh(SolarLogHandler.java:100) ~[?:?]

	at org.openhab.binding.solarlog.internal.handler.SolarLogHandler.lambda$0(SolarLogHandler.java:75) ~[?:?]

	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]

	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:?]

	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:?]

	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:?]

	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]

	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]

	at java.lang.Thread.run(Thread.java:748) [?:?]

Caused by: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 25 path $

	at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1559) ~[?:?]

	at com.google.gson.stream.JsonReader.checkLenient(JsonReader.java:1401) ~[?:?]

	at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:542) ~[?:?]

	at com.google.gson.stream.JsonReader.peek(JsonReader.java:425) ~[?:?]

	at com.google.gson.JsonParser.parse(JsonParser.java:60) ~[?:?]

	... 10 more

This is sloppy data handling by the binding. It’s naively taking a raw string pulled down from a URL and passing it directly to a JSON parser without doing any validation. Then it compounds the problem by issuing a useless warning and outputting a stack trace.

You should file a defect and ask that this be fixed.

That won’t solve your problem of getting empty data from your device, of course.

Thanks for the info. I’m trying to pull the data off the LGATE 101E located at power panel on the side of my house. I found the password online and I’m able to read it in real time using my browser. I’m kind of trying to geek out by recording the data and collecting it. I guess you can say I want to l learn at the same time. I think it is using MODBUS over IP. I’ve tried a few bindings, but with no luck. I did find my device and the company itself is on GitHub and it is open source.
They are saying that I can simulate a server on my computer and develop your application in that manner.
I’m really enjoying the learning process and have a thirst to know it all. I should of started programming years ago, but I never had the focus, which I can attribute to an ADHD problem I have, but anyways. I’m focused and loving Openhab.

I do have a RS-485 port available, so that is another way to go. That would require me to run another cable outside and get it to my pie. I’m thinking of converting over to a low energy Unix PC in order to take advantage of ports and computing power, but I’m in no rush.