Manually added devices throw syntax error
See original GitHub issueI’m using the latest release (3.5.1).
I’ve just setup a new user, and added a systemctl service for ha-bridge.
I added my first device:
{
"id":"1",
"uniqueid":"00:17:88:5E:D3:01-01",
"name":"Living Room Light",
"deviceType":"exec",
"targetDevice":"Encapsulated",
"offUrl":"echo \"rf p5 off\" | nc localhost 1099",
"dimUrl":"echo \"rf p5 xdim ${intensity.percent}\" | nc localhost 1099",
"onUrl":"echo \"rf p5 on\" | nc localhost 1099"
}
If I tell my Home to turn on that device, nothing happens.
When I click any test buttons - e.g “Test ON” - in the web console, I get an alert:
SyntaxError: Unexpected token < in JSON at position 0
I get a similar error if I do a PUT
to the api interface:
Unexpected ‘<’
In all cases, the log only shows:
ERROR spark.webserver.MatcherFilter
What’s going on?
EDIT:
Server stack trace:
2016-11-23 20:39:20,382 [qtp1382067100-16] ERROR spark.webserver.MatcherFilter -
com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Unterminated object at line 1 column 18 path $[0].item
at com.google.gson.Gson.fromJson(Gson.java:894)
at com.google.gson.Gson.fromJson(Gson.java:844)
at com.google.gson.Gson.fromJson(Gson.java:793)
at com.google.gson.Gson.fromJson(Gson.java:765)
at com.bwssystems.HABridge.hue.HueMulator.lambda$19(HueMulator.java:916)
at spark.RouteImpl$1.handle(RouteImpl.java:58)
at spark.webserver.MatcherFilter.doFilter(MatcherFilter.java:162)
at spark.webserver.JettyHandler.doHandle(JettyHandler.java:61)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:189)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:119)
at org.eclipse.jetty.server.Server.handle(Server.java:517)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:302)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:242)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:245)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:75)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:213)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:147)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.google.gson.stream.MalformedJsonException: Unterminated object at line 1 column 18 path $[0].item
at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1567)
at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:495)
at com.google.gson.stream.JsonReader.hasNext(JsonReader.java:418)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:210)
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:40)
at com.google.gson.internal.bind.ArrayTypeAdapter.read(ArrayTypeAdapter.java:72)
at com.google.gson.Gson.fromJson(Gson.java:879)
... 22 common frames omitted
Issue Analytics
- State:
- Created 7 years ago
- Comments:22 (8 by maintainers)
Top Results From Across the Web
how to manually throw a syntax error in javascript
how to manually throw a syntax error in javascript - Stack Overflow. Stack Overflow for Teams – Start collaborating and sharing organizational ...
Read more >How to Throw Exceptions in Java - Rollbar
Throwing an exception is as simple as using the "throw" statement. You then specify the Exception object you wish to throw. Every Exception...
Read more >throw - JavaScript - MDN Web Docs - Mozilla
The throw statement throws a user-defined exception. Execution of the current function will stop (the statements after throw won't be executed), ...
Read more >A Definitive Guide to Handling Errors in JavaScript - Kinsta
Here is how you can handle errors in JavaScript. Manually Throw and Catch Errors. The most fundamental way of handling errors that have...
Read more >Troubleshooting - Unity - Manual
The Package Manager displays error indicators in the Package Manager window ... and manually start it now ssh-add <your-secure-ssh-key-name>.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The issue is with the current handling of JSON within JSON. The next version, 4.0.0 will handle this properly. The OP had problems with trying to run commands that are script commands on a command line. Open up a new issue with problem please. Thanks
@pr3sidentspence Sorry, that is not in 3.5.1. make sure the map type is blank and the device type is TCP and that will work.