Harmony Hub Integration

It looks like I mistook alloff as ending any activity on the hub and overlooked the activityoff command. I modified the driver to call this method instead which works on my single hub. It seems like it should fix it for multiple hubs. I committed the change on Github.

Also, @bravenel graciously made some modifications to support the new async http commands and submitted a pull request. Unfortunately I've been a little busy and recently got around to merging the request. So there's changes to the app available as well :slight_smile:

1 Like

Is bedroom TV a Harmony Activity or Logitech Harmony Hub C2C device type? The off() command should work correctly on activities since it includes the hub ID and activity ID when making the request. If it's a Hub device type, the post above should hopefully fix it.

1 Like

Yes, the hubs themselves show as C2C devices, thanks for the quick fix, will test soon.

That worked for me.

I did see the below error in the logs.

[app:84]2018-06-27 15:00:31.472:errorgroovy.lang.MissingPropertyException: No such property: hubs for class: java.lang.String on line 411 (pollResponse)

I'm seeing this error as well in multiple spots in the code.

Sorry, I didn't fully test @bravenel's asynchttp changes. It looks like the response from asynchttp is slightly different and also not working for this case.

According to the Documentation AsyncResponse follows SmartThing's implementation and now has a getJson() method that returns the parsed JSON object. getData() returns the raw unparsed string which is why that error is displayed. I tried changing it to the new parameter (response.json) but it's returning null.

[app:162] 2018-06-29 15:34:19.628: Harmony - response.json: null
[app:162] 2018-06-29 15:34:19.626: Harmony - response.data: {hubs={11...[truncated rest of data]

@bravenel, do you know if there's any issues with the getJson() method on an AsyncResponse?

I have rolled back to the syncronous http methods for now since these were parsing into JSON correctly and have commited it to Github (only a change to the app).

Yup. I was digging through it and saw that the response data is not being returned as json as it uses ='s now. Didn't have time to do much more than that.

So we just replaced that one line of code,

ResponseValues = response.data

with

ResponseValues = response.json

and that works for us. We aren't getting null from response.json.

I don't know if this is related to your issue but see below

I installed the app code and drivers code that @mattw posted. I see both of my Harmony Hubs listed under my devices, but I'm trying to figure out how to have the ability to turn on/off specific activities. Specifically, I want to be able to turn them on/off with HomeKit via the homebridge app. It sounds like I need to add a virtual switch for my activities, but I'm not 100% clear on how to get that to work.

I figured out what the issue was. I only installed the [Logitech Harmony Hub C2C.groovy] driver code, and I guess it was looking for the [Harmony Activity.groovy] driver. It seems to be working once I installed that driver as well.

1 Like

A couple of things Iā€™ve noticed about the integration. One, the activity switch seems to take a long time to update if the activity is started somehow other than from the switch. This seems to be a known issue based on some posts I read above. A more bizarre issue Iā€™ve noticed though is, almost immediately after turning the switch on, the switch turns back off again in hubitat. If I hit the ā€œrefreshā€ button, it will show as on again. I tried to solve this issue by setting up a rule to refresh the switch a few seconds after it turns on. Iā€™m also seeing an issue where the switch will randomly turn off, and then back on again in hubitat even though the activity was running the whole time. This causes issues with any rules I have setup to use the switch turning on or off as a trigger though. Any idea why this is happening?

Which specific integration are you using? Hopefully the one based off of the ST Harmony Hub integration? That's one I believe most of us are currently using.

Assuming that is the correct integration... Yes, you should expect a delay of up to about 5 minutes... Not ideal, for sure...

I haven't noticed this. But truth be told, I probably would not notice it as I use the integration to simply start an activity as part of a larger routine/scene. I do not use the status of the Harmony Activity 'Switches' for anything currently. I'll try to test it later and report back my findings.

Yes, Iā€™m using the app that mattw put together. The main reason I noticed it is because I recently set up Rooms Manager, and am using the activity switches as a way of showing that the room is ā€œengagedā€ I noticed that it would briefly show engaged, but then revert back to vacant. It was then I saw the switch would turn on and then back off again when I started the activity.

Try changing line 370 of the Logitech Connect App from

poll()

to

runIn(10, poll)

This eliminated the ā€˜on to quick offā€™ problem you mentioned above for me during my quick testing. The app was polling the Harmony Activity status before the command to turn on the activity was finished. The above just waits 10 seconds before running the poll() command.

1 Like

That seemed to have worked for me too. Thanks!

Where do you find the HarmonyAccessToken and accessToken on the Smartthings IDE page? I clicked on the Logitech Harmony Connect App but I'm not sure of where to get the tokens from. Thanks

@mattw Thanks for the port !! Works like a charm.

Sounds interesting.

Many thanks @mattw, this worked a treat for me!