ha-bridge: Manually added devices throw syntax error

I’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

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 22 (8 by maintainers)

Most upvoted 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