bwssytems / ha-bridge

Home automation bridge that emulates a Philips Hue light system and can control other systems such as a Vera, Harmony Hub, Nest, MiLight bulbs or any other system that has an http/https/tcp/udp interface. This is a compact impl to run on small format computers. This is impl started from this project https://github.com/armzilla/amazon-echo-ha-bridge.
Apache License 2.0
1.45k stars 199 forks source link

When switching FHEM Devices: ERROR spark.http.matching.GeneralError - java.lang.UnsupportedOperationException: JsonObject #1029

Closed HWE70 closed 5 years ago

HWE70 commented 5 years ago

When configuring FHEM device manually as HTTP Devices everything works well. When trying to use the automatically created FHEM device the URL is replaced by a JSON Object, e.g.

{"url":"http://192.168.2.42:8088/fhem?cmd=set%20Licht_Gartenhaus%20","command":"on"}

The JSON object ist valid, but when trying to switch the device the above error occurs. spark.http.matching and com.bwssystems.HABridge.plugins.fhem are set to DEBUG but without any additional information.

I use the raspi docker version 5.2.1 of HA Bridge.

Log: 2018-12-11 23:08:56,588 [qtp22247559-20] ERROR spark.http.matching.GeneralError - java.lang.UnsupportedOperationException: JsonObject at com.google.gson.JsonElement.getAsString(JsonElement.java:191) at com.bwssystems.HABridge.plugins.fhem.FHEMHome.deviceHandler(FHEMHome.java:50) at com.bwssystems.HABridge.hue.HueMulator.callUrl(HueMulator.java:1465) at com.bwssystems.HABridge.hue.HueMulator.changeState(HueMulator.java:1220) at com.bwssystems.HABridge.hue.HueMulator.lambda$39(HueMulator.java:444) at com.bwssystems.HABridge.hue.HueMulator$$Lambda$124/27315945.handle(Unknown Source) at spark.RouteImpl$1.handle(RouteImpl.java:72) at spark.http.matching.Routes.execute(Routes.java:61) at spark.http.matching.MatcherFilter.doFilter(MatcherFilter.java:130) at spark.embeddedserver.jetty.JettyHandler.doHandle(JettyHandler.java:50) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1568) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) at org.eclipse.jetty.server.Server.handle(Server.java:564) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:317) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110) at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124) at org.eclipse.jetty.util.thread.Invocable.invokePreferred(Invocable.java:128) at org.eclipse.jetty.util.thread.Invocable$InvocableExecutor.invoke(Invocable.java:222) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:294) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:199) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:673) at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:591) at java.lang.Thread.run(Thread.java:745)

bwssytems commented 5 years ago

will take a look

HWE70 commented 5 years ago

By the way same issue with 5.2.2RC

HWE70 commented 5 years ago

Just figured out, that I can create devices in HA-Bridge using a REST API. That's perfect, as I have to rewrite the device names I used in FHEM a little to make them more easily usable for Alexa. Thus I just wrote a litte sync script which sychronizes the FHEM switches with HA-Bridge and on the fly rewrites the devices names for Alexa. As I create simple httpDevices instead of FHEMdevices, HA-Bridge works fine for me now. So the bug I raised is not really critical for me any longer. However for other fixing it might still be important.