Harmony Hub activityStarting?

Has anyone using this binding had any success using the activityStarting trigger? I’ve tried the sample rule found here to no avail.

All that seems to work is the currentActivity channel. I can’t get either the activityStarting or activityStarted triggers to work.

I’m guessing the channels may not be setting up correctly but I don’t know how to confirm that. I see no obvious errors in the log even with DEBUG mode turned on.

Any help would be greatly appreciated.

Yes, works fine, just tried it (did not even know this triggers exists).

29-Sep-2017 13:45:17.166 [INFO ] [org.eclipse.smarthome.model.script.EXTRA          ] - HARMONY: Hub is going off...
29-Sep-2017 13:46:05.225 [INFO ] [org.eclipse.smarthome.model.script.EXTRA          ] - HARMONY: TV is starting...
29-Sep-2017 13:46:27.084 [INFO ] [org.eclipse.smarthome.model.script.EXTRA          ] - HARMONY: TV is started
29-Sep-2017 13:47:15.551 [INFO ] [org.eclipse.smarthome.model.script.EXTRA          ] - HARMONY: Hub is going off...

rules:

rule "Starting TV"
when
    Channel "harmonyhub:hub:HarmonyWZ:activityStarting" triggered TV_mit_Bose
then
    logInfo("EXTRA", "HARMONY: TV is starting...")
end

rule "TV started"
when
    Channel "harmonyhub:hub:HarmonyWZ:activityStarted" triggered TV_mit_Bose
then
    logInfo("EXTRA", "HARMONY: TV is started")
end

rule "Going off"
when
    Channel "harmonyhub:hub:HarmonyWZ:activityStarting" triggered PowerOff
then
    logInfo("EXTRA", "HARMONY: Hub is going off...")
end

rule "Hub off"
when
    Channel "harmonyhub:hub:HarmonyWZ:activityStarted" triggered PowerOff
then
    logInfo("EXTRA", "HARMONY: Hub is off - no activity")
end

Note that if you have spaces in your Harmony sketch name you have to escape them with underscores:

TV mit Bose from Harmony hub becomes
TV_mit_Bose in your rule.

Thanks for verifying that it works for you.

I’m using the underscores and also testing with the basic rules as per the docs example.

Could you please check your HarmonyHub thing configuration screen and see if it matches mine? Are the two triggers just represented with the gray circled H or are they the blue circled “switch” like the currentActivity channel?

The funny thing is, those are not shown at all in my setup:

I’m on snapshot 2.2 build #1050, harmony binding is

208 │ Active │ 80 │ 2.2.0.201709272129 │ HarmonyHub Binding

I can’t remember any new system settings which could cause this …

I’m currently running snapshot 2.2 build #1054 and the harmony binding is:

205 │ Active │ 80 │ 2.2.0.201709301515 │ HarmonyHub Binding

I’ve been trying to get this working since build #1047 and various binding versions and nothing seems to change between versions.

When I start the system I can clearly see the harmony initializing with only one strange entry, BundleEvent [unknown:512], as seen below.

2017-09-30 20:34:34.114 [DEBUG] [org.openhab.binding.harmonyhub      ] - BundleEvent INSTALLED - org.openhab.binding.harmonyhub
2017-09-30 20:34:34.256 [DEBUG] [org.openhab.binding.harmonyhub      ] - BundleEvent RESOLVED - org.openhab.binding.harmonyhub
2017-09-30 20:34:34.521 [INFO ] [ternal.dhcp.DHCPPacketListenerServer] - DHCP request packet listener online
2017-09-30 20:34:34.530 [DEBUG] [org.openhab.binding.harmonyhub      ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.core.thing.binding.ThingHandlerFactory, org.eclipse.smarthome.core.thing.type.ChannelTypeProvider}={component.name=binding.harmonyhub, component.id=163, service.id=290, service.bundleid=205, service.scope=bundle} - org.openhab.binding.harmonyhub
2017-09-30 20:34:34.531 [DEBUG] [org.openhab.binding.harmonyhub      ] - BundleEvent STARTING - org.openhab.binding.harmonyhub
2017-09-30 20:34:34.532 [DEBUG] [org.openhab.binding.harmonyhub      ] - BundleEvent STARTED - org.openhab.binding.harmonyhub
2017-09-30 20:34:34.544 [INFO ] [b.core.service.AbstractActiveService] - HTTP Refresh Service has been started
2017-09-30 20:34:34.547 [DEBUG] [org.openhab.binding.harmonyhub      ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.config.discovery.DiscoveryService}={component.name=org.openhab.binding.harmonyhub.internal.discovery, component.id=164, service.id=291, service.bundleid=205, service.scope=bundle} - org.openhab.binding.harmonyhub
2017-09-30 20:34:34.551 [DEBUG] [covery.HarmonyDeviceDiscoveryService] - HarmonyDeviceDiscoveryService org.openhab.binding.harmonyhub.handler.HarmonyHubHandler@1f0186b1
2017-09-30 20:34:34.551 [DEBUG] [discovery.HarmonyHubDiscoveryService] - Start Harmony Hub background discovery
2017-09-30 20:34:34.551 [DEBUG] [org.openhab.binding.harmonyhub      ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.config.discovery.DiscoveryService}={service.id=292, service.bundleid=205, service.scope=singleton} - org.openhab.binding.harmonyhub
2017-09-30 20:34:34.552 [DEBUG] [discovery.HarmonyHubDiscoveryService] - Start Scan
2017-09-30 20:34:34.553 [DEBUG] [org.openhab.binding.harmonyhub      ] - BundleEvent [unknown:512] - org.openhab.binding.harmonyhub
2017-09-30 20:34:34.553 [DEBUG] [discovery.HarmonyHubDiscoveryService] - StartScan called
2017-09-30 20:34:34.553 [DEBUG] [discovery.HarmonyHubDiscoveryService] - Creating Harmony server on port 35119

