Harmony Hub Integration

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!

@mattw Just wanted to throw a thanks out there for getting this working. It was one of the last items on my SmartThings to HE migration list!

@mattw incredible port! After getting through the many options I used your code and got it up and running. The polling is quite off from when you shut down the activity from remote/alexa to HE. If I do a refresh in the device it does update. So I am curious like others if the polling can be significantly reduced.

Great job and hope to hear an answer! This gives me new automation to try in RM now.

In the App, I believe the following section of code sets up the recurring 5 minute poll. Remember, this is polling the Logitech Cloud for the status of the activities, I believe. Just how important is it to have instant feedback that an activity has changed? You don't want to pound on the cloud every few seconds, right?

image