Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[myq] JsonSyntaxException during login breaks binding operation #13181

Closed
tlendacky opened this issue Jul 27, 2022 · 4 comments · Fixed by #13189
Closed

[myq] JsonSyntaxException during login breaks binding operation #13181

tlendacky opened this issue Jul 27, 2022 · 4 comments · Fixed by #13189
Assignees
Labels
bug An unexpected problem or unintended behavior of an add-on

Comments

@tlendacky
Copy link

Expected Behavior

Any exception processing a login should be caught so that the binding can retry later and continue working.

Current Behavior

Sometimes a login will return information that results in a JsonSyntaxException:

com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:226) ~[?:?]
        at com.google.gson.Gson.fromJson(Gson.java:932) ~[?:?]
        at com.google.gson.Gson.fromJson(Gson.java:897) ~[?:?]
        at com.google.gson.Gson.fromJson(Gson.java:846) ~[?:?]
        at com.google.gson.Gson.fromJson(Gson.java:817) ~[?:?]
        at org.openhab.binding.myq.internal.handler.MyQAccountHandler.login(MyQAccountHandler.java:345) ~[?:?]
        at org.openhab.binding.myq.internal.handler.MyQAccountHandler.sendRequest(MyQAccountHandler.java:405) ~[?:?]
        at org.openhab.binding.myq.internal.handler.MyQAccountHandler.getAccounts(MyQAccountHandler.java:357) ~[?:?]
        at org.openhab.binding.myq.internal.handler.MyQAccountHandler.fetchData(MyQAccountHandler.java:285) ~[?:?]
        at org.openhab.binding.myq.internal.handler.MyQAccountHandler.normalPoll(MyQAccountHandler.java:275) ~[?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[?:?]
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) ~[?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
        at java.lang.Thread.run(Thread.java:829) [?:?]

Once this occurs, I have to restart openhab in order for the MyQ binding to function again.

Possible Solution

Catch the JsonSyntaxException that can be thrown by fromJson() in the login() function of MyQAccountHandler.java and return a MyQCommunicationException()?

Steps to Reproduce (for Bugs)

  1. I can't reliably reproduce this, just every now and then the MyQ servers will return data from a login() that causes this.

Context

It isn't always noticeable that this issue has occurred until you notice that MyQ says your garage doors are closed when they are really open, etc.

Your Environment

  • Version used: (e.g., openHAB and add-on versions): 3.2.0-1
  • Environment name and version (e.g. Chrome 76, Java 8, Node.js 12.9, ...): Java 11
  • Operating System and version (desktop or mobile, Windows 10, Raspbian Buster, ...): Ubuntu 20.04
@tlendacky tlendacky added the bug An unexpected problem or unintended behavior of an add-on label Jul 27, 2022
@digitaldan digitaldan self-assigned this Jul 27, 2022
@digitaldan
Copy link
Contributor

I think i have seen this as well and will take a look, thanks.

@Moxified
Copy link

I have also been experiencing this issue. Disabling the bridge multiple times often brings it back or a restart of OH as previously mentioned.

digitaldan added a commit to digitaldan/openhab-addons that referenced this issue Jul 29, 2022
Fixes openhab#13181

Signed-off-by: Dan Cunningham <dan@digitaldan.com>
lolodomo pushed a commit that referenced this issue Jul 29, 2022
Fixes #13181

Signed-off-by: Dan Cunningham <dan@digitaldan.com>
@tlendacky
Copy link
Author

Thanks, Dan, I'll give this a try.

@openhab-bot
Copy link
Collaborator

This issue has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/chamberlain-myq-binding/4192/828

leifbladt pushed a commit to leifbladt/openhab-addons that referenced this issue Oct 15, 2022
Fixes openhab#13181

Signed-off-by: Dan Cunningham <dan@digitaldan.com>
andan67 pushed a commit to andan67/openhab-addons that referenced this issue Nov 6, 2022
Fixes openhab#13181

Signed-off-by: Dan Cunningham <dan@digitaldan.com>
andrasU pushed a commit to andrasU/openhab-addons that referenced this issue Nov 12, 2022
Fixes openhab#13181

Signed-off-by: Dan Cunningham <dan@digitaldan.com>
Signed-off-by: Andras Uhrin <andras.uhrin@gmail.com>
psmedley pushed a commit to psmedley/openhab-addons that referenced this issue Feb 23, 2023
Fixes openhab#13181

Signed-off-by: Dan Cunningham <dan@digitaldan.com>
nemerdaud pushed a commit to nemerdaud/openhab-addons that referenced this issue Feb 28, 2023
Fixes openhab#13181

Signed-off-by: Dan Cunningham <dan@digitaldan.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of an add-on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants