[SOLVED] Horizon Media Box binding under OpenHab 2.0

Hi all,

is there anybody who can help me use the Horizon Media Box binding under Openhab 2.0?

I am getting “java.lang.NullPointerException: null” when the power item receives a command.


(I renamed power to Video_power after this snapshot)

2018-12-30 17:59:02.201 [vent.ItemStateChangedEvent] - Video_power changed from OFF to ON

2018-12-30 18:02:12.629 [ome.event.ItemCommandEvent] - Item 'Video_power' received command OFF

2018-12-30 18:02:12.675 [WARN ] [org.apache.karaf.services.eventadmin] - EventAdmin: Exception during event dispatch [org.osgi.service.event.Event [topic=openhab/command/Video_power] {item=Video_power, bridgemarker=true, command=OFF, timestamp=1546189332582} | {org.osgi.service.event.EventHandler}={service.id=357, service.bundleid=207, service.scope=bundle, event.topics=openhab/command/*, livingroom.host=, service.pid=org.openhab.horizon, component.name=org.openhab.binding.horizon.binding, component.id=209} | Bundle(org.openhab.binding.horizon_1.13.0 [207])]

java.lang.NullPointerException: null

at org.openhab.binding.horizon.internal.HorizonBinding.internalReceiveCommand(HorizonBinding.java:94) ~[?:?]

at org.openhab.core.binding.AbstractBinding.receiveCommand(AbstractBinding.java:94) ~[?:?]

at org.openhab.core.events.AbstractEventSubscriber.handleEvent(AbstractEventSubscriber.java:45) ~[?:?]

at org.apache.felix.eventadmin.impl.handler.EventHandlerProxy.sendEvent(EventHandlerProxy.java:415) [3:org.apache.karaf.services.eventadmin:4.2.1]

at org.apache.felix.eventadmin.impl.tasks.HandlerTask.runWithoutBlacklistTiming(HandlerTask.java:82) [3:org.apache.karaf.services.eventadmin:4.2.1]

at org.apache.felix.eventadmin.impl.tasks.SyncDeliverTasks.execute(SyncDeliverTasks.java:104) [3:org.apache.karaf.services.eventadmin:4.2.1]

at org.apache.felix.eventadmin.impl.tasks.AsyncDeliverTasks$TaskExecuter.run(AsyncDeliverTasks.java:166) [3:org.apache.karaf.services.eventadmin:4.2.1]

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

at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]

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) [?:?]

2018-12-30 18:02:13.459 [WARN ] [io.openhabcloud.internal.CloudClient] - Jetty request 3207939 failed: null

2018-12-30 18:02:13.539 [WARN ] [io.openhabcloud.internal.CloudClient] - Response Failure: null

Please avoid posting screenshots of code and use code fences instead as well as for logs.

The error is coming straight from the binding so I think ultimately you will have to file an issue on the openhab1-addons github project.

Are you really using OH 2.0? That is a two year old release. Before you file an issue, you need to upgrade to OH 2.5 M1 and see if the error persists. No one will be able to diagnose or fix a problem with a release that old. And the problem may already be fixed.

Hi Rich,

sorry I meant Openhab 2 in general. I only just recently installed Openhabian so I am sure I am running the latest stable version.


What is in your horizon.cfg?

My horizon.cfg is set up exactly as described in the binding manual:

horizon:livingroom.host= <ip>

In the log I can see that

Video_power changed from OFF to ON

when I start the box.

But the first active command triggers the nullpointer error.

Shouldn’t it be:

livingroom.host= <ip>

Of course.

Sorry C&P error.

livingroom.host= <ip>

As in you do this via openHAB or on the device itself?

What command are you sending?

When I start the device via its power switch.

I change the switch “Video_power” to OFF via the corresponding switch item on the Sitemap or Alexa command.
Both triggers the Nullpointer.

Ok, I think I found it. (I’m not very familiar with v1 bindings) It is a bug it throws an null pointer, would be nicer to have a useful message. In this v1 binding you need to configure all states you want to send. So you also need to specify the OFF state. You need to change the horizon part to:

1 Like

I am a complete newbie to all of this.
What you say sounds like a plan and I will try it.

In case it works it might be worthwhile updating the binding documentation as it only details the ON definition. How can this be triggered?

Oeps I mean I’m not very familiar with v1 bindings :smile:

For the documentation the quickest way is to go to the binding documentation page: https://www.openhab.org/addons/bindings/horizon1/ At the bottom there is a link Edit this page on Github. If you go their you can change the documentation. When you save it will ask to create a pull request. If you do that it the pull request will be created in the main repository were it will be reviewed and then included (merged).

No, you are indeed as your patch is working perfectly fine :wink:

“Alexa, good night!” and she now switches off my TV (worked before) and my Horizon box.
This is beyond my wildest dreams :grin:

I will trigger a documentation update.