[SOLVED] HarmonyHub: NPE when starting activity

Tags: #<Tag:0x00007f434aef1160> #<Tag:0x00007f434aef0c38>

I am unable to start harmony activities from openHAB after upgrading to 2.4.0.M4.

2018-10-04 20:20:22.131 [ome.event.ItemCommandEvent] - Item 'SZHub_Activity' received command Kodi

2018-10-04 20:20:22.139 [nt.ItemStatePredictedEvent] - SZHub_Activity predicted to become NULL

==> /var/log/openhab2/openhab.log <==

2018-10-04 20:20:22.141 [ERROR] [b.internal.handler.HarmonyHubHandler] - Could not start activity

java.lang.NullPointerException: null

	at net.whistlingfish.harmony.protocol.OAReplyFilter.<init>(OAReplyFilter.java:30) ~[234:org.openhab.binding.harmonyhub:2.4.0.M4]

	at net.whistlingfish.harmony.HarmonyClient.sendOAStanza(HarmonyClient.java:336) ~[234:org.openhab.binding.harmonyhub:2.4.0.M4]

	at net.whistlingfish.harmony.HarmonyClient.sendOAStanza(HarmonyClient.java:331) ~[234:org.openhab.binding.harmonyhub:2.4.0.M4]

	at net.whistlingfish.harmony.HarmonyClient.getConfig(HarmonyClient.java:390) ~[234:org.openhab.binding.harmonyhub:2.4.0.M4]

	at net.whistlingfish.harmony.HarmonyClient.startActivityByName(HarmonyClient.java:443) ~[234:org.openhab.binding.harmonyhub:2.4.0.M4]

	at org.openhab.binding.harmonyhub.internal.handler.HarmonyHubHandler.handleCommand(HarmonyHubHandler.java:122) [234:org.openhab.binding.harmonyhub:2.4.0.M4]

	at sun.reflect.GeneratedMethodAccessor204.invoke(Unknown Source) ~[?:?]

	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]

	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]

	at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [101:org.eclipse.smarthome.core:0.10.0.oh240M4]

	at org.eclipse.smarthome.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [101:org.eclipse.smarthome.core:0.10.0.oh240M4]

	at com.sun.proxy.$Proxy141.handleCommand(Unknown Source) [234:org.openhab.binding.harmonyhub:2.4.0.M4]

	at org.eclipse.smarthome.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:75) [107:org.eclipse.smarthome.core.thing:0.10.0.oh240M4]

	at org.eclipse.smarthome.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:49) [107:org.eclipse.smarthome.core.thing:0.10.0.oh240M4]

	at sun.reflect.GeneratedMethodAccessor202.invoke(Unknown Source) ~[?:?]

	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]

	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]

	at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [101:org.eclipse.smarthome.core:0.10.0.oh240M4]

	at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [101:org.eclipse.smarthome.core:0.10.0.oh240M4]

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

Do you have rules that are being triggered by state update if so change the rule to be triggered by the command.

If needing triggeringItem.state in rules then read up on using receivedCommand
Here

Hmm. The harmony hub binding does not work, it’s not my rules not working.
The NPE is triggered by changing the current activity not the other way round.

Here is the rule:

rule "szkodi start"
when 
   Item SZKodi_volume changed
then
    logInfo(logger,"szkodi: start")
	if (SZHub_Activity.state.toString == "Kodi") 
	{
		return
	}	
	logInfo(logger,"szkodi: Starting Kodi")
	SZHub_Activity.sendCommand("Kodi")
end   

Did you try clearing the cache?

Yes, i did.

If this clearing the cache is always a problem, this should be included in the standard update procedure.

@vzorglub, can you start an activity at the harmony hub with openHAB >= 2.4.0.M4?

I do not have an harmony hub.
Then try removing the binding.
Stop and restart openHAB
Install the binding back

Found the problem.
The binding still works correctly, it was just my HarmonyHub changed its IP address.

After correcting the ip adress problem everything works again.

Sorry for the inconvenience.

Did you set up fixed IP addresses in your router?
I highly recommend that you do that
It will be in the DHCP settings

Yes, i have fixed adresses.

I am running dnsmasq on a separate host, but this time the hub didn’t get the assigned address, but one from the free pool. Not sure why, maybe something was not working or wrongly configured when the hub took the address a few days ago.