Oh well, thanks again for your help!

Did you do a bundle:list or a bundle:list |grep -i harmony on the karaf console to see if there are any old harmony bindings still installed?
You could also try feature:list|grep -i harmony, that should look like:

feature:list|grep -i harmony
openhab-binding-harmonyhub                  │ 2.2.0.SNAPSHOT   │ x        │ Started     │ addons-2.2.0-SNAPSHOT   │ Harmony Hub Binding

I did ’ bundle:list | grep -i harmony’.

I tried the feature:list you recommended and received the same result as you.

I did stumble across an error in the log after I tried to rename the HarmonyHub thing to HarmonyMain. I get the following error in the log after saving the change:

2017-09-30 21:05:16.772 [ERROR] [ome.core.thing.internal.ThingManager] - Exception occurred while calling thing updated at ThingHandler 'org.openhab.binding.harmonyhub.handler.HarmonyHubHandler@692c1f4': null
java.util.concurrent.TimeoutException: null
        at java.util.concurrent.FutureTask.get(FutureTask.java:205) [?:?]
        at org.eclipse.smarthome.core.common.SafeMethodCaller.callAsynchronous(SafeMethodCaller.java:194) [98:org.eclipse.smarthome.core:0.9.0.201709260841]
        at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:83) [98:org.eclipse.smarthome.core:0.9.0.201709260841]
        at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:67) [98:org.eclipse.smarthome.core:0.9.0.201709260841]
        at org.eclipse.smarthome.core.thing.internal.ThingManager.thingUpdated(ThingManager.java:423) [105:org.eclipse.smarthome.core.thing:0.9.0.201709260841]
        at org.eclipse.smarthome.core.thing.internal.ThingRegistryImpl.notifyTrackers(ThingRegistryImpl.java:217) [105:org.eclipse.smarthome.core.thing:0.9.0.201709260841]
        at org.eclipse.smarthome.core.thing.internal.ThingRegistryImpl.notifyListenersAboutUpdatedElement(ThingRegistryImpl.java:140) [105:org.eclipse.smarthome.core.thing:0.9.0.201709260841]
        at org.eclipse.smarthome.core.thing.internal.ThingRegistryImpl.notifyListenersAboutUpdatedElement(ThingRegistryImpl.java:1) [105:org.eclipse.smarthome.core.thing:0.9.0.201709260841]
        at org.eclipse.smarthome.core.common.registry.AbstractRegistry.updated(AbstractRegistry.java:183) [98:org.eclipse.smarthome.core:0.9.0.201709260841]
        at org.eclipse.smarthome.core.common.registry.AbstractRegistry.updated(AbstractRegistry.java:1) [98:org.eclipse.smarthome.core:0.9.0.201709260841]
        at org.eclipse.smarthome.core.common.registry.AbstractProvider.notifyListeners(AbstractProvider.java:57) [98:org.eclipse.smarthome.core:0.9.0.201709260841]
        at org.eclipse.smarthome.core.common.registry.AbstractProvider.notifyListenersAboutUpdatedElement(AbstractProvider.java:81) [98:org.eclipse.smarthome.core:0.9.0.201709260841]
        at org.eclipse.smarthome.core.common.registry.AbstractManagedProvider.update(AbstractManagedProvider.java:126) [98:org.eclipse.smarthome.core:0.9.0.201709260841]
        at org.eclipse.smarthome.io.rest.core.internal.thing.ThingResource.update(ThingResource.java:347) [115:org.eclipse.smarthome.io.rest.core:0.9.0.201709260841]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
        at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81) [158:org.glassfish.jersey.core.jersey-server:2.22.2]
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144) [158:org.glassfish.jersey.core.jersey-server:2.22.2]
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161) [158:org.glassfish.jersey.core.jersey-server:2.22.2]
        at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:160) [158:org.glassfish.jersey.core.jersey-server:2.22.2]
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99) [158:org.glassfish.jersey.core.jersey-server:2.22.2]
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389) [158:org.glassfish.jersey.core.jersey-server:2.22.2]
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347) [158:org.glassfish.jersey.core.jersey-server:2.22.2]
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102) [158:org.glassfish.jersey.core.jersey-server:2.22.2]
        at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326) [158:org.glassfish.jersey.core.jersey-server:2.22.2]
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) [157:org.glassfish.jersey.core.jersey-common:2.22.2]
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) [157:org.glassfish.jersey.core.jersey-common:2.22.2]
        at org.glassfish.jersey.internal.Errors.process(Errors.java:315) [157:org.glassfish.jersey.core.jersey-common:2.22.2]
        at org.glassfish.jersey.internal.Errors.process(Errors.java:297) [157:org.glassfish.jersey.core.jersey-common:2.22.2]
        at org.glassfish.jersey.internal.Errors.process(Errors.java:267) [157:org.glassfish.jersey.core.jersey-common:2.22.2]
        at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317) [157:org.glassfish.jersey.core.jersey-common:2.22.2]
        at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305) [158:org.glassfish.jersey.core.jersey-server:2.22.2]
        at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154) [158:org.glassfish.jersey.core.jersey-server:2.22.2]
        at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473) [155:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
        at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427) [155:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
        at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388) [155:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
        at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341) [155:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
        at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228) [155:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
        at com.eclipsesource.jaxrs.publisher.internal.ServletContainerBridge.service(ServletContainerBridge.java:76) [15:com.eclipsesource.jaxrs.publisher:5.3.1.201602281253]
        at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:845) [85:org.eclipse.jetty.servlet:9.3.14.v20161028]
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:584) [85:org.eclipse.jetty.servlet:9.3.14.v20161028]
        at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71) [171:org.ops4j.pax.web.pax-web-jetty:6.0.6]
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) [84:org.eclipse.jetty.server:9.3.14.v20161028]
        at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548) [82:org.eclipse.jetty.security:9.3.14.v20161028]
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226) [84:org.eclipse.jetty.server:9.3.14.v20161028]
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180) [84:org.eclipse.jetty.server:9.3.14.v20161028]
        at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:284) [171:org.ops4j.pax.web.pax-web-jetty:6.0.6]
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512) [85:org.eclipse.jetty.servlet:9.3.14.v20161028]
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) [84:org.eclipse.jetty.server:9.3.14.v20161028]
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112) [84:org.eclipse.jetty.server:9.3.14.v20161028]
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [84:org.eclipse.jetty.server:9.3.14.v20161028]
        at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80) [171:org.ops4j.pax.web.pax-web-jetty:6.0.6]
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134) [84:org.eclipse.jetty.server:9.3.14.v20161028]
        at org.eclipse.jetty.server.Server.handle(Server.java:534) [84:org.eclipse.jetty.server:9.3.14.v20161028]
        at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320) [84:org.eclipse.jetty.server:9.3.14.v20161028]
        at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251) [84:org.eclipse.jetty.server:9.3.14.v20161028]
        at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273) [76:org.eclipse.jetty.io:9.3.14.v20161028]
        at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95) [76:org.eclipse.jetty.io:9.3.14.v20161028]
        at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93) [76:org.eclipse.jetty.io:9.3.14.v20161028]
        at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303) [87:org.eclipse.jetty.util:9.3.14.v20161028]
        at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148) [87:org.eclipse.jetty.util:9.3.14.v20161028]
        at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136) [87:org.eclipse.jetty.util:9.3.14.v20161028]
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671) [87:org.eclipse.jetty.util:9.3.14.v20161028]
        at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589) [87:org.eclipse.jetty.util:9.3.14.v20161028]
        at java.lang.Thread.run(Thread.java:748) [?:?]

Then I noticed the thing name is out of sync with the Channels in the PaperUI. The name is displayed as:

HarmonyHub HarmonyMain
while the channels still display:

harmonyhub:hub:HarmonyHub:activityStarting
harmonyhub:hub:HarmonyHub:activityStarted
harmonyhub:hub:HarmonyHub:currentActivity

Next time I work on this I’m going to have to delete the things and binding and start from scratch again.

Yes, that is a bit strange.
I have no idea what could cause this. Maybe a missing restart of OpenHAB after renaming?
Are you sure the renaming of things works for other bindings?
I would check/test that to make sure you don’t have a problem in your runtime setup.

Good luck.

Thanks for all of your help!

I’ve put enough time into figuring this out for now. Maybe I’ll revisit it sometime in the future. :neutral_face:

Unfortunately, no.

Earlier today I tried setting up a new VM for a clean install of openHAB to see if I could get the Harmony Hub working but it experiences the exact same symptoms of my production VM. That should rule out any corruption of my openHAB setup.

Sorry I don’t have any better news to report.

I wonder what the difference is, it is still working fine here on #1070:

26-Okt-2017 09:30:28.894 [INFO ] [org.eclipse.smarthome.model.script.EXTRA          ] - HARMONY: Hub is going off...
26-Okt-2017 09:30:28.922 [INFO ] [org.eclipse.smarthome.model.script.EXTRA          ] - HARMONY: Hub is off - no activity
26-Okt-2017 10:19:17.594 [INFO ] [org.eclipse.smarthome.model.script.EXTRA          ] - HARMONY: TV is starting...
26-Okt-2017 10:19:39.421 [INFO ] [org.eclipse.smarthome.model.script.EXTRA          ] - HARMONY: TV is started
26-Okt-2017 10:22:16.149 [INFO ] [org.eclipse.smarthome.model.script.EXTRA          ] - HARMONY: Hub is going off...
26-Okt-2017 14:36:18.888 [INFO ] [org.eclipse.smarthome.model.script.EXTRA          ] - HARMONY: TV is starting...
26-Okt-2017 14:36:39.405 [INFO ] [org.eclipse.smarthome.model.script.EXTRA          ] - HARMONY: TV is started
26-Okt-2017 23:18:14.471 [INFO ] [org.eclipse.smarthome.model.script.EXTRA          ] - HARMONY: Hub is going off...

Only the Hub is off - no activity is missing sometimes. Maybe I did not use the remote but Alexa at those times … but that is just a guess.

My clean install was to a Debian 9 VM with the latest openhab2 snapshot. There are no other addons installed except for the Harmony binding. I also tried 3 different versions of java to see if it made any difference, which it doesn’t.

It exhibits the exact same behavior as my production VM which is Debian 8 with the lastest OH2 snapshot and zulu 8 java. I have many bindings installed.

@gymbowfits Did you ever get a chance to try a clean install? Were you ever able to get things working properly?

Still working fine here:

13-Dez-2017 13:40:28.325 [INFO ] [org.eclipse.smarthome.model.script.EXTRA          ] - HARMONY: TV is starting...
13-Dez-2017 13:40:49.698 [INFO ] [org.eclipse.smarthome.model.script.EXTRA          ] - HARMONY: TV is started

Upgrade to the latest snapshot runtime (not only the binding) and do the setup according to the docs.

Still doesn’t work for me. I use the current snapshot every time I’ve attempted to install the binding. I’ve created at least 6 different VMs using different OS’s and java versions to no avail.

Every single time the triggers show up listed under Channels in PaperUI. I’m convinced that so long as they show up there they will not function properly. I can’t say why.

As far as following the docs:

Install binding via PaperUI
Add thing.
Add rules.

CurrentActivity works, neither trigger does. :confounded:

I don’t think that is related:
1

There was a version in between on my system where those channels did not show up, but they worked. Meanwhile (on #1119) they do show up always.

I remember reading somewhere when openHAB is not connected directly to the router where the hub is connected (for example the hub is connected through an access point) it could cause problems. But that is a long time ago. And I must admit that I have that case (harmony hub is connected through an access point).

Really sorry, I have no idea where you problem could be …

It’s good to hear that having those triggers displayed isn’t a negative.

I really do appreciate all of the help you’ve offered. :+1:

@sihui I was wondering if you could possibly check your Harmony Hub thing in Habmin and see if your Starting and Started triggers indicate “None”?

Thanks!

Sure. They indicate “Keine” = None

BTW, is there any reason why you have two items linked to the currentActivity channel